diff options
author | beetrees <b@beetr.ee> | 2024-06-14 15:05:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 15:05:57 +0100 |
commit | db3a47c810639388c80ed173dda3623dac00ce0a (patch) | |
tree | c5600b8f1a8d322c8da285ec3b4562fa27f00232 /llvm/lib/CodeGen/MachineModuleInfo.cpp | |
parent | 08fae467e4c742e91c8fdff8519718cf2c7c9b0e (diff) | |
download | llvm-db3a47c810639388c80ed173dda3623dac00ce0a.zip llvm-db3a47c810639388c80ed173dda3623dac00ce0a.tar.gz llvm-db3a47c810639388c80ed173dda3623dac00ce0a.tar.bz2 |
Fix silent truncation of inline ASM `srcloc` cookie when going through a `DiagnosticInfoSrcMgr` (#84559)
The size of the inline ASM `srcloc` cookie was changed from 32 bits to
64 bits in [D105491](https://reviews.llvm.org/D105491). However, that
commit only updated the size of the cookie in `DiagnosticInfoInlineAsm`,
meaning that inline ASM diagnostics that are instead represented with a
`DiagnosticInfoSrcMgr` have their cookies truncated to 32 bits. This PR
replaces the remaining uses of `unsigned` to represent the cookie with
`uint64_t`, allowing the cookie to make it all the way to the diagnostic
handler without being truncated.
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineModuleInfo.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 1dba591..b950f4f 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -185,7 +185,7 @@ INITIALIZE_PASS(MachineModuleInfoWrapperPass, "machinemoduleinfo", "Machine Module Information", false, false) char MachineModuleInfoWrapperPass::ID = 0; -static unsigned getLocCookie(const SMDiagnostic &SMD, const SourceMgr &SrcMgr, +static uint64_t getLocCookie(const SMDiagnostic &SMD, const SourceMgr &SrcMgr, std::vector<const MDNode *> &LocInfos) { // Look up a LocInfo for the buffer this diagnostic is coming from. unsigned BufNum = SrcMgr.FindBufferContainingLoc(SMD.getLoc()); @@ -195,7 +195,7 @@ static unsigned getLocCookie(const SMDiagnostic &SMD, const SourceMgr &SrcMgr, // If the inline asm had metadata associated with it, pull out a location // cookie corresponding to which line the error occurred on. - unsigned LocCookie = 0; + uint64_t LocCookie = 0; if (LocInfo) { unsigned ErrorLine = SMD.getLineNo() - 1; if (ErrorLine >= LocInfo->getNumOperands()) @@ -218,7 +218,7 @@ bool MachineModuleInfoWrapperPass::doInitialization(Module &M) { [&Ctx, &M](const SMDiagnostic &SMD, bool IsInlineAsm, const SourceMgr &SrcMgr, std::vector<const MDNode *> &LocInfos) { - unsigned LocCookie = 0; + uint64_t LocCookie = 0; if (IsInlineAsm) LocCookie = getLocCookie(SMD, SrcMgr, LocInfos); Ctx.diagnose( |