From 719d98dfa841c522d8d452f0685e503538415a53 Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Mon, 12 Dec 2022 17:02:15 +0100 Subject: [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 Differential Revision: https://reviews.llvm.org/D139881 --- llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp') diff --git a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp index 7f06ed0..74a20a4 100644 --- a/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp +++ b/llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp @@ -41,11 +41,12 @@ enum { #undef OPTION }; -#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE; +#define PREFIX(NAME, VALUE) \ + static constexpr std::initializer_list NAME = VALUE; #include "Options.inc" #undef PREFIX -static constexpr opt::OptTable::Info InfoTable[] = { +static constexpr std::initializer_list InfoTable = { #define OPTION(X1, X2, ID, KIND, GROUP, ALIAS, X7, X8, X9, X10, X11, X12) \ {X1, X2, X10, X11, OPT_##ID, opt::Option::KIND##Class, \ X9, X8, OPT_##GROUP, OPT_##ALIAS, X7, X12}, -- cgit v1.1