Merge "tracing: Work around an LLVM bug on Windows"
diff --git a/include/perfetto/tracing/internal/track_event_macros.h b/include/perfetto/tracing/internal/track_event_macros.h
index 0c7ffb7..4663c18 100644
--- a/include/perfetto/tracing/internal/track_event_macros.h
+++ b/include/perfetto/tracing/internal/track_event_macros.h
@@ -59,11 +59,15 @@
/* variable), we need two separate copies of the registry with different */ \
/* storage specifiers. */ \
/**/ \
+ /* Note that because of a Clang/Windows bug, the constexpr category */ \
+ /* registry isn't given the enabled/disabled state array. All access */ \
+ /* to the category states should therefore be done through the */ \
+ /* non-constexpr registry. See */ \
+ /* https://bugs.llvm.org/show_bug.cgi?id=51558 */ \
+ /**/ \
/* TODO(skyostil): Unify these using a C++17 inline constexpr variable. */ \
constexpr ::perfetto::internal::TrackEventCategoryRegistry \
- kConstExprCategoryRegistry(kCategoryCount, \
- &kCategories[0], \
- &g_category_state_storage[0]); \
+ kConstExprCategoryRegistry(kCategoryCount, &kCategories[0], nullptr); \
PERFETTO_COMPONENT_EXPORT extern const ::perfetto::internal:: \
TrackEventCategoryRegistry kCategoryRegistry; \
static_assert(kConstExprCategoryRegistry.ValidateCategories(), \
diff --git a/include/perfetto/tracing/track_event_legacy.h b/include/perfetto/tracing/track_event_legacy.h
index d0f1829..6be024b 100644
--- a/include/perfetto/tracing/track_event_legacy.h
+++ b/include/perfetto/tracing/track_event_legacy.h
@@ -1257,7 +1257,7 @@
"Enabled flag pointers are not supported for dynamic trace " \
"categories."); \
}, \
- PERFETTO_TRACK_EVENT_NAMESPACE::internal::kConstExprCategoryRegistry \
+ PERFETTO_TRACK_EVENT_NAMESPACE::internal::kCategoryRegistry \
.GetCategoryState( \
::PERFETTO_TRACK_EVENT_NAMESPACE::internal::kCategoryRegistry \
.Find(category, /*is_dynamic=*/false)))
@@ -1265,7 +1265,7 @@
// Given a pointer returned by TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED,
// yields a pointer to the name of the corresponding category group.
#define TRACE_EVENT_API_GET_CATEGORY_GROUP_NAME(category_enabled_ptr) \
- ::PERFETTO_TRACK_EVENT_NAMESPACE::internal::kConstExprCategoryRegistry \
+ ::PERFETTO_TRACK_EVENT_NAMESPACE::internal::kCategoryRegistry \
.GetCategory( \
category_enabled_ptr - \
reinterpret_cast<const uint8_t*>( \