12 #include "llvm/Config/llvm-config.h" 20 if (LHSKind == StdStringKind && RHSKind == EmptyKind)
21 return *LHS.stdString;
25 if (LHSKind == FormatvObjectKind && RHSKind == EmptyKind)
26 return LHS.formatvObject->str();
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:
75 case Twine::SmallStringKind:
76 OS << *Ptr.smallString;
78 case Twine::FormatvObjectKind:
79 OS << *Ptr.formatvObject;
84 case Twine::DecUIKind:
90 case Twine::DecULKind:
96 case Twine::DecULLKind:
99 case Twine::DecLLKind:
102 case Twine::UHexKind:
108 void Twine::printOneChildRepr(
raw_ostream &OS, Child Ptr,
109 NodeKind
Kind)
const {
111 case Twine::NullKind:
113 case Twine::EmptyKind:
114 OS <<
"empty";
break;
115 case Twine::TwineKind:
117 Ptr.twine->printRepr(OS);
119 case Twine::CStringKind:
121 << Ptr.cString <<
"\"";
123 case Twine::StdStringKind:
124 OS <<
"std::string:\"" 125 << Ptr.stdString <<
"\"";
127 case Twine::StringRefKind:
129 << Ptr.stringRef <<
"\"";
131 case Twine::SmallStringKind:
132 OS <<
"smallstring:\"" << *Ptr.smallString <<
"\"";
134 case Twine::FormatvObjectKind:
135 OS <<
"formatv:\"" << *Ptr.formatvObject <<
"\"";
137 case Twine::CharKind:
138 OS <<
"char:\"" << Ptr.character <<
"\"";
140 case Twine::DecUIKind:
141 OS <<
"decUI:\"" << Ptr.decUI <<
"\"";
143 case Twine::DecIKind:
144 OS <<
"decI:\"" << Ptr.decI <<
"\"";
146 case Twine::DecULKind:
147 OS <<
"decUL:\"" << *Ptr.decUL <<
"\"";
149 case Twine::DecLKind:
150 OS <<
"decL:\"" << *Ptr.decL <<
"\"";
152 case Twine::DecULLKind:
153 OS <<
"decULL:\"" << *Ptr.decULL <<
"\"";
155 case Twine::DecLLKind:
156 OS <<
"decLL:\"" << *Ptr.decLL <<
"\"";
158 case Twine::UHexKind:
159 OS <<
"uhex:\"" << Ptr.uHex <<
"\"";
165 printOneChild(OS, LHS, getLHSKind());
166 printOneChild(OS, RHS, getRHSKind());
171 printOneChildRepr(OS, LHS, getLHSKind());
173 printOneChildRepr(OS, RHS, getRHSKind());
177 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
This class represents lattice values for constants.
void push_back(const T &Elt)
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
A raw_ostream that writes to an SmallVector or SmallString.
void dumpRepr() const
Dump the representation of this twine to stderr.
void dump() const
Dump the concatenated string represented by this twine to stderr.
raw_ostream & write_hex(unsigned long long N)
Output N in hexadecimal, without any prefix or padding.
StringRef toNullTerminatedStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single null terminated StringRef if it can be represented as such...
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
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().
std::string str() const
Return the twine contents as a std::string.
void printRepr(raw_ostream &OS) const
Write the representation of 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.
void print(raw_ostream &OS) const
Write the concatenated string represented by this twine to the stream OS.