diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-05 03:35:15 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-05 03:35:15 +0000 |
commit | 4a0bf5423c2dc7eb8ae197447b4b61e6517f108a (patch) | |
tree | 53e6b2889489482bd0daf550d2f26e524e1f615f /lib/Object | |
parent | a5db79d5148d3972b90390f526fd35d707729c5a (diff) | |
download | external_llvm-4a0bf5423c2dc7eb8ae197447b4b61e6517f108a.zip external_llvm-4a0bf5423c2dc7eb8ae197447b4b61e6517f108a.tar.gz external_llvm-4a0bf5423c2dc7eb8ae197447b4b61e6517f108a.tar.bz2 |
Use the raw member names in Archive::Archive.
This a bit more efficient and avoids having a function that uses the string
table being called by a function that searches for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/Archive.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/lib/Object/Archive.cpp b/lib/Object/Archive.cpp index 0b819f4..27676cf 100644 --- a/lib/Object/Archive.cpp +++ b/lib/Object/Archive.cpp @@ -38,7 +38,7 @@ static bool isInternalMember(const ArchiveMemberHeader &amh) { void Archive::anchor() { } error_code Archive::Child::getName(StringRef &Result) const { - StringRef name = ToHeader(Data.data())->getName(); + StringRef name = getRawName(); // Check if it's a special name. if (name[0] == '/') { if (name.size() == 1) { // Linker member. @@ -119,10 +119,7 @@ Archive::Archive(MemoryBuffer *source, error_code &ec) return; } - // FIXME: this function should be able to use raw names. - StringRef name; - if ((ec = i->getName(name))) - return; + StringRef Name = i->getRawName(); // Below is the pattern that is used to figure out the archive format // GNU archive format @@ -143,14 +140,14 @@ Archive::Archive(MemoryBuffer *source, error_code &ec) // seem to create the third member if there's no member whose filename // exceeds 15 characters. So the third member is optional. - if (name == "__.SYMDEF") { + if (Name == "__.SYMDEF") { Format = K_BSD; SymbolTable = i; ec = object_error::success; return; } - if (name == "/") { + if (Name == "/") { SymbolTable = i; ++i; @@ -158,24 +155,23 @@ Archive::Archive(MemoryBuffer *source, error_code &ec) ec = object_error::parse_failed; return; } - if ((ec = i->getName(name))) - return; + Name = i->getRawName(); } - if (name == "//") { + if (Name == "//") { Format = K_GNU; StringTable = i; ec = object_error::success; return; } - if (name[0] != '/') { + if (Name[0] != '/') { Format = K_GNU; ec = object_error::success; return; } - if (name != "/") { + if (Name != "/") { ec = object_error::parse_failed; return; } @@ -189,10 +185,9 @@ Archive::Archive(MemoryBuffer *source, error_code &ec) return; } - if ((ec = i->getName(name))) - return; + Name = i->getRawName(); - if (name == "//") + if (Name == "//") StringTable = i; ec = object_error::success; |