1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file or at 6 // https://developers.google.com/open-source/licenses/bsd 7 8 // Author: rennie@google.com (Jeffrey Rennie) 9 10 #ifndef GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ 11 #define GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ 12 13 #include <string> 14 15 #include "absl/container/flat_hash_set.h" 16 17 namespace google { 18 namespace protobuf { 19 namespace compiler { 20 class AccessInfoMap; 21 class SplitMap; 22 23 namespace cpp { 24 25 enum class EnforceOptimizeMode { 26 kNoEnforcement, // Use the runtime specified by the file specific options. 27 kSpeed, // Full runtime with a generated code implementation. 28 kCodeSize, // Full runtime with a reflective implementation. 29 kLiteRuntime, 30 }; 31 32 struct FieldListenerOptions { 33 bool inject_field_listener_events = false; 34 absl::flat_hash_set<std::string> forbidden_field_listener_events; 35 }; 36 37 // Generator options (see generator.cc for a description of each): 38 struct Options { 39 const AccessInfoMap* access_info_map = nullptr; 40 const SplitMap* split_map = nullptr; 41 std::string dllexport_decl; 42 std::string runtime_include_base; 43 std::string annotation_pragma_name; 44 std::string annotation_guard_name; 45 FieldListenerOptions field_listener_options; 46 EnforceOptimizeMode enforce_mode = EnforceOptimizeMode::kNoEnforcement; 47 int num_cc_files = 0; 48 bool safe_boundary_check = false; 49 bool proto_h = false; 50 bool transitive_pb_h = true; 51 bool annotate_headers = false; 52 bool lite_implicit_weak_fields = false; 53 bool descriptor_implicit_weak_messages = false; 54 bool bootstrap = false; 55 bool opensource_runtime = false; 56 bool annotate_accessor = false; 57 bool force_split = false; 58 // TODO: clean this up after the change is rolled out for 2 59 // weeks. 60 bool profile_driven_cluster_aux_subtable = true; 61 #ifdef PROTOBUF_STABLE_EXPERIMENTS 62 bool force_eagerly_verified_lazy = true; 63 bool force_inline_string = true; 64 #else // PROTOBUF_STABLE_EXPERIMENTS 65 bool force_eagerly_verified_lazy = false; 66 bool force_inline_string = false; 67 #endif // !PROTOBUF_STABLE_EXPERIMENTS 68 bool strip_nonfunctional_codegen = false; 69 }; 70 71 } // namespace cpp 72 } // namespace compiler 73 } // namespace protobuf 74 } // namespace google 75 76 #endif // GOOGLE_PROTOBUF_COMPILER_CPP_OPTIONS_H__ 77