Avoid a Twine that referenced a tmp (which proceded to go out of scope before
authorJim Grosbach <grosbach@apple.com>
Thu, 19 May 2011 00:45:05 +0000 (00:45 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 19 May 2011 00:45:05 +0000 (00:45 +0000)
the Twine was used).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131612 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/MCJIT/MCJIT.cpp

index 09a79f64d428cd92684713df43508c390eb92f91..4475f4d5c0d8a3d4e95831d65f6dbd6eaefd4f3f 100644 (file)
@@ -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) {