cppgc: Fix compile-time typename for release builds

Bug: chromium:1056170
Change-Id: I3320a0b8c740067ea1e424c37ae8db4e87753c1a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2461738
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70419}
This commit is contained in:
Michael Lippautz 2020-10-09 09:53:31 +02:00 committed by Commit Bot
parent 69388737c5
commit d3e8c837eb

View File

@ -16,13 +16,16 @@ namespace internal {
#if CPPGC_SUPPORTS_OBJECT_NAMES && defined(__clang__)
#define CPPGC_SUPPORTS_COMPILE_TIME_TYPENAME 1
// Provides constexpr c-string storage for a name of fixed |Size| characters.
// Automatically appends terminating 0 byte.
template <size_t Size>
struct NameBuffer {
char name[Size]{};
char name[Size + 1]{};
static constexpr NameBuffer FromCString(const char* str) {
NameBuffer result;
for (size_t i = 0; i < Size; ++i) result.name[i] = str[i];
result.name[Size] = 0;
return result;
}
};