[llvm] 6067711 - [RemoveDIs] Fix DPLabel crash reported in #82854
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 01:11:31 PST 2024
Author: Orlando Cazalet-Hyams
Date: 2024-02-26T09:09:52Z
New Revision: 60677110a2e0b7ba9f5bf2fcfc1b3f8888eb7f58
URL: https://github.com/llvm/llvm-project/commit/60677110a2e0b7ba9f5bf2fcfc1b3f8888eb7f58
DIFF: https://github.com/llvm/llvm-project/commit/60677110a2e0b7ba9f5bf2fcfc1b3f8888eb7f58.diff
LOG: [RemoveDIs] Fix DPLabel crash reported in #82854
Added:
Modified:
llvm/include/llvm/IR/DebugInfo.h
llvm/lib/IR/DebugInfo.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index 022df64880aebd..6673908d3ed355 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -109,10 +109,8 @@ class DebugInfoFinder {
void processVariable(const Module &M, const DILocalVariable *DVI);
/// Process debug info location.
void processLocation(const Module &M, const DILocation *Loc);
- // Process a DPValue, much like a DbgVariableIntrinsic.
- void processDPValue(const Module &M, const DPValue &DPV);
- /// Dispatch to DbgRecord subclasses handlers.
- void processDbgRecord(const Module &M, const DbgRecord &DPE);
+ /// Process a DbgRecord (e.g, treat a DPValue like a DbgVariableIntrinsic).
+ void processDbgRecord(const Module &M, const DbgRecord &DR);
/// Process subprogram.
void processSubprogram(DISubprogram *SP);
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index a4fec601908503..e044ab3230c5f9 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -251,13 +251,10 @@ void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
processLocation(M, Loc->getInlinedAt());
}
-void DebugInfoFinder::processDPValue(const Module &M, const DPValue &DPV) {
- processVariable(M, DPV.getVariable());
- processLocation(M, DPV.getDebugLoc().get());
-}
-
-void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DPR) {
- processDPValue(M, cast<DPValue>(DPR));
+void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DR) {
+ if (const DPValue *DPV = dyn_cast<const DPValue>(&DR))
+ processVariable(M, DPV->getVariable());
+ processLocation(M, DR.getDebugLoc().get());
}
void DebugInfoFinder::processType(DIType *DT) {
More information about the llvm-commits
mailing list