[llvm] fix wrong inline assembly line/col info in the error message with ThinLTO (PR #102211)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 11:40:06 PDT 2024
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 0395bf7636bf0d07f662618107724c28b66c674c 5735e32fc185b277273842c862b7b4e363957f89 --extensions cpp,h -- llvm/include/llvm/CodeGen/AsmPrinter.h llvm/include/llvm/Support/SourceMgr.h llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp llvm/lib/Support/SourceMgr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 88f437b1ef..7897bcabed 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -873,12 +873,11 @@ private:
void emitFunctionPrefix(ArrayRef<const Constant *> Prefix);
/// Emit a blob of inline asm to the output streamer.
- void
- emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
- const MCTargetOptions &MCOptions,
- const MDNode *LocMDNode = nullptr,
- InlineAsm::AsmDialect AsmDialect = InlineAsm::AD_ATT,
- const DebugLoc *DbgLoc = nullptr) const;
+ void emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
+ const MCTargetOptions &MCOptions,
+ const MDNode *LocMDNode = nullptr,
+ InlineAsm::AsmDialect AsmDialect = InlineAsm::AD_ATT,
+ const DebugLoc *DbgLoc = nullptr) const;
/// This method formats and emits the specified machine instruction that is an
/// inline asm.
@@ -886,8 +885,7 @@ private:
/// Add inline assembly info to the diagnostics machinery, so we can
/// emit file and position info. Returns SrcMgr memory buffer position.
- unsigned addInlineAsmDiagBuffer(StringRef AsmStr,
- const MDNode *LocMDNode,
+ unsigned addInlineAsmDiagBuffer(StringRef AsmStr, const MDNode *LocMDNode,
const DebugLoc *DbgLoc) const;
//===------------------------------------------------------------------===//
diff --git a/llvm/include/llvm/Support/SourceMgr.h b/llvm/include/llvm/Support/SourceMgr.h
index 167ccb8a48..6a0ef62c25 100644
--- a/llvm/include/llvm/Support/SourceMgr.h
+++ b/llvm/include/llvm/Support/SourceMgr.h
@@ -148,9 +148,8 @@ public:
SMLoc IncludeLoc) {
return AddNewSourceBuffer(std::move(F), 0, 0, IncludeLoc);
}
- unsigned AddNewSourceBuffer(std::unique_ptr<MemoryBuffer> F,
- unsigned Line, unsigned Col,
- SMLoc IncludeLoc) {
+ unsigned AddNewSourceBuffer(std::unique_ptr<MemoryBuffer> F, unsigned Line,
+ unsigned Col, SMLoc IncludeLoc) {
SrcBuffer NB;
NB.Buffer = std::move(F);
NB.IncludeLoc = IncludeLoc;
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 0f62269aeb..4e535b56cb 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -56,9 +56,11 @@ unsigned AsmPrinter::addInlineAsmDiagBuffer(StringRef AsmStr,
Buffer = MemoryBuffer::getMemBufferCopy(AsmStr, "<inline asm>");
// Tell SrcMgr about this buffer, it takes ownership of the buffer.
- unsigned BufNum = DbgLoc ? \
- SrcMgr.AddNewSourceBuffer(std::move(Buffer), DbgLoc->getLine()-1, DbgLoc->getCol()-1, SMLoc()) : \
- SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());
+ unsigned BufNum =
+ DbgLoc
+ ? SrcMgr.AddNewSourceBuffer(std::move(Buffer), DbgLoc->getLine() - 1,
+ DbgLoc->getCol() - 1, SMLoc())
+ : SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());
// Store LocMDNode in DiagInfo, using BufNum as an identifier.
if (LocMDNode) {
@@ -69,7 +71,6 @@ unsigned AsmPrinter::addInlineAsmDiagBuffer(StringRef AsmStr,
return BufNum;
}
-
/// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
void AsmPrinter::emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI,
const MCTargetOptions &MCOptions,
``````````
</details>
https://github.com/llvm/llvm-project/pull/102211
More information about the llvm-commits
mailing list