[PATCH] D31922: Object: Use offset+size as the irsymtab string representation.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 11:08:15 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL300465: Object: Use offset+size as the irsymtab string representation. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D31922?vs=94774&id=95460#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31922

Files:
  llvm/trunk/include/llvm/Object/IRSymtab.h
  llvm/trunk/lib/Object/IRSymtab.cpp


Index: llvm/trunk/lib/Object/IRSymtab.cpp
===================================================================
--- llvm/trunk/lib/Object/IRSymtab.cpp
+++ llvm/trunk/lib/Object/IRSymtab.cpp
@@ -28,7 +28,7 @@
   Builder(SmallVector<char, 0> &Symtab, SmallVector<char, 0> &Strtab)
       : Symtab(Symtab), Strtab(Strtab) {}
 
-  StringTableBuilder StrtabBuilder{StringTableBuilder::ELF};
+  StringTableBuilder StrtabBuilder{StringTableBuilder::RAW};
 
   BumpPtrAllocator Alloc;
   StringSaver Saver{Alloc};
@@ -49,6 +49,7 @@
 
   void setStr(storage::Str &S, StringRef Value) {
     S.Offset = StrtabBuilder.add(Value);
+    S.Size = Value.size();
   }
   template <typename T>
   void writeRange(storage::Range<T> &R, const std::vector<T> &Objs) {
Index: llvm/trunk/include/llvm/Object/IRSymtab.h
===================================================================
--- llvm/trunk/include/llvm/Object/IRSymtab.h
+++ llvm/trunk/include/llvm/Object/IRSymtab.h
@@ -41,9 +41,9 @@
 
 /// A reference to a string in the string table.
 struct Str {
-  Word Offset;
+  Word Offset, Size;
   StringRef get(StringRef Strtab) const {
-    return Strtab.data() + Offset;
+    return {Strtab.data() + Offset, Size};
   }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31922.95460.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170417/cb47763d/attachment-0001.bin>


More information about the llvm-commits mailing list