summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2014-04-13 22:54:11 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2014-04-13 22:54:11 +0000
commit1a1689881332cfe42ca15ead7314bea7ede3ca71 (patch)
tree0987d10f7e7c5888c8b4bafb6894c18c0919e1fd /tools
parent42ad510d31802b853fd59cf85a45b72619d2b7f9 (diff)
downloadllvm-1a1689881332cfe42ca15ead7314bea7ede3ca71.tar.gz
llvm-1a1689881332cfe42ca15ead7314bea7ede3ca71.tar.bz2
llvm-1a1689881332cfe42ca15ead7314bea7ede3ca71.tar.xz
tools: avoid a string duplication
The auxiliary file records are contiguous and only contain the filename. Construct a StringRef directly rather than copying to a temporary buffer. Suggested by majnemer on IRC! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-objdump/llvm-objdump.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp
index 095fdca2dd..313816e56e 100644
--- a/tools/llvm-objdump/llvm-objdump.cpp
+++ b/tools/llvm-objdump/llvm-objdump.cpp
@@ -695,14 +695,10 @@ static void PrintCOFFSymbolTable(const COFFObjectFile *coff) {
, unsigned(asd->Selection));
break;
case COFF::IMAGE_SYM_CLASS_FILE:
- SmallString<261> FileName;
- for (unsigned AI = i, AE = i + aux_count + 1; AI < AE; ++AI) {
- const coff_aux_file *AF;
- if (error(coff->getAuxSymbol<coff_aux_file>(AI, AF)))
- return;
- FileName.append(&AF->FileName[0], &AF->FileName[18]);
- }
- outs() << "AUX " << FileName << '\n';
+ const coff_aux_file *AF;
+ if (error(coff->getAuxSymbol<coff_aux_file>(i, AF)))
+ return;
+ outs() << "AUX " << StringRef(AF->FileName) << '\n';
i = i + aux_count;
aux_count = 0;
break;