19 if (LHSKind == StdStringKind && RHSKind == EmptyKind)
20 return *LHS.stdString;
24 if (LHSKind == FormatvObjectKind && RHSKind == EmptyKind)
25 return LHS.formatvObject->str();
39 switch (getLHSKind()) {
44 const std::string *
str = LHS.stdString;
45 return StringRef(str->c_str(), str->size());
58 NodeKind
Kind)
const {
60 case Twine::NullKind:
break;
61 case Twine::EmptyKind:
break;
62 case Twine::TwineKind:
65 case Twine::CStringKind:
68 case Twine::StdStringKind:
71 case Twine::StringRefKind:
74 case Twine::SmallStringKind:
75 OS << *Ptr.smallString;
77 case Twine::FormatvObjectKind:
78 OS << *Ptr.formatvObject;
83 case Twine::DecUIKind:
89 case Twine::DecULKind:
95 case Twine::DecULLKind:
98 case Twine::DecLLKind:
101 case Twine::UHexKind:
107 void Twine::printOneChildRepr(
raw_ostream &OS, Child Ptr,
108 NodeKind Kind)
const {
110 case Twine::NullKind:
112 case Twine::EmptyKind:
113 OS <<
"empty";
break;
114 case Twine::TwineKind:
116 Ptr.twine->printRepr(OS);
118 case Twine::CStringKind:
120 << Ptr.cString <<
"\"";
122 case Twine::StdStringKind:
123 OS <<
"std::string:\""
124 << Ptr.stdString <<
"\"";
126 case Twine::StringRefKind:
128 << Ptr.stringRef <<
"\"";
130 case Twine::SmallStringKind:
131 OS <<
"smallstring:\"" << *Ptr.smallString <<
"\"";
133 case Twine::FormatvObjectKind:
134 OS <<
"formatv:\"" << *Ptr.formatvObject <<
"\"";
136 case Twine::CharKind:
137 OS <<
"char:\"" << Ptr.character <<
"\"";
139 case Twine::DecUIKind:
140 OS <<
"decUI:\"" << Ptr.decUI <<
"\"";
142 case Twine::DecIKind:
143 OS <<
"decI:\"" << Ptr.decI <<
"\"";
145 case Twine::DecULKind:
146 OS <<
"decUL:\"" << *Ptr.decUL <<
"\"";
148 case Twine::DecLKind:
149 OS <<
"decL:\"" << *Ptr.decL <<
"\"";
151 case Twine::DecULLKind:
152 OS <<
"decULL:\"" << *Ptr.decULL <<
"\"";
154 case Twine::DecLLKind:
155 OS <<
"decLL:\"" << *Ptr.decLL <<
"\"";
157 case Twine::UHexKind:
158 OS <<
"uhex:\"" << Ptr.uHex <<
"\"";
164 printOneChild(OS, LHS, getLHSKind());
165 printOneChild(OS, RHS, getRHSKind());
170 printOneChildRepr(OS, LHS, getLHSKind());
172 printOneChildRepr(OS, RHS, getRHSKind());
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
void push_back(const T &Elt)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
void dump() const
Dump the concatenated string represented by this twine to stderr.
A raw_ostream that writes to an SmallVector or SmallString.
void dumpRepr() const
Dump the representation of this twine to stderr.
std::string str() const
Return the twine contents as a std::string.
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
void printRepr(raw_ostream &OS) const
Write the representation of this twine to the stream OS.
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
pointer data()
Return a pointer to the vector's buffer, even if empty().
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
StringRef toNullTerminatedStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single null terminated StringRef if it can be represented as such...
void print(raw_ostream &OS) const
Write the concatenated string represented by this twine to the stream OS.
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.