diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2022-12-06 14:34:18 +0100 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2022-12-06 14:39:38 +0100 |
| commit | e50a60d7349de151bd2b06d85a79201ebc372d8a (patch) | |
| tree | 7ca9f1e3119ff4ecfba81a258afac29d8327d98e /llvm/utils/TableGen/OptParserEmitter.cpp | |
| parent | 8ff4d218a80b887bb645ec426aefa1ab7144c5f3 (diff) | |
Quick fix to unbreak tblgen past 8ae18303f97d
llvm/tools/llvm-objdump/llvm-objdump.cpp:128:38: error: constexpr variable 'ObjdumpInfoTable' must be initialized by a constant expression
static constexpr opt::OptTable::Info ObjdumpInfoTable[] = {
^ ~
ObjdumpOpts.inc:30:45: note: non-constexpr function 'substr' cannot be used in a constant expression
OPTION(prefix_0, llvm::StringRef("<input>").substr(0), INPUT, Input, INVALID, INVALID, nullptr, 0, 0, nullptr, nullptr, nullptr)
^
Diffstat (limited to 'llvm/utils/TableGen/OptParserEmitter.cpp')
| -rw-r--r-- | llvm/utils/TableGen/OptParserEmitter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptParserEmitter.cpp index ebef5847f713..f8ddbefdcc59 100644 --- a/llvm/utils/TableGen/OptParserEmitter.cpp +++ b/llvm/utils/TableGen/OptParserEmitter.cpp @@ -54,9 +54,9 @@ static std::string getOptionSpelling(const Record &R) { static void emitNameUsingSpelling(raw_ostream &OS, const Record &R) { size_t PrefixLength; - OS << "llvm::StringRef("; + OS << "llvm::StringRef(&"; write_cstring(OS, StringRef(getOptionSpelling(R, PrefixLength))); - OS << ").substr(" << PrefixLength << ")"; + OS << '[' << PrefixLength << "])"; } class MarshallingInfo { |
