[llvm-commits] [llvm] r52785 - /llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp

Owen Anderson resistor at mac.com
Thu Jun 26 10:06:02 PDT 2008


Author: resistor
Date: Thu Jun 26 12:06:02 2008
New Revision: 52785

URL: http://llvm.org/viewvc/llvm-project?rev=52785&view=rev
Log:
Don't create a whole new string just to copy the elements into it.

Modified:
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52785&r1=52784&r2=52785&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jun 26 12:06:02 2008
@@ -231,11 +231,9 @@
   }
   virtual void Apply(std::string &Field) {
     Constant *C = CI->getOperand(I++);
-    std::string S;
-    if (GetConstantStringInfo(C, S))
-      Field = S;
-    else
-      Field = "";
+    // Fills in the string if it succeeds
+    if (!GetConstantStringInfo(C, Field))
+      Field.clear();
   }
   virtual void Apply(DebugInfoDesc *&Field) {
     Constant *C = CI->getOperand(I++);





More information about the llvm-commits mailing list