10 #ifndef LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H
11 #define LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H
27 std::string AggregateString;
32 StringOffset.
insert(std::make_pair(Str, AggregateString.size()));
33 if (IterBool.second) {
35 AggregateString.append(Str.
begin(), Str.
end());
37 AggregateString +=
'\0';
40 return IterBool.first->second;
47 AggregateString = Str.
str();
50 unsigned CharsPrinted = 0;
51 for (
unsigned i = 0, e = AggregateString.size();
i != e; ++
i) {
52 if (CharsPrinted > 70) {
56 O << AggregateString[
i];
60 if (AggregateString[
i] !=
'\\')
63 assert(
i+1 < AggregateString.size() &&
"Incomplete escape sequence!");
64 if (isdigit(AggregateString[
i+1])) {
65 assert(isdigit(AggregateString[
i+2]) &&
66 isdigit(AggregateString[
i+3]) &&
67 "Expected 3 digit octal escape!");
68 O << AggregateString[++
i];
69 O << AggregateString[++
i];
70 O << AggregateString[++
i];
73 O << AggregateString[++
i];
83 assert(AggregateString.find(
')') == std::string::npos &&
84 "can't emit raw string with closing parens");
87 for (
char C : AggregateString) {
A raw_ostream that writes to an SmallVector or SmallString.
unsigned GetOrAddStringOffset(StringRef Str, bool appendZero=true)
StringToOffsetTable - This class uniques a bunch of nul-terminated strings and keeps track of their o...
void EmitString(raw_ostream &O)
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '', ' ', '"', and anything that doesn't satisfy std::isprint into an escape...
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
StringRef str() const
Explicit conversion to StringRef.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void EmitCharArray(raw_ostream &O)
Emit the string using character literals.
This class implements an extremely fast bulk output stream that can only output to a stream...
StringRef - Represent a constant reference to a string, i.e.