aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-10-19 01:04:42 +0000
committerEric Christopher <echristo@gmail.com>2013-10-19 01:04:42 +0000
commit0ab6439c3f0eef28b4b40f31f2d4d9732fe8cd15 (patch)
treeb340885d37d4ccac9ab3653f5554f89470a800fa
parent7b79924dec28eb0d4fee2211940c427c11283505 (diff)
downloadexternal_llvm-0ab6439c3f0eef28b4b40f31f2d4d9732fe8cd15.zip
external_llvm-0ab6439c3f0eef28b4b40f31f2d4d9732fe8cd15.tar.gz
external_llvm-0ab6439c3f0eef28b4b40f31f2d4d9732fe8cd15.tar.bz2
Fix up a few minor performance problems spotted in code review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193023 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index c39320e..30cd27b 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/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 += "::";
}