[PATCH] D33710: [TableGen] Make Record::getValueAsString and getValueAsListOfStrings return StringRefs instead of std::string

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 23:44:48 PDT 2017


craig.topper created this revision.

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.


https://reviews.llvm.org/D33710

Files:
  include/llvm/TableGen/Record.h
  lib/TableGen/Record.cpp
  utils/TableGen/AsmMatcherEmitter.cpp
  utils/TableGen/AsmWriterEmitter.cpp
  utils/TableGen/CodeEmitterGen.cpp
  utils/TableGen/CodeGenDAGPatterns.cpp
  utils/TableGen/GlobalISelEmitter.cpp
  utils/TableGen/OptParserEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33710.100825.patch
Type: text/x-patch
Size: 8627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170531/204c4f80/attachment.bin>


More information about the llvm-commits mailing list