aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-12-11 13:33:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-12-11 13:33:18 +0000
commit8d04258483be6583f0865464234d014807a3e1cc (patch)
treee7d61784d17984d6963d15d89fc5f5955b5a7344
parent330358056acf05445273f4f4004dfd283a2ecc4d (diff)
Random string-related cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91119 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGCXX.cpp5
-rw-r--r--lib/CodeGen/CodeGenModule.cpp5
-rw-r--r--lib/Sema/SemaDeclCXX.cpp4
3 files changed, 5 insertions, 9 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 692dea6f03..24e3ffda82 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -479,10 +479,9 @@ CodeGenFunction::GenerateCXXAggrDestructorHelper(const CXXDestructorDecl *D,
const llvm::FunctionType *FTy = CGM.getTypes().GetFunctionType(FI, false);
llvm::Function *Fn =
llvm::Function::Create(FTy, llvm::GlobalValue::InternalLinkage,
- Name.c_str(),
+ Name.str(),
&CGM.getModule());
- IdentifierInfo *II
- = &CGM.getContext().Idents.get(Name.c_str());
+ IdentifierInfo *II = &CGM.getContext().Idents.get(Name.str());
FunctionDecl *FD = FunctionDecl::Create(getContext(),
getContext().getTranslationUnitDecl(),
SourceLocation(), II, R, 0,
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 3a0d2b8ddc..660dd6cc3e 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1689,14 +1689,13 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
case Decl::FileScopeAsm: {
FileScopeAsmDecl *AD = cast<FileScopeAsmDecl>(D);
- std::string AsmString(AD->getAsmString()->getStrData(),
- AD->getAsmString()->getByteLength());
+ llvm::StringRef AsmString = AD->getAsmString()->getString();
const std::string &S = getModule().getModuleInlineAsm();
if (S.empty())
getModule().setModuleInlineAsm(AsmString);
else
- getModule().setModuleInlineAsm(S + '\n' + AsmString);
+ getModule().setModuleInlineAsm(S + '\n' + AsmString.str());
break;
}
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 7d16e9b2b0..5a7cba00e5 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -4941,10 +4941,8 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc,
}
if (Value == 0) {
- std::string str(AssertMessage->getStrData(),
- AssertMessage->getByteLength());
Diag(AssertLoc, diag::err_static_assert_failed)
- << str << AssertExpr->getSourceRange();
+ << AssertMessage->getString() << AssertExpr->getSourceRange();
}
}