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)
                                            ^
This commit is contained in:
Benjamin Kramer 2022-12-06 14:34:18 +01:00
parent 8ff4d218a8
commit e50a60d734

View File

@ -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 {