diff options
author | Eric Christopher <echristo@gmail.com> | 2013-10-19 01:04:42 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-10-19 01:04:42 +0000 |
commit | 8dba0d5ae958d385ac0c794c734cc52bdaccf27e (patch) | |
tree | aee1eb8428cff429207ac4cd2a13b81579aacf03 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | |
parent | 2492169aeee4e28809442d8a1b586350cde74dff (diff) | |
download | bcm5719-llvm-8dba0d5ae958d385ac0c794c734cc52bdaccf27e.tar.gz bcm5719-llvm-8dba0d5ae958d385ac0c794c734cc52bdaccf27e.zip |
Fix up a few minor performance problems spotted in code review.
llvm-svn: 193023
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index c39320e149f..30cd27bae00 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -912,8 +912,7 @@ void CompileUnit::addAccelType(StringRef Name, std::pair<DIE *, unsigned> Die) { /// 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 Ty) { (!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::getParentContextString(DIScope Context) const { 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::getParentContextString(DIScope Context) const { I != E; ++I) { DIScope Ctx = *I; StringRef Name = Ctx.getName(); - if (Name != "") { + if (!Name.empty()) { CS += Name; CS += "::"; } |