[cfe-commits] r79455 - in /cfe/trunk/lib: Basic/Targets.cpp CodeGen/CGCXX.cpp CodeGen/CGExprComplex.cpp Frontend/InitHeaderSearch.cpp Sema/SemaStmt.cpp
Daniel Dunbar
daniel at zuster.org
Wed Aug 19 13:04:04 PDT 2009
Author: ddunbar
Date: Wed Aug 19 15:04:03 2009
New Revision: 79455
URL: http://llvm.org/viewvc/llvm-project?rev=79455&view=rev
Log:
Switch to SmallString::str from SmallString::c_str.
- Several FIXMEs due to non-Twinification of IRBuilder.
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=79455&r1=79454&r2=79455&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 19 15:04:03 2009
@@ -18,6 +18,7 @@
#include "clang/Basic/LangOptions.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/MC/MCSectionMachO.h"
@@ -27,13 +28,13 @@
// Common code shared among targets.
//===----------------------------------------------------------------------===//
-static void Define(std::vector<char> &Buf, const char *Macro,
- const char *Val = "1") {
+static void Define(std::vector<char> &Buf, const llvm::StringRef &Macro,
+ const llvm::StringRef &Val = "1") {
const char *Def = "#define ";
Buf.insert(Buf.end(), Def, Def+strlen(Def));
- Buf.insert(Buf.end(), Macro, Macro+strlen(Macro));
+ Buf.insert(Buf.end(), Macro.begin(), Macro.end());
Buf.push_back(' ');
- Buf.insert(Buf.end(), Val, Val+strlen(Val));
+ Buf.insert(Buf.end(), Val.begin(), Val.end());
Buf.push_back('\n');
}
@@ -53,11 +54,11 @@
llvm::SmallString<20> TmpStr;
TmpStr = "__";
TmpStr += MacroName;
- Define(Buf, TmpStr.c_str());
+ Define(Buf, TmpStr.str());
// Define __unix__.
TmpStr += "__";
- Define(Buf, TmpStr.c_str());
+ Define(Buf, TmpStr.str());
}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=79455&r1=79454&r2=79455&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed Aug 19 15:04:03 2009
@@ -143,7 +143,7 @@
new llvm::GlobalVariable(CGM.getModule(), llvm::Type::getInt64Ty(VMContext), false,
GV->getLinkage(),
llvm::Constant::getNullValue(llvm::Type::getInt64Ty(VMContext)),
- GuardVName.c_str());
+ GuardVName.str());
// Load the first byte of the guard variable.
const llvm::Type *PtrTy = llvm::PointerType::get(llvm::Type::getInt8Ty(VMContext), 0);
@@ -683,7 +683,6 @@
QualType ClassTy;
ClassTy = getContext().getTagDeclType(RD);
mangleCXXRtti(ClassTy, getContext(), Out);
- const char *Name = OutName.c_str();
llvm::GlobalVariable::LinkageTypes linktype;
linktype = llvm::GlobalValue::WeakAnyLinkage;
std::vector<llvm::Constant *> info;
@@ -698,7 +697,7 @@
llvm::ArrayType *type = llvm::ArrayType::get(Ptr8Ty, info.size());
C = llvm::ConstantArray::get(type, info);
Rtti = new llvm::GlobalVariable(getModule(), type, true, linktype, C,
- Name);
+ Out.str());
Rtti = llvm::ConstantExpr::getBitCast(Rtti, Ptr8Ty);
return Rtti;
}
@@ -876,7 +875,6 @@
QualType ClassTy;
ClassTy = getContext().getTagDeclType(RD);
mangleCXXVtable(ClassTy, getContext(), Out);
- const char *Name = OutName.c_str();
llvm::GlobalVariable::LinkageTypes linktype;
linktype = llvm::GlobalValue::WeakAnyLinkage;
std::vector<llvm::Constant *> methods;
@@ -898,7 +896,7 @@
llvm::ArrayType *type = llvm::ArrayType::get(Ptr8Ty, methods.size());
C = llvm::ConstantArray::get(type, methods);
llvm::Value *vtable = new llvm::GlobalVariable(CGM.getModule(), type, true,
- linktype, C, Name);
+ linktype, C, Out.str());
vtable = Builder.CreateBitCast(vtable, Ptr8Ty);
vtable = Builder.CreateGEP(vtable,
llvm::ConstantInt::get(llvm::Type::getInt64Ty(VMContext),
Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=79455&r1=79454&r2=79455&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Wed Aug 19 15:04:03 2009
@@ -268,21 +268,28 @@
llvm::Value *Real=0, *Imag=0;
if (!IgnoreReal) {
+ // FIXME: Clean this up once builder takes Twine/StringRef.
Name += ".realp";
- llvm::Value *RealPtr = Builder.CreateStructGEP(SrcPtr, 0, Name.c_str());
+ llvm::Value *RealPtr = Builder.CreateStructGEP(SrcPtr, 0,
+ Name.str().str().c_str());
Name.pop_back(); // .realp -> .real
- Real = Builder.CreateLoad(RealPtr, isVolatile, Name.c_str());
+ // FIXME: Clean this up once builder takes Twine/StringRef.
+ Real = Builder.CreateLoad(RealPtr, isVolatile,
+ Name.str().str().c_str());
Name.resize(Name.size()-4); // .real -> .imagp
}
if (!IgnoreImag) {
Name += "imagp";
- llvm::Value *ImagPtr = Builder.CreateStructGEP(SrcPtr, 1, Name.c_str());
+ // FIXME: Clean this up once builder takes Twine/StringRef.
+ llvm::Value *ImagPtr = Builder.CreateStructGEP(SrcPtr, 1,
+ Name.str().str().c_str());
Name.pop_back(); // .imagp -> .imag
- Imag = Builder.CreateLoad(ImagPtr, isVolatile, Name.c_str());
+ // FIXME: Clean this up once builder takes Twine/StringRef.
+ Imag = Builder.CreateLoad(ImagPtr, isVolatile, Name.str().str().c_str());
}
return ComplexPairTy(Real, Imag);
}
Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=79455&r1=79454&r2=79455&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original)
+++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Wed Aug 19 15:04:03 2009
@@ -75,8 +75,8 @@
}
if (Verbose)
- fprintf(stderr, "ignoring nonexistent directory \"%s\"\n",
- MappedPath.c_str());
+ llvm::errs() << "ignoring nonexistent directory \""
+ << MappedPath.str() << "\"\n";
}
Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=79455&r1=79454&r2=79455&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Wed Aug 19 15:04:03 2009
@@ -1082,13 +1082,13 @@
return StmtError(Diag(Literal->getLocStart(),diag::err_asm_wide_character)
<< Literal->getSourceRange());
- llvm::SmallString<16> Clobber(Literal->getStrData(),
- Literal->getStrData() +
- Literal->getByteLength());
+ std::string Clobber(Literal->getStrData(),
+ Literal->getStrData() +
+ Literal->getByteLength());
if (!Context.Target.isValidGCCRegisterName(Clobber.c_str()))
return StmtError(Diag(Literal->getLocStart(),
- diag::err_asm_unknown_register_name) << Clobber.c_str());
+ diag::err_asm_unknown_register_name) << Clobber);
}
constraints.release();
More information about the cfe-commits
mailing list