[MC] Merge MCSymbol::getSectionPtr into getSection and simplify

This commit is contained in:
Fangrui Song 2020-01-05 12:02:11 -08:00
parent c764304adc
commit 124b918bd3
1 changed files with 1 additions and 9 deletions

View File

@ -178,14 +178,6 @@ private:
llvm_unreachable("Constructor throws?");
}
MCSection *getSectionPtr() const {
if (MCFragment *F = getFragment()) {
assert(F != AbsolutePseudoFragment);
return F->getParent();
}
return nullptr;
}
/// Get a reference to the name field. Requires that we have a name
const StringMapEntry<bool> *&getNameEntryPtr() {
assert(FragmentAndHasName.getInt() && "Name is required");
@ -267,7 +259,7 @@ public:
/// Get the section associated with a defined, non-absolute symbol.
MCSection &getSection() const {
assert(isInSection() && "Invalid accessor!");
return *getSectionPtr();
return *getFragment()->getParent();
}
/// Mark the symbol as defined in the fragment \p F.