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-23 12:48:17 +0100
commit5ce4e92264102de21760c94db9166afe8f71fcf6 (patch)
treea377b5159335afbb39f1d4dc4b9c9b8c799527c2 /lld/COFF
parentb7b1e5c96fe05bad7cb68fdaea21d2b88ce7f2d1 (diff)
downloadllvm-5ce4e92264102de21760c94db9166afe8f71fcf6.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 with a change to llvm/utils/TableGen/OptParserEmitter.cpp to cope with GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108158 Differential Revision: https://reviews.llvm.org/D139881
Diffstat (limited to 'lld/COFF')
-rw-r--r--lld/COFF/DriverUtils.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/COFF/DriverUtils.cpp b/lld/COFF/DriverUtils.cpp
index 26802f8beeb0..9a8d88c38c37 100644
--- a/lld/COFF/DriverUtils.cpp
+++ b/lld/COFF/DriverUtils.cpp
@@ -772,12 +772,13 @@ 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 std::initializer_list<llvm::StringLiteral> NAME = VALUE;
#include "Options.inc"
#undef PREFIX
// Create table mapping all options defined in Options.td
-static constexpr llvm::opt::OptTable::Info infoTable[] = {
+static constexpr std::initializer_list<llvm::opt::OptTable::Info> infoTable = {
#define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X7, X8, X9, X10, X11, X12) \
{X1, X2, X10, X11, OPT_##ID, llvm::opt::Option::KIND##Class, \
X9, X8, OPT_##GROUP, OPT_##ALIAS, X7, X12},