From 13733a137ccc3ea8b8faaecdfc55434d81e8aba7 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Thu, 19 May 2011 00:45:05 +0000 Subject: [PATCH] Avoid a Twine that referenced a tmp (which proceded to go out of scope before the Twine was used). llvm-svn: 131612 --- llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 09a79f64d428..4475f4d5c0d8 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -104,12 +104,10 @@ void *MCJIT::getPointerToFunction(Function *F) { // FIXME: Should we be using the mangler for this? Probably. StringRef BaseName = F->getName(); - Twine Name; if (BaseName[0] == '\1') - Name = BaseName.substr(1); - else - Name = TM->getMCAsmInfo()->getGlobalPrefix() + BaseName; - return (void*)Dyld.getSymbolAddress(Name.str()); + return (void*)Dyld.getSymbolAddress(BaseName.substr(1)); + return (void*)Dyld.getSymbolAddress((TM->getMCAsmInfo()->getGlobalPrefix() + + BaseName).str()); } void *MCJIT::recompileAndRelinkFunction(Function *F) { -- GitLab