This makes the predicates independent of the flag representation
and makes the code a little easier to read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298951
91177308-0d34-0410-b5e6-
96231b3b80d8
skip();
}
+ bool isUndefined() const {
+ return Flags & object::BasicSymbolRef::SF_Undefined;
+ }
+ bool isCommon() const { return Flags & object::BasicSymbolRef::SF_Common; }
+ bool isWeak() const { return Flags & object::BasicSymbolRef::SF_Weak; }
+ bool isIndirect() const {
+ return Flags & object::BasicSymbolRef::SF_Indirect;
+ }
+
/// For COFF weak externals, returns the name of the symbol that is used
/// as a fallback if the weak external remains undefined.
std::string getCOFFWeakExternalFallback() const {
/// Returns the mangled name of the global.
StringRef getName() const { return Name; }
- uint32_t getFlags() const { return Flags; }
GlobalValue::VisibilityTypes getVisibility() const {
if (isGV())
return getGV()->getVisibility();
if (Sym.isGV()) {
GlobalValue *GV = Sym.getGV();
if (Res.Prevailing) {
- if (Sym.getFlags() & object::BasicSymbolRef::SF_Undefined)
+ if (Sym.isUndefined())
continue;
Keep.push_back(GV);
switch (GV->getLinkage()) {
// Common resolution: collect the maximum size/alignment over all commons.
// We also record if we see an instance of a common as prevailing, so that
// if none is prevailing we can ignore it later.
- if (Sym.getFlags() & object::BasicSymbolRef::SF_Common) {
+ if (Sym.isCommon()) {
// FIXME: We should figure out what to do about commons defined by asm.
// For now they aren't reported correctly by ModuleSymbolTable.
auto &CommonRes = RegularLTO.Commons[Sym.getGV()->getName()];
sys::path::filename(Obj->getSourceFileName()).str();
for (auto &Sym : Obj->symbols()) {
- uint32_t Symflags = Sym.getFlags();
-
cf.syms.push_back(ld_plugin_symbol());
ld_plugin_symbol &sym = cf.syms.back();
sym.version = nullptr;
break;
}
- if (Symflags & object::BasicSymbolRef::SF_Undefined) {
+ if (Sym.isUndefined()) {
sym.def = LDPK_UNDEF;
- if (Symflags & object::BasicSymbolRef::SF_Weak)
+ if (Sym.isWeak())
sym.def = LDPK_WEAKUNDEF;
- } else if (Symflags & object::BasicSymbolRef::SF_Common)
+ } else if (Sym.isCommon())
sym.def = LDPK_COMMON;
- else if (Symflags & object::BasicSymbolRef::SF_Weak)
+ else if (Sym.isWeak())
sym.def = LDPK_WEAKDEF;
else
sym.def = LDPK_DEF;