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

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 08:04:24 PDT 2024


https://github.com/aengelke created https://github.com/llvm/llvm-project/pull/97066

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


>From 0d2956ced938b074d3792474c3105603960a8419 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 28 Jun 2024 17:03:16 +0200
Subject: [PATCH] [MC][NFC] Make getCurrentFragment inline

It's a very simple method now, which is called quite often, so make it
an inline function.
---
 llvm/include/llvm/MC/MCStreamer.h | 6 +++++-
 llvm/lib/MC/MCStreamer.cpp        | 6 ------
 2 files changed, 5 insertions(+), 7 deletions(-)

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