[llvm-commits] [llvm] r79456 - in /llvm/trunk: include/llvm/ADT/SmallString.h lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Support/APInt.cpp lib/Support/PrettyStackTrace.cpp
Daniel Dunbar
daniel at zuster.org
Wed Aug 19 13:07:04 PDT 2009
Author: ddunbar
Date: Wed Aug 19 15:07:03 2009
New Revision: 79456
URL: http://llvm.org/viewvc/llvm-project?rev=79456&view=rev
Log:
Switch to SmallString::str from SmallString::c_str, and remove
SmallString::c_str.
Modified:
llvm/trunk/include/llvm/ADT/SmallString.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Support/APInt.cpp
llvm/trunk/lib/Support/PrettyStackTrace.cpp
Modified: llvm/trunk/include/llvm/ADT/SmallString.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallString.h?rev=79456&r1=79455&r2=79456&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallString.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallString.h Wed Aug 19 15:07:03 2009
@@ -38,14 +38,6 @@
// 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.
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=79456&r1=79455&r2=79456&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Aug 19 15:07:03 2009
@@ -792,7 +792,7 @@
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;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=79456&r1=79455&r2=79456&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Wed Aug 19 15:07:03 2009
@@ -867,7 +867,7 @@
SmallString<40> S;
ptrMask.toStringUnsigned(S);
- O << ") & " << S.c_str() << ')';
+ O << ") & " << S.str() << ')';
break;
}
case Instruction::Add:
@@ -1286,7 +1286,7 @@
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';
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=79456&r1=79455&r2=79456&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Wed Aug 19 15:07:03 2009
@@ -2168,7 +2168,7 @@
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 @@
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) {
Modified: llvm/trunk/lib/Support/PrettyStackTrace.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PrettyStackTrace.cpp?rev=79456&r1=79455&r2=79456&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PrettyStackTrace.cpp (original)
+++ llvm/trunk/lib/Support/PrettyStackTrace.cpp Wed Aug 19 15:07:03 2009
@@ -71,8 +71,8 @@
}
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
More information about the llvm-commits
mailing list