[llvm] 124b918 - [MC] Merge MCSymbol::getSectionPtr into getSection and simplify

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 12:06:02 PST 2020


Author: Fangrui Song
Date: 2020-01-05T12:03:40-08:00
New Revision: 124b918bd34756c16b3f460adf96b4bfe48a5f97

URL: https://github.com/llvm/llvm-project/commit/124b918bd34756c16b3f460adf96b4bfe48a5f97
DIFF: https://github.com/llvm/llvm-project/commit/124b918bd34756c16b3f460adf96b4bfe48a5f97.diff

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

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCSymbol.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCSymbol.h b/llvm/include/llvm/MC/MCSymbol.h
index 189484deac7e..84263bf94035 100644
--- a/llvm/include/llvm/MC/MCSymbol.h
+++ b/llvm/include/llvm/MC/MCSymbol.h
@@ -178,14 +178,6 @@ class MCSymbol {
     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 @@ class MCSymbol {
   /// 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.


        


More information about the llvm-commits mailing list