llvm.org GIT mirror llvm / aba00ee
LTO: Replace InputFile::Symbol::getFlags() with predicate accessors. NFC. 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 Peter Collingbourne 3 years ago
3 changed file(s) with 15 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
151151 skip();
152152 }
153153
154 bool isUndefined() const {
155 return Flags & object::BasicSymbolRef::SF_Undefined;
156 }
157 bool isCommon() const { return Flags & object::BasicSymbolRef::SF_Common; }
158 bool isWeak() const { return Flags & object::BasicSymbolRef::SF_Weak; }
159 bool isIndirect() const {
160 return Flags & object::BasicSymbolRef::SF_Indirect;
161 }
162
154163 /// For COFF weak externals, returns the name of the symbol that is used
155164 /// as a fallback if the weak external remains undefined.
156165 std::string getCOFFWeakExternalFallback() const {
170179 /// Returns the mangled name of the global.
171180 StringRef getName() const { return Name; }
172181
173 uint32_t getFlags() const { return Flags; }
174182 GlobalValue::VisibilityTypes getVisibility() const {
175183 if (isGV())
176184 return getGV()->getVisibility();
574574 if (Sym.isGV()) {
575575 GlobalValue *GV = Sym.getGV();
576576 if (Res.Prevailing) {
577 if (Sym.getFlags() & object::BasicSymbolRef::SF_Undefined)
577 if (Sym.isUndefined())
578578 continue;
579579 Keep.push_back(GV);
580580 switch (GV->getLinkage()) {
607607 // Common resolution: collect the maximum size/alignment over all commons.
608608 // We also record if we see an instance of a common as prevailing, so that
609609 // if none is prevailing we can ignore it later.
610 if (Sym.getFlags() & object::BasicSymbolRef::SF_Common) {
610 if (Sym.isCommon()) {
611611 // FIXME: We should figure out what to do about commons defined by asm.
612612 // For now they aren't reported correctly by ModuleSymbolTable.
613613 auto &CommonRes = RegularLTO.Commons[Sym.getGV()->getName()];
495495 sys::path::filename(Obj->getSourceFileName()).str();
496496
497497 for (auto &Sym : Obj->symbols()) {
498 uint32_t Symflags = Sym.getFlags();
499
500498 cf.syms.push_back(ld_plugin_symbol());
501499 ld_plugin_symbol &sym = cf.syms.back();
502500 sym.version = nullptr;
522520 break;
523521 }
524522
525 if (Symflags & object::BasicSymbolRef::SF_Undefined) {
523 if (Sym.isUndefined()) {
526524 sym.def = LDPK_UNDEF;
527 if (Symflags & object::BasicSymbolRef::SF_Weak)
525 if (Sym.isWeak())
528526 sym.def = LDPK_WEAKUNDEF;
529 } else if (Symflags & object::BasicSymbolRef::SF_Common)
527 } else if (Sym.isCommon())
530528 sym.def = LDPK_COMMON;
531 else if (Symflags & object::BasicSymbolRef::SF_Weak)
529 else if (Sym.isWeak())
532530 sym.def = LDPK_WEAKDEF;
533531 else
534532 sym.def = LDPK_DEF;