MCPcopy Create free account
hub / github.com/baidu/babylon / constexpr_symbol_generator

Function constexpr_symbol_generator

src/babylon/serialization/constexpr.cpp:25–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23// 为了支持混用,这里采用桩函数通过取地址方式强制产出符号
24namespace internal {
25ABSL_ATTRIBUTE_WEAK uintptr_t constexpr_symbol_generator() {
26 return static_cast<uintptr_t>(0) +
27 reinterpret_cast<uintptr_t>(
28 &SerializationHelper::SERIALIZED_SIZE_COMPLEXITY_COMPLEX) +
29 reinterpret_cast<uintptr_t>(
30 &SerializationHelper::SERIALIZED_SIZE_COMPLEXITY_SIMPLE) +
31 reinterpret_cast<uintptr_t>(
32 &SerializationHelper::SERIALIZED_SIZE_COMPLEXITY_TRIVIAL)
33#define BABYLON_TMP_GEN(type) \
34 +reinterpret_cast<uintptr_t>(&SerializeTraits<type>::SERIALIZABLE) + \
35 reinterpret_cast<uintptr_t>(&SerializeTraits<type>::WIRE_TYPE) + \
36 reinterpret_cast<uintptr_t>( \
37 &SerializeTraits<type>::SERIALIZED_SIZE_COMPLEXITY)
38 BABYLON_TMP_GEN(bool) BABYLON_TMP_GEN(int8_t)
39 BABYLON_TMP_GEN(int16_t) BABYLON_TMP_GEN(int32_t)
40 BABYLON_TMP_GEN(int64_t) BABYLON_TMP_GEN(uint8_t)
41 BABYLON_TMP_GEN(uint16_t) BABYLON_TMP_GEN(uint32_t)
42 BABYLON_TMP_GEN(uint64_t) BABYLON_TMP_GEN(float)
43 BABYLON_TMP_GEN(double)
44#undef BABYLON_TMP_GEN
45 ;
46}
47} // namespace internal
48
49// 当库本身用-std=c++14编译时,强制产出的符号为常量符号

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected