[llvm] [MC] Fix MCLFI coding style. NFC (PR #228301)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 18:52:30 PDT 2026


https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/228301

None

>From edcef25245edaafacaca111dca2e6b7a2532f045 Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Thu, 1 Oct 2026 18:45:18 -0700
Subject: [PATCH] [MC] Fix MCLFI coding style. NFC

---
 llvm/lib/MC/MCLFI.cpp | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/llvm/lib/MC/MCLFI.cpp b/llvm/lib/MC/MCLFI.cpp
index baa9e04bf808e..9acbaa2a6f87c 100644
--- a/llvm/lib/MC/MCLFI.cpp
+++ b/llvm/lib/MC/MCLFI.cpp
@@ -24,17 +24,17 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/TargetParser/Triple.h"
 
-static const char NoteNamespace[] = "LFI";
+using namespace llvm;
 
-static constexpr unsigned X86BundleSize = 32;
+const char NoteNamespace[] = "LFI";
 
-namespace llvm {
+constexpr unsigned X86BundleSize = 32;
 
-cl::opt<bool> FlagEnableRewriting("lfi-enable-rewriter",
-                                  cl::desc("Enable rewriting for LFI."),
-                                  cl::init(true), cl::Hidden);
+static cl::opt<bool> FlagEnableRewriting("lfi-enable-rewriter",
+                                         cl::desc("Enable rewriting for LFI"),
+                                         cl::init(true), cl::Hidden);
 
-void initializeLFIMCStreamer(MCStreamer &Streamer, MCContext &Ctx,
+void llvm::initializeLFIMCStreamer(MCStreamer &Streamer, MCContext &Ctx,
                              const Triple &TheTriple) {
   assert(TheTriple.isLFI());
 
@@ -52,15 +52,14 @@ void initializeLFIMCStreamer(MCStreamer &Streamer, MCContext &Ctx,
   }
 }
 
-void emitLFIBundleAlign(MCStreamer &Streamer, MCContext &Ctx) {
+void llvm::emitLFIBundleAlign(MCStreamer &Streamer, MCContext &Ctx) {
   const Triple &TheTriple = Ctx.getTargetTriple();
   assert(TheTriple.isLFI());
-
   if (TheTriple.getArch() == Triple::x86_64)
     Streamer.emitBundleAlignMode(Align(X86BundleSize));
 }
 
-void emitLFINoteSection(MCStreamer &Streamer, MCContext &Ctx) {
+void llvm::emitLFINoteSection(MCStreamer &Streamer, MCContext &Ctx) {
   const Triple &TheTriple = Ctx.getTargetTriple();
   assert(TheTriple.isLFI());
 
@@ -96,5 +95,3 @@ void emitLFINoteSection(MCStreamer &Streamer, MCContext &Ctx) {
   Streamer.emitIntValue(0, 1); // NUL terminator
   Streamer.emitValueToAlignment(Align(4));
 }
-
-} // namespace llvm



More information about the llvm-commits mailing list