llvm.org GIT mirror llvm / dddfd34
Switch to SmallString::str from SmallString::c_str, and remove SmallString::c_str. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79456 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 11 years ago
5 changed file(s) with 9 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
3737
3838
3939 // Extra methods.
40 const char *c_str() const {
41 SmallString *This = const_cast(this);
42 // Ensure that there is a \0 at the end of the string.
43 This->reserve(this->size()+1);
44 This->End[0] = 0;
45 return this->begin();
46 }
47
4840 StringRef str() const { return StringRef(this->begin(), this->size()); }
4941
5042 // Extra operators.
791791 if (MetadataBase *B = dyn_cast(MD))
792792 Elts.push_back(B);
793793 }
794 Value *V = NamedMDNode::Create(Context, Name.c_str(), Elts.data(),
794 Value *V = NamedMDNode::Create(Context, Name.str(), Elts.data(),
795795 Elts.size(), TheModule);
796796 MDValueList.AssignValue(V, NextValueNo++);
797797 break;
866866
867867 SmallString<40> S;
868868 ptrMask.toStringUnsigned(S);
869 O << ") & " << S.c_str() << ')';
869 O << ") & " << S.str() << ')';
870870 break;
871871 }
872872 case Instruction::Add:
12851285 SmallString<40> S;
12861286 CI->getValue().toStringUnsigned(S, 16);
12871287 O.PadToColumn(TAI->getCommentColumn());
1288 O << TAI->getCommentString() << " 0x" << S.c_str();
1288 O << TAI->getCommentString() << " 0x" << S.str();
12891289 }
12901290 }
12911291 O << '\n';
21672167 std::string APInt::toString(unsigned Radix = 10, bool Signed = true) const {
21682168 SmallString<40> S;
21692169 toString(S, Radix, Signed);
2170 return S.c_str();
2170 return S.str();
21712171 }
21722172
21732173
21752175 SmallString<40> S, U;
21762176 this->toStringUnsigned(U);
21772177 this->toStringSigned(S);
2178 fprintf(stderr, "APInt(%db, %su %ss)", BitWidth, U.c_str(), S.c_str());
2178 errs() << "APInt(" << BitWidth << "b, "
2179 << U.str() << "u " << S.str() << "s)";
21792180 }
21802181
21812182 void APInt::print(raw_ostream &OS, bool isSigned) const {
21822183 SmallString<40> S;
21832184 this->toString(S, 10, isSigned);
2184 OS << S.c_str();
2185 OS << S.str();
21852186 }
21862187
21872188 std::ostream &llvm::operator<<(std::ostream &o, const APInt &I) {
7070 }
7171
7272 if (!TmpStr.empty()) {
73 __crashreporter_info__ = strdup(TmpStr.c_str());
74 errs() << __crashreporter_info__;
73 __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str());
74 errs() << TmpStr.str();
7575 }
7676
7777 #endif