From 78f6b03edc402900b3957b22d95bf98e0eebfd54 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 3 Dec 2012 22:39:14 +0000 Subject: [PATCH] Fix test failure when building Clang with g++4.7 -- don't use a Twine temporary after its lifetime has ended! llvm-svn: 169170 --- clang/lib/CodeGen/CGExpr.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index ef17bdc..0c2feda 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -2068,11 +2068,11 @@ void CodeGenFunction::EmitCheck(llvm::Value *Checked, StringRef CheckName, // Checks that have two variants use a suffix to differentiate them bool NeedsAbortSuffix = (RecoverKind != CRK_Unrecoverable) && !CGM.getCodeGenOpts().SanitizeRecover; - Twine FunctionName = "__ubsan_handle_" + CheckName + - Twine(NeedsAbortSuffix? "_abort" : ""); - llvm::Value *Fn = CGM.CreateRuntimeFunction(FnType, FunctionName.str(), - llvm::Attributes::get(getLLVMContext(), - B)); + std::string FunctionName = ("__ubsan_handle_" + CheckName + + (NeedsAbortSuffix? "_abort" : "")).str(); + llvm::Value *Fn = + CGM.CreateRuntimeFunction(FnType, FunctionName, + llvm::Attributes::get(getLLVMContext(), B)); llvm::CallInst *HandlerCall = Builder.CreateCall(Fn, Args); if (Recover) { Builder.CreateBr(Cont); -- 2.7.4