10 #ifndef LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H 11 #define LLVM_TABLEGEN_STRINGTOOFFSETTABLE_H 27 std::string AggregateString;
34 StringOffset.
insert(std::make_pair(Str, AggregateString.
size()));
35 if (IterBool.second) {
37 AggregateString.append(Str.
begin(), Str.
end());
39 AggregateString +=
'\0';
42 return IterBool.first->second;
49 AggregateString = Str.
str();
52 unsigned CharsPrinted = 0;
53 for (
unsigned i = 0, e = AggregateString.size(); i != e; ++i) {
54 if (CharsPrinted > 70) {
58 O << AggregateString[i];
62 if (AggregateString[i] !=
'\\')
65 assert(i + 1 < AggregateString.size() &&
"Incomplete escape sequence!");
66 if (isdigit(AggregateString[i + 1])) {
67 assert(isdigit(AggregateString[i + 2]) &&
68 isdigit(AggregateString[i + 3]) &&
69 "Expected 3 digit octal escape!");
70 O << AggregateString[++i];
71 O << AggregateString[++i];
72 O << AggregateString[++i];
75 O << AggregateString[++i];
85 assert(AggregateString.find(
')') == std::string::npos &&
86 "can't emit raw string with closing parens");
89 for (
char C : AggregateString) {
This class represents lattice values for constants.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
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...
StringRef str() const
Explicit conversion to StringRef.
void EmitString(raw_ostream &O)
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an escape...
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
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.