1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Object: Use offset+size as the irsymtab string representation.

This is consistent with the bitcode string table.

Differential Revision: https://reviews.llvm.org/D31922

llvm-svn: 300465
This commit is contained in:
Peter Collingbourne 2017-04-17 17:55:24 +00:00
parent 2d3eb26eeb
commit 04cf7aebf3
2 changed files with 4 additions and 3 deletions

View File

@ -41,9 +41,9 @@ typedef support::ulittle32_t Word;
/// 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};
}
};

View File

@ -28,7 +28,7 @@ struct Builder {
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 @@ struct Builder {
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) {