[llvm] r318899 - Revert r318822 "[llvm-tblgen] - Stop using std::string in RecordKeeper."

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 22:52:45 PST 2017


Author: grimar
Date: Wed Nov 22 22:52:44 2017
New Revision: 318899

URL: http://llvm.org/viewvc/llvm-project?rev=318899&view=rev
Log:
Revert r318822 "[llvm-tblgen] - Stop using std::string in RecordKeeper."

It reported to have problems with memory sanitizers and DBUILD_SHARED_LIBS=ON.

Modified:
    llvm/trunk/include/llvm/TableGen/Record.h
    llvm/trunk/utils/TableGen/CTagsEmitter.cpp

Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=318899&r1=318898&r2=318899&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Wed Nov 22 22:52:44 2017
@@ -1525,7 +1525,7 @@ struct MultiClass {
 };
 
 class RecordKeeper {
-  using RecordMap = std::map<StringRef, std::unique_ptr<Record>>;
+  using RecordMap = std::map<std::string, std::unique_ptr<Record>>;
   RecordMap Classes, Defs;
 
 public:

Modified: llvm/trunk/utils/TableGen/CTagsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CTagsEmitter.cpp?rev=318899&r1=318898&r2=318899&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CTagsEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/CTagsEmitter.cpp Wed Nov 22 22:52:44 2017
@@ -28,17 +28,18 @@ namespace {
 
 class Tag {
 private:
-  StringRef Id;
+  const std::string *Id;
   SMLoc Loc;
 public:
-  Tag(StringRef Name, const SMLoc Location) : Id(Name), Loc(Location) {}
-  int operator<(const Tag &B) const { return Id < B.Id; }
+  Tag(const std::string &Name, const SMLoc Location)
+      : Id(&Name), Loc(Location) {}
+  int operator<(const Tag &B) const { return *Id < *B.Id; }
   void emit(raw_ostream &OS) const {
     const MemoryBuffer *CurMB =
         SrcMgr.getMemoryBuffer(SrcMgr.FindBufferContainingLoc(Loc));
     auto BufferName = CurMB->getBufferIdentifier();
     std::pair<unsigned, unsigned> LineAndColumn = SrcMgr.getLineAndColumn(Loc);
-    OS << Id << "\t" << BufferName << "\t" << LineAndColumn.first << "\n";
+    OS << *Id << "\t" << BufferName << "\t" << LineAndColumn.first << "\n";
   }
 };
 




More information about the llvm-commits mailing list