[llvm-branch-commits] [llvm] [llvm-mc] Add --show-source-loc option to emit source locations (PR #198231)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 22 16:20:04 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp,inc -- llvm/test/tools/llvm-mc/Inputs/show-source-loc.inc llvm/include/llvm/MC/MCTargetOptions.h llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h llvm/include/llvm/Support/SourceMgr.h llvm/lib/MC/MCAsmStreamer.cpp llvm/lib/MC/MCTargetOptions.cpp llvm/lib/MC/MCTargetOptionsCommandFlags.cpp llvm/lib/Support/SourceMgr.cpp llvm/tools/llvm-mc/Disassembler.cpp llvm/tools/llvm-mc/llvm-mc.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index c279dab35..0895c8c27 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -2637,8 +2637,8 @@ void MCAsmStreamer::emitInstruction(const MCInst &Inst,
       auto PrintLoc = [&](StringRef Type, SMLoc L, unsigned Buf) {
         StringRef Filename = SM->getMemoryBuffer(Buf)->getBufferIdentifier();
         std::pair<unsigned, unsigned> LineCol = SM->getLineAndColumn(L, Buf);
-        OS << MAI->getCommentString() << " <" << Type << ": " << Filename
-           << ":" << LineCol.first << ":" << LineCol.second << ">\n";
+        OS << MAI->getCommentString() << " <" << Type << ": " << Filename << ":"
+           << LineCol.first << ":" << LineCol.second << ">\n";
       };
 
       // Unwind the macro expansion and inclusion stacks.
@@ -2655,8 +2655,8 @@ void MCAsmStreamer::emitInstruction(const MCInst &Inst,
             PrintLoc("IncludeLoc", Loc, BufID);
           }
         }
-        // Move up to the parent context (the macro call site or the include site)
-        // for the next iteration of the stack unwinding.
+        // Move up to the parent context (the macro call site or the include
+        // site) for the next iteration of the stack unwinding.
         Loc = ParentLoc;
         BufID = Loc.isValid() ? SM->FindBufferContainingLoc(Loc) : 0;
       }

``````````

</details>


https://github.com/llvm/llvm-project/pull/198231


More information about the llvm-branch-commits mailing list