diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-05-31 19:01:11 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-05-31 19:01:11 +0000 |
commit | 2b8419a22d0fdb9b204ef0a0262a6ca22137b9a5 (patch) | |
tree | d7801abd33c2973d4a9f375e9519e55b3745d375 /llvm/utils/TableGen/AsmWriterEmitter.cpp | |
parent | fa5dc09292ad2310a378a82a05a6449f2bd3a113 (diff) | |
download | bcm5719-llvm-2b8419a22d0fdb9b204ef0a0262a6ca22137b9a5.tar.gz bcm5719-llvm-2b8419a22d0fdb9b204ef0a0262a6ca22137b9a5.zip |
[TableGen] Make Record::getValueAsString and getValueAsListOfStrings return StringRefs instead of std::string
Internally both these methods just return the result of getValue on either a StringInit or a CodeInit object. In both cases this returns a StringRef pointing to a string allocated in the BumpPtrAllocator so its not going anywhere. So we can just pass that StringRef along.
This is a fairly naive patch that targets just the build failures caused by this change. There's additional work that can be done to avoid creating std::string at call sites that still think getValueAsString returns a std::string. I'll try to clean those up in future patches.
Differential Revision: https://reviews.llvm.org/D33710
llvm-svn: 304325
Diffstat (limited to 'llvm/utils/TableGen/AsmWriterEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/AsmWriterEmitter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 40b7857ab99..4b06e9e247f 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -523,7 +523,7 @@ emitRegisterNameString(raw_ostream &O, StringRef AltName, // If the register has an alternate name for this index, use it. // Otherwise, leave it empty as an error flag. if (Idx < e) { - std::vector<std::string> AltNames = + std::vector<StringRef> AltNames = Reg.TheDef->getValueAsListOfStrings("AltNames"); if (AltNames.size() <= Idx) PrintFatalError(Reg.TheDef->getLoc(), |