Skip to content

Commit ecd2aae

Browse files
committed
[DebugInfo] Merge DebugInfoFinder::{processDeclare,processValue} into processVariable
The two functions are identical.
1 parent c4b4c0c commit ecd2aae

File tree

2 files changed

+8
-28
lines changed

2 files changed

+8
-28
lines changed

llvm/include/llvm/IR/DebugInfo.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424

2525
namespace llvm {
2626

27-
class DbgDeclareInst;
28-
class DbgValueInst;
27+
class DbgVariableIntrinsic;
2928
class Instruction;
3029
class Module;
3130

@@ -77,10 +76,8 @@ class DebugInfoFinder {
7776
/// Process a single instruction and collect debug info anchors.
7877
void processInstruction(const Module &M, const Instruction &I);
7978

80-
/// Process DbgDeclareInst.
81-
void processDeclare(const Module &M, const DbgDeclareInst *DDI);
82-
/// Process DbgValueInst.
83-
void processValue(const Module &M, const DbgValueInst *DVI);
79+
/// Process DbgVariableIntrinsic.
80+
void processVariable(const Module &M, const DbgVariableIntrinsic &DVI);
8481
/// Process debug info location.
8582
void processLocation(const Module &M, const DILocation *Loc);
8683

llvm/lib/IR/DebugInfo.cpp

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ void DebugInfoFinder::processCompileUnit(DICompileUnit *CU) {
105105

106106
void DebugInfoFinder::processInstruction(const Module &M,
107107
const Instruction &I) {
108-
if (auto *DDI = dyn_cast<DbgDeclareInst>(&I))
109-
processDeclare(M, DDI);
110-
else if (auto *DVI = dyn_cast<DbgValueInst>(&I))
111-
processValue(M, DVI);
108+
if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I))
109+
processVariable(M, *DVI);
112110

113111
if (auto DbgLoc = I.getDebugLoc())
114112
processLocation(M, DbgLoc.get());
@@ -194,24 +192,9 @@ void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
194192
}
195193
}
196194

197-
void DebugInfoFinder::processDeclare(const Module &M,
198-
const DbgDeclareInst *DDI) {
199-
auto *N = dyn_cast<MDNode>(DDI->getVariable());
200-
if (!N)
201-
return;
202-
203-
auto *DV = dyn_cast<DILocalVariable>(N);
204-
if (!DV)
205-
return;
206-
207-
if (!NodesSeen.insert(DV).second)
208-
return;
209-
processScope(DV->getScope());
210-
processType(DV->getType());
211-
}
212-
213-
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
214-
auto *N = dyn_cast<MDNode>(DVI->getVariable());
195+
void DebugInfoFinder::processVariable(const Module &M,
196+
const DbgVariableIntrinsic &DVI) {
197+
auto *N = dyn_cast<MDNode>(DVI.getVariable());
215198
if (!N)
216199
return;
217200

0 commit comments

Comments
 (0)