Random string-related cleanups.

llvm-svn: 91119
This commit is contained in:
Benjamin Kramer 2009-12-11 13:33:18 +00:00
parent 8a4ad4adc1
commit b11118bd0b
3 changed files with 5 additions and 9 deletions

View File

@ -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,

View File

@ -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;
}

View File

@ -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();
}
}