summaryrefslogtreecommitdiff
path: root/lld/COFF
diff options
context:
space:
mode:
authorserge-sans-paille <sguelton@mozilla.com>2022-12-12 17:02:15 +0100
committerserge-sans-paille <sguelton@mozilla.com>2022-12-24 10:25:06 +0100
commite953ae5bbc313fd0cc980ce021d487e5b5199ea4 (patch)
treefb51db9062601309046a935536885434765ab500 /lld/COFF
parent83d4851436904c005ff0831e38e1814a0a8f00ac (diff)
downloadllvm-e953ae5bbc313fd0cc980ce021d487e5b5199ea4.tar.gz
[clang] Use a StringRef instead of a raw char pointer to store builtin and call information
This avoids recomputing string length that is already known at compile time. It has a slight impact on preprocessing / compile time, see https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u This is a recommit of 719d98dfa841c522d8d452f0685e503538415a53 that into account a GGC issue (probably https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92181) when dealing with intiailizer_list and constant expressions. Workaround this by avoiding initializer list, at the expense of a temporary plain old array. Differential Revision: https://reviews.llvm.org/D139881
Diffstat (limited to 'lld/COFF')
-rw-r--r--lld/COFF/DriverUtils.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index 26802f8beeb0..d4eea0893941 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -772,7 +772,10 @@ MemoryBufferRef convertResToCOFF(ArrayRef<MemoryBufferRef> mbs,
// Create OptTable
// Create prefix string literals used in Options.td
-#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#define PREFIX(NAME, VALUE) \
+ static constexpr llvm::StringLiteral NAME##_init[] = VALUE; \
+ static constexpr llvm::ArrayRef<llvm::StringLiteral> NAME( \
+ NAME##_init, std::size(NAME##_init) - 1);
#include "Options.inc"
#undef PREFIX