LLVM: lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
15#include
16#include
17
18using namespace llvm;
20
23
25 Stream = Contents;
27}
28
32
39 return std::move(EC);
40 return Result;
41}
42
45
47 auto P = StringToId.insert({S, StringSize});
48
49
50
51 if (P.second) {
52 IdToString.insert({P.first->getValue(), P.first->getKey()});
53 StringSize += S.size() + 1;
54 }
55
56 return P.first->second;
57}
58
60 return StringSize;
61}
62
65 uint32_t End = Begin + StringSize;
66
67
69 return EC;
70
71 for (auto &Pair : StringToId) {
76 return EC;
78 }
79
81 assert((End - Begin) == StringSize);
83}
84
86
88 std::vector<uint32_t> Result;
89 Result.reserve(IdToString.size());
90 for (const auto &Entry : IdToString)
91 Result.push_back(Entry.first);
93 return Result;
94}
95
97 auto Iter = StringToId.find(S);
98 assert(Iter != StringToId.end());
99 return Iter->second;
100}
101
103 auto Iter = IdToString.find(Id);
104 assert(Iter != IdToString.end());
105 return Iter->second;
106}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Provides read only access to a subclass of BinaryStream.
LLVM_ABI Error readStreamRef(BinaryStreamRef &Ref)
Read the entire remainder of the underlying stream into Ref.
LLVM_ABI Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
void setOffset(uint64_t Off)
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
Provides write only access to a subclass of WritableBinaryStream.
LLVM_ABI Error writeCString(StringRef Str)
Write the string Str to the underlying stream followed by a null terminator.
uint64_t getOffset() const
void setOffset(uint64_t Off)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
size_t find(char C, size_t From=0) const
Search for the first character C in the string.
LLVM_ABI Expected< StringRef > getString(uint32_t Offset) const
Definition DebugStringTableSubsection.cpp:34
LLVM_ABI DebugStringTableSubsectionRef()
Definition DebugStringTableSubsection.cpp:21
LLVM_ABI Error initialize(BinaryStreamRef Contents)
Definition DebugStringTableSubsection.cpp:24
DebugStringTableSubsection()
Definition DebugStringTableSubsection.cpp:43
StringRef getStringForId(uint32_t Id) const
Definition DebugStringTableSubsection.cpp:102
uint32_t size() const
Definition DebugStringTableSubsection.cpp:85
uint32_t calculateSerializedSize() const override
Definition DebugStringTableSubsection.cpp:59
uint32_t getIdForString(StringRef S) const
Definition DebugStringTableSubsection.cpp:96
uint32_t insert(StringRef S)
Definition DebugStringTableSubsection.cpp:46
Error commit(BinaryStreamWriter &Writer) const override
Definition DebugStringTableSubsection.cpp:63
std::vector< uint32_t > sortedIds() const
Definition DebugStringTableSubsection.cpp:87
DebugSubsectionRef(DebugSubsectionKind Kind)
DebugSubsection(DebugSubsectionKind Kind)
This is an optimization pass for GlobalISel generic memory operations.
void sort(IteratorTy Start, IteratorTy End)