[llvm] r314012 - Move code to a helper function. NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 11:40:14 PDT 2017
Author: rafael
Date: Fri Sep 22 11:40:14 2017
New Revision: 314012
URL: http://llvm.org/viewvc/llvm-project?rev=314012&view=rev
Log:
Move code to a helper function. NFC.
Part of a patch by Jake Ehrlich!
Modified:
llvm/trunk/lib/Object/ArchiveWriter.cpp
Modified: llvm/trunk/lib/Object/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ArchiveWriter.cpp?rev=314012&r1=314011&r2=314012&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Object/ArchiveWriter.cpp Fri Sep 22 11:40:14 2017
@@ -277,6 +277,18 @@ static sys::TimePoint<std::chrono::secon
return sys::TimePoint<seconds>();
}
+static bool isArchiveSymbol(const object::BasicSymbolRef &S) {
+ uint32_t Symflags = S.getFlags();
+ if (Symflags & object::SymbolRef::SF_FormatSpecific)
+ return false;
+ if (!(Symflags & object::SymbolRef::SF_Global))
+ return false;
+ if (Symflags & object::SymbolRef::SF_Undefined &&
+ !(Symflags & object::SymbolRef::SF_Indirect))
+ return false;
+ return true;
+}
+
// Returns the offset of the first reference to a member offset.
static Expected<unsigned>
writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind,
@@ -310,13 +322,7 @@ writeSymbolTable(raw_fd_ostream &Out, ob
}
for (const object::BasicSymbolRef &S : Obj.symbols()) {
- uint32_t Symflags = S.getFlags();
- if (Symflags & object::SymbolRef::SF_FormatSpecific)
- continue;
- if (!(Symflags & object::SymbolRef::SF_Global))
- continue;
- if (Symflags & object::SymbolRef::SF_Undefined &&
- !(Symflags & object::SymbolRef::SF_Indirect))
+ if (!isArchiveSymbol(S))
continue;
unsigned NameOffset = NameOS.tell();
More information about the llvm-commits
mailing list