[DebugInfo] Merge DebugInfoFinder::{processDeclare,processValue} into processVariable

The two functions are identical.
This commit is contained in:
Fangrui Song 2020-02-01 22:59:51 -08:00
parent c4b4c0c47c
commit ecd2aaee06
2 changed files with 8 additions and 28 deletions

View File

@ -24,8 +24,7 @@
namespace llvm {
class DbgDeclareInst;
class DbgValueInst;
class DbgVariableIntrinsic;
class Instruction;
class Module;
@ -77,10 +76,8 @@ public:
/// Process a single instruction and collect debug info anchors.
void processInstruction(const Module &M, const Instruction &I);
/// Process DbgDeclareInst.
void processDeclare(const Module &M, const DbgDeclareInst *DDI);
/// Process DbgValueInst.
void processValue(const Module &M, const DbgValueInst *DVI);
/// Process DbgVariableIntrinsic.
void processVariable(const Module &M, const DbgVariableIntrinsic &DVI);
/// Process debug info location.
void processLocation(const Module &M, const DILocation *Loc);

View File

@ -105,10 +105,8 @@ void DebugInfoFinder::processCompileUnit(DICompileUnit *CU) {
void DebugInfoFinder::processInstruction(const Module &M,
const Instruction &I) {
if (auto *DDI = dyn_cast<DbgDeclareInst>(&I))
processDeclare(M, DDI);
else if (auto *DVI = dyn_cast<DbgValueInst>(&I))
processValue(M, DVI);
if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I))
processVariable(M, *DVI);
if (auto DbgLoc = I.getDebugLoc())
processLocation(M, DbgLoc.get());
@ -194,24 +192,9 @@ void DebugInfoFinder::processSubprogram(DISubprogram *SP) {
}
}
void DebugInfoFinder::processDeclare(const Module &M,
const DbgDeclareInst *DDI) {
auto *N = dyn_cast<MDNode>(DDI->getVariable());
if (!N)
return;
auto *DV = dyn_cast<DILocalVariable>(N);
if (!DV)
return;
if (!NodesSeen.insert(DV).second)
return;
processScope(DV->getScope());
processType(DV->getType());
}
void DebugInfoFinder::processValue(const Module &M, const DbgValueInst *DVI) {
auto *N = dyn_cast<MDNode>(DVI->getVariable());
void DebugInfoFinder::processVariable(const Module &M,
const DbgVariableIntrinsic &DVI) {
auto *N = dyn_cast<MDNode>(DVI.getVariable());
if (!N)
return;