diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-19 20:07:03 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-19 20:07:03 +0000 |
commit | 768e97ddbde973fa68b12aecc0e0935e7f37dc2c (patch) | |
tree | 99d6f0c6d2175cc7283589471be5ea11840cbbea | |
parent | a18cd86da7194d6b437ee9e5add49f4e761968b1 (diff) | |
download | external_llvm-768e97ddbde973fa68b12aecc0e0935e7f37dc2c.zip external_llvm-768e97ddbde973fa68b12aecc0e0935e7f37dc2c.tar.gz external_llvm-768e97ddbde973fa68b12aecc0e0935e7f37dc2c.tar.bz2 |
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
-rw-r--r-- | include/llvm/ADT/SmallString.h | 8 | ||||
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 4 | ||||
-rw-r--r-- | lib/Support/APInt.cpp | 7 | ||||
-rw-r--r-- | lib/Support/PrettyStackTrace.cpp | 4 |
5 files changed, 9 insertions, 16 deletions
diff --git a/include/llvm/ADT/SmallString.h b/include/llvm/ADT/SmallString.h index fe97807..852c32c 100644 --- a/include/llvm/ADT/SmallString.h +++ b/include/llvm/ADT/SmallString.h @@ -38,14 +38,6 @@ public: // Extra methods. - const char *c_str() const { - SmallString *This = const_cast<SmallString*>(this); - // Ensure that there is a \0 at the end of the string. - This->reserve(this->size()+1); - This->End[0] = 0; - return this->begin(); - } - StringRef str() const { return StringRef(this->begin(), this->size()); } // Extra operators. diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index a1e6099..ab560e7 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -792,7 +792,7 @@ bool BitcodeReader::ParseMetadata() { if (MetadataBase *B = dyn_cast<MetadataBase>(MD)) Elts.push_back(B); } - Value *V = NamedMDNode::Create(Context, Name.c_str(), Elts.data(), + Value *V = NamedMDNode::Create(Context, Name.str(), Elts.data(), Elts.size(), TheModule); MDValueList.AssignValue(V, NextValueNo++); break; diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 7d72b0c..9bf0b1a 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -867,7 +867,7 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { SmallString<40> S; ptrMask.toStringUnsigned(S); - O << ") & " << S.c_str() << ')'; + O << ") & " << S.str() << ')'; break; } case Instruction::Add: @@ -1286,7 +1286,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) { SmallString<40> S; CI->getValue().toStringUnsigned(S, 16); O.PadToColumn(TAI->getCommentColumn()); - O << TAI->getCommentString() << " 0x" << S.c_str(); + O << TAI->getCommentString() << " 0x" << S.str(); } } O << '\n'; diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index e352b63..4e9ee34 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -2168,7 +2168,7 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix, std::string APInt::toString(unsigned Radix = 10, bool Signed = true) const { SmallString<40> S; toString(S, Radix, Signed); - return S.c_str(); + return S.str(); } @@ -2176,13 +2176,14 @@ void APInt::dump() const { SmallString<40> S, U; this->toStringUnsigned(U); this->toStringSigned(S); - fprintf(stderr, "APInt(%db, %su %ss)", BitWidth, U.c_str(), S.c_str()); + errs() << "APInt(" << BitWidth << "b, " + << U.str() << "u " << S.str() << "s)"; } void APInt::print(raw_ostream &OS, bool isSigned) const { SmallString<40> S; this->toString(S, 10, isSigned); - OS << S.c_str(); + OS << S.str(); } std::ostream &llvm::operator<<(std::ostream &o, const APInt &I) { diff --git a/lib/Support/PrettyStackTrace.cpp b/lib/Support/PrettyStackTrace.cpp index 536d9b0..68b41a7 100644 --- a/lib/Support/PrettyStackTrace.cpp +++ b/lib/Support/PrettyStackTrace.cpp @@ -71,8 +71,8 @@ static void CrashHandler(void *Cookie) { } if (!TmpStr.empty()) { - __crashreporter_info__ = strdup(TmpStr.c_str()); - errs() << __crashreporter_info__; + __crashreporter_info__ = strdup(std::string(TmpStr.str()).c_str()); + errs() << TmpStr.str(); } #endif |