Skip to content

Commit 6067711

Browse files
committed
[RemoveDIs] Fix DPLabel crash reported in #82854
1 parent 94ca854 commit 6067711

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

llvm/include/llvm/IR/DebugInfo.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,8 @@ class DebugInfoFinder {
109109
void processVariable(const Module &M, const DILocalVariable *DVI);
110110
/// Process debug info location.
111111
void processLocation(const Module &M, const DILocation *Loc);
112-
// Process a DPValue, much like a DbgVariableIntrinsic.
113-
void processDPValue(const Module &M, const DPValue &DPV);
114-
/// Dispatch to DbgRecord subclasses handlers.
115-
void processDbgRecord(const Module &M, const DbgRecord &DPE);
112+
/// Process a DbgRecord (e.g, treat a DPValue like a DbgVariableIntrinsic).
113+
void processDbgRecord(const Module &M, const DbgRecord &DR);
116114

117115
/// Process subprogram.
118116
void processSubprogram(DISubprogram *SP);

llvm/lib/IR/DebugInfo.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,10 @@ void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
251251
processLocation(M, Loc->getInlinedAt());
252252
}
253253

254-
void DebugInfoFinder::processDPValue(const Module &M, const DPValue &DPV) {
255-
processVariable(M, DPV.getVariable());
256-
processLocation(M, DPV.getDebugLoc().get());
257-
}
258-
259-
void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DPR) {
260-
processDPValue(M, cast<DPValue>(DPR));
254+
void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DR) {
255+
if (const DPValue *DPV = dyn_cast<const DPValue>(&DR))
256+
processVariable(M, DPV->getVariable());
257+
processLocation(M, DR.getDebugLoc().get());
261258
}
262259

263260
void DebugInfoFinder::processType(DIType *DT) {

0 commit comments

Comments
 (0)