[llvm] r193023 - Fix up a few minor performance problems spotted in code review.

Eric Christopher echristo at gmail.com
Fri Oct 18 18:04:42 PDT 2013


Author: echristo
Date: Fri Oct 18 20:04:42 2013
New Revision: 193023

URL: http://llvm.org/viewvc/llvm-project?rev=193023&view=rev
Log:
Fix up a few minor performance problems spotted in code review.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=193023&r1=193022&r2=193023&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Oct 18 20:04:42 2013
@@ -912,8 +912,7 @@ void CompileUnit::addAccelType(StringRef
 
 /// addGlobalName - Add a new global name to the compile unit.
 void CompileUnit::addGlobalName(StringRef Name, DIE *Die, DIScope Context) {
-  std::string ContextString = getParentContextString(Context);
-  std::string FullName = ContextString + Name.str();
+  std::string FullName = getParentContextString(Context) + Name.str();
   GlobalNames[FullName] = Die;
 }
 
@@ -925,9 +924,9 @@ void CompileUnit::addGlobalType(DIType T
       (!Context || Context.isCompileUnit() || Context.isFile() ||
        Context.isNameSpace()))
     if (DIEEntry *Entry = getDIEEntry(Ty)) {
-      std::string ContextString = getParentContextString(Context);
-      std::string FullName = ContextString + Ty.getName().str();
-      GlobalTypes[FullName] = Entry->getEntry();
+      std::string FullName =
+          getParentContextString(Context) + Ty.getName().str();
+       GlobalTypes[FullName] = Entry->getEntry();
     }
 }
 
@@ -944,7 +943,7 @@ std::string CompileUnit::getParentContex
   if (getLanguage() != dwarf::DW_LANG_C_plus_plus)
     return "";
 
-  std::string CS = "";
+  std::string CS;
   SmallVector<DIScope, 1> Parents;
   while (!Context.isCompileUnit()) {
     Parents.push_back(Context);
@@ -963,7 +962,7 @@ std::string CompileUnit::getParentContex
        I != E; ++I) {
     DIScope Ctx = *I;
     StringRef Name = Ctx.getName();
-    if (Name != "") {
+    if (!Name.empty()) {
       CS += Name;
       CS += "::";
     }





More information about the llvm-commits mailing list