[llvm] ecd6742 - [MC][NFC] Make getCurrentFragment inline (#97066)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 09:49:28 PDT 2024


Author: Alexis Engelke
Date: 2024-06-28T18:49:25+02:00
New Revision: ecd6742f7b38328d61e62a6c988101c5c327eb82

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

LOG: [MC][NFC] Make getCurrentFragment inline (#97066)

It's a very simple method now, which is called quite often, so make it
an inline function.

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCStreamer.h
    llvm/lib/MC/MCStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index a5f53301e9de8..baa9c335920eb 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -410,7 +410,11 @@ class MCStreamer {
     return MCSectionSubPair();
   }
 
-  MCFragment *getCurrentFragment() const;
+  MCFragment *getCurrentFragment() const {
+    assert(!getCurrentSection().first ||
+           CurFrag->getParent() == getCurrentSection().first);
+    return CurFrag;
+  }
 
   /// Returns an index to represent the order a symbol was emitted in.
   /// (zero if we did not emit that symbol)

diff  --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 91adc42dc1ba1..67cb14d729157 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -118,12 +118,6 @@ ArrayRef<MCDwarfFrameInfo> MCStreamer::getDwarfFrameInfos() const {
   return DwarfFrameInfos;
 }
 
-MCFragment *MCStreamer::getCurrentFragment() const {
-  assert(!getCurrentSection().first ||
-         CurFrag->getParent() == getCurrentSection().first);
-  return CurFrag;
-}
-
 void MCStreamer::emitRawComment(const Twine &T, bool TabPrefix) {}
 
 void MCStreamer::addExplicitComment(const Twine &T) {}


        


More information about the llvm-commits mailing list