[PATCH] D102244: [llvm][AsmPrinter] Restore source location to register clobber warning
Yuanfang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 11 11:18:06 PDT 2021
ychen added inline comments.
================
Comment at: clang/test/Misc/inline-asm-clobber-warning.c:26
+// CHECK-NEXT: nop
+// CHECK-NEXT: ^
----------------
DavidSpickett wrote:
> I think this `^` is wrong because we don't/can't account for the asm printer tabbing in the instruction.
>
> I still wanted to check that there are `^` just because it's one aspect of the location information.
This probably is due to `Loc` is not right.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp:545
"lead to undefined behaviour.";
- SrcMgr.PrintMessage(Loc, SourceMgr::DK_Warning, Msg);
- SrcMgr.PrintMessage(Loc, SourceMgr::DK_Note, Note);
+ MMI->getContext().reportWarning(Loc, Msg);
+ MMI->getContext().reportNote(Loc, Note);
----------------
For this diagnose, it is better to use LLVMContext since the location inside inlineasm does not matter. There is an example above.
```
Msg << "invalid operand in inline asm: '" << AsmStr << "'";
MMI->getModule()->getContext().emitError(LocCookie, Msg.str());
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102244/new/
https://reviews.llvm.org/D102244
More information about the cfe-commits
mailing list