]> granicus.if.org Git - clang/commitdiff
Random string-related cleanups.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 11 Dec 2009 13:33:18 +0000 (13:33 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 11 Dec 2009 13:33:18 +0000 (13:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91119 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCXX.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Sema/SemaDeclCXX.cpp

index 692dea6f0306ba9b827a0a6bf2814d5454e1b5ef..24e3ffda82d066d51735fa01c7007b00a03a1c50 100644 (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,
index 3a0d2b8ddcb7e1fa42e854405b22ef1749af2c45..660dd6cc3eb5984afd241aaf3c76bd4dd0cd08c9 100644 (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;
   }
 
index 7d16e9b2b0f97ef102a34ef299f9f96f00159046..5a7cba00e5fbbcb696ee4fde4f4521ab3d0d9d3e 100644 (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();
     }
   }