Debug Info Verifier: verify SPs in llvm.dbg.sp.
Also always add DIType, DISubprogram and DIGlobalVariable to the list
in DebugInfoFinder without checking them, so we can verify them later
on.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187285 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/DebugInfo.cpp b/lib/IR/DebugInfo.cpp
index 58f054c..e8334f5 100644
--- a/lib/IR/DebugInfo.cpp
+++ b/lib/IR/DebugInfo.cpp
@@ -908,6 +908,10 @@
return;
}
}
+ if (NamedMDNode *SP_Nodes = M.getNamedMetadata("llvm.dbg.sp")) {
+ for (unsigned i = 0, e = SP_Nodes->getNumOperands(); i != e; ++i)
+ processSubprogram(DISubprogram(SP_Nodes->getOperand(i)));
+ }
}
/// processLocation - Process DILocation.
@@ -1029,7 +1033,7 @@
/// addType - Add type into Tys.
bool DebugInfoFinder::addType(DIType DT) {
- if (!DT.isValid())
+ if (!DT)
return false;
if (!NodesSeen.insert(DT))
@@ -1041,6 +1045,8 @@
/// addCompileUnit - Add compile unit into CUs.
bool DebugInfoFinder::addCompileUnit(DICompileUnit CU) {
+ if (!CU)
+ return false;
if (!NodesSeen.insert(CU))
return false;
@@ -1050,7 +1056,7 @@
/// addGlobalVariable - Add global variable into GVs.
bool DebugInfoFinder::addGlobalVariable(DIGlobalVariable DIG) {
- if (!DIDescriptor(DIG).isGlobalVariable())
+ if (!DIG)
return false;
if (!NodesSeen.insert(DIG))
@@ -1062,7 +1068,7 @@
// addSubprogram - Add subprgoram into SPs.
bool DebugInfoFinder::addSubprogram(DISubprogram SP) {
- if (!DIDescriptor(SP).isSubprogram())
+ if (!SP)
return false;
if (!NodesSeen.insert(SP))