[llvm-commits] [llvm] r131612 - /llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Jim Grosbach grosbach at apple.com
Wed May 18 17:45:06 PDT 2011


Author: grosbach
Date: Wed May 18 19:45:05 2011
New Revision: 131612

URL: http://llvm.org/viewvc/llvm-project?rev=131612&view=rev
Log:
Avoid a Twine that referenced a tmp (which proceded to go out of scope before
the Twine was used).

Modified:
    llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp

Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=131612&r1=131611&r2=131612&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed May 18 19:45:05 2011
@@ -104,12 +104,10 @@
 
   // 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) {





More information about the llvm-commits mailing list