[llvm] ecd2aae - [DebugInfo] Merge DebugInfoFinder::{processDeclare, processValue} into processVariable
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 1 23:00:58 PST 2020
Author: Fangrui Song
Date: 2020-02-01T23:00:21-08:00
New Revision: ecd2aaee0645e832566850044c4ee5fc5ff76a02
URL: https://github.com/llvm/llvm-project/commit/ecd2aaee0645e832566850044c4ee5fc5ff76a02
DIFF: https://github.com/llvm/llvm-project/commit/ecd2aaee0645e832566850044c4ee5fc5ff76a02.diff
LOG: [DebugInfo] Merge DebugInfoFinder::{processDeclare,processValue} into processVariable
The two functions are identical.
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 8a0b5f17d49b..e7c1d9a90677 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -24,8 +24,7 @@
namespace llvm {
-class DbgDeclareInst;
-class DbgValueInst;
+class DbgVariableIntrinsic;
class Instruction;
class Module;
@@ -77,10 +76,8 @@ class DebugInfoFinder {
/// 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);
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 1e9675473730..a036621baf36 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -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;
More information about the llvm-commits
mailing list