18 if (LHSKind == StdStringKind && RHSKind == EmptyKind)
19 return *LHS.stdString;
40 switch (getLHSKind()) {
45 const std::string *
str = LHS.stdString;
46 return StringRef(str->c_str(), str->size());
58 void Twine::printOneChild(
raw_ostream &OS, Child Ptr,
59 NodeKind
Kind)
const {
61 case Twine::NullKind:
break;
62 case Twine::EmptyKind:
break;
63 case Twine::TwineKind:
66 case Twine::CStringKind:
69 case Twine::StdStringKind:
72 case Twine::StringRefKind:
78 case Twine::DecUIKind:
84 case Twine::DecULKind:
90 case Twine::DecULLKind:
93 case Twine::DecLLKind:
102 void Twine::printOneChildRepr(
raw_ostream &OS, Child Ptr,
103 NodeKind Kind)
const {
105 case Twine::NullKind:
107 case Twine::EmptyKind:
108 OS <<
"empty";
break;
109 case Twine::TwineKind:
111 Ptr.twine->printRepr(OS);
113 case Twine::CStringKind:
115 << Ptr.cString <<
"\"";
117 case Twine::StdStringKind:
118 OS <<
"std::string:\""
119 << Ptr.stdString <<
"\"";
121 case Twine::StringRefKind:
123 << Ptr.stringRef <<
"\"";
125 case Twine::CharKind:
126 OS <<
"char:\"" << Ptr.character <<
"\"";
128 case Twine::DecUIKind:
129 OS <<
"decUI:\"" << Ptr.decUI <<
"\"";
131 case Twine::DecIKind:
132 OS <<
"decI:\"" << Ptr.decI <<
"\"";
134 case Twine::DecULKind:
135 OS <<
"decUL:\"" << *Ptr.decUL <<
"\"";
137 case Twine::DecLKind:
138 OS <<
"decL:\"" << *Ptr.decL <<
"\"";
140 case Twine::DecULLKind:
141 OS <<
"decULL:\"" << *Ptr.decULL <<
"\"";
143 case Twine::DecLLKind:
144 OS <<
"decLL:\"" << *Ptr.decLL <<
"\"";
146 case Twine::UHexKind:
147 OS <<
"uhex:\"" << Ptr.uHex <<
"\"";
153 printOneChild(OS, LHS, getLHSKind());
154 printOneChild(OS, RHS, getRHSKind());
159 printOneChildRepr(OS, LHS, getLHSKind());
161 printOneChildRepr(OS, RHS, getRHSKind());
void toVector(SmallVectorImpl< char > &Out) const
void push_back(const T &Elt)
bool isSingleStringRef() const
std::string str() const
str - Get the contents as an std::string.
void dump() const
Dump the concatenated string represented by this twine to stderr.
void dumpRepr() const
Dump the representation of this twine to stderr.
std::string str() const
str - Return the twine contents as a std::string.
raw_ostream & write_hex(unsigned long long N)
write_hex - Output N in hexadecimal, without any prefix or padding.
StringRef getSingleStringRef() const
void printRepr(raw_ostream &OS) const
Write the representation of this twine to the stream OS.
StringRef toStringRef(SmallVectorImpl< char > &Out) const
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
pointer data()
data - Return a pointer to the vector's buffer, even if empty().
StringRef toNullTerminatedStringRef(SmallVectorImpl< char > &Out) const
void print(raw_ostream &OS) const