[clang] [llvm] [CodeView] Add line entries for instructions in MS inline asm (PR #193007)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 20 08:49:10 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 -- clang/test/CodeGen/ms-inline-asm-codeview.cpp clang/lib/CodeGen/CGStmt.cpp llvm/include/llvm/CodeGen/AsmPrinterHandler.h llvm/include/llvm/CodeGen/MachineInstr.h llvm/include/llvm/MC/MCStreamer.h llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h llvm/lib/CodeGen/MachineInstr.cpp llvm/lib/CodeGen/MachineModuleInfo.cpp llvm/lib/MC/MCAsmStreamer.cpp llvm/lib/MC/MCStreamer.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/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index f89bfda97..05e108cf4 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -2632,8 +2632,7 @@ static llvm::MDNode *getGCCAsmSrcLocInfo(const StringLiteral *Str,
return getAsmSrcLocInfo(Locs, CGF);
}
-static llvm::MDNode *getMSAsmSrcLocInfo(const MSAsmStmt &S,
- StringRef AsmString,
+static llvm::MDNode *getMSAsmSrcLocInfo(const MSAsmStmt &S, StringRef AsmString,
CodeGenFunction &CGF) {
SmallVector<SourceLocation, 8> Locs;
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 56e8245dc..597a184ec 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -141,8 +141,8 @@ void AsmPrinter::emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
unsigned SyntheticLineOffset =
TM.getTargetTriple().isX86() && Dialect == InlineAsm::AD_Intel ? 1 : 0;
OutStreamer->setInlineAsmSourceLocCallback(
- [this, &SrcMgr, BufNum, SyntheticLineOffset,
- InlineAsmSourceLocs, MI](SMLoc Loc) {
+ [this, &SrcMgr, BufNum, SyntheticLineOffset, InlineAsmSourceLocs,
+ MI](SMLoc Loc) {
if (!Loc.isValid() || SrcMgr.FindBufferContainingLoc(Loc) != BufNum)
return;
@@ -155,12 +155,10 @@ void AsmPrinter::emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
if (LocIdx + 1 >= InlineAsmSourceLocs->getNumOperands())
return;
- const auto *Line =
- mdconst::dyn_extract<ConstantInt>(
- InlineAsmSourceLocs->getOperand(LocIdx));
- const auto *Column =
- mdconst::dyn_extract<ConstantInt>(
- InlineAsmSourceLocs->getOperand(LocIdx + 1));
+ const auto *Line = mdconst::dyn_extract<ConstantInt>(
+ InlineAsmSourceLocs->getOperand(LocIdx));
+ const auto *Column = mdconst::dyn_extract<ConstantInt>(
+ InlineAsmSourceLocs->getOperand(LocIdx + 1));
if (!Line || !Column || Line->isZero())
return;
``````````
</details>
https://github.com/llvm/llvm-project/pull/193007
More information about the cfe-commits
mailing list