if (!isObjCProperty())
return false;
- DIType Ty = getType();
- if (!Ty.Verify()) return false;
-
// Don't worry about the rest of the strings for now.
return DbgNode->getNumOperands() == 8;
}
bool DIType::Verify() const {
if (!isType())
return false;
- if (getContext() && !getContext().Verify())
- return false;
unsigned Tag = getTag();
if (!isBasicType() && Tag != dwarf::DW_TAG_const_type &&
Tag != dwarf::DW_TAG_volatile_type && Tag != dwarf::DW_TAG_pointer_type &&
bool DICompositeType::Verify() const {
if (!isCompositeType())
return false;
- if (getContext() && !getContext().Verify())
- return false;
return DbgNode->getNumOperands() >= 10 && DbgNode->getNumOperands() <= 14;
}
if (!isSubprogram())
return false;
- if (getContext() && !getContext().Verify())
- return false;
-
- DICompositeType Ty = getType();
- if (!Ty.Verify())
- return false;
return DbgNode->getNumOperands() == 20;
}
if (getDisplayName().empty())
return false;
- if (getContext() && !getContext().Verify())
- return false;
-
- DIType Ty = getType();
- if (!Ty.Verify())
- return false;
-
return DbgNode->getNumOperands() == 13;
}
if (!isVariable())
return false;
- if (getContext() && !getContext().Verify())
- return false;
-
- DIType Ty = getType();
- if (!Ty.Verify())
- return false;
-
return DbgNode->getNumOperands() >= 8;
}
DIArray GVs = CU.getGlobalVariables();
for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) {
DIGlobalVariable DIG(GVs.getElement(i));
- if (addGlobalVariable(DIG))
+ if (addGlobalVariable(DIG)) {
+ processScope(DIG.getContext());
processType(DIG.getType());
+ }
}
DIArray SPs = CU.getSubprograms();
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i)
void DebugInfoFinder::processType(DIType DT) {
if (!addType(DT))
return;
+ processScope(DT.getContext());
if (DT.isCompositeType()) {
DICompositeType DCT(DT);
processType(DCT.getTypeDerivedFrom());
}
}
+void DebugInfoFinder::processScope(DIScope Scope) {
+ if (Scope.isType()) {
+ DIType Ty(Scope);
+ processType(Ty);
+ return;
+ }
+ if (!addScope(Scope))
+ return;
+ if (Scope.isLexicalBlock()) {
+ DILexicalBlock LB(Scope);
+ processScope(LB.getContext());
+ } else if (Scope.isLexicalBlockFile()) {
+ DILexicalBlockFile LBF = DILexicalBlockFile(Scope);
+ processScope(LBF.getScope());
+ } else if (Scope.isNameSpace()) {
+ DINameSpace NS(Scope);
+ processScope(NS.getContext());
+ }
+}
+
/// processLexicalBlock
void DebugInfoFinder::processLexicalBlock(DILexicalBlock LB) {
DIScope Context = LB.getContext();
void DebugInfoFinder::processSubprogram(DISubprogram SP) {
if (!addSubprogram(SP))
return;
+ processScope(SP.getContext());
processType(SP.getType());
}
return true;
}
+bool DebugInfoFinder::addScope(DIScope Scope) {
+ if (!Scope)
+ return false;
+ if (!NodesSeen.insert(Scope))
+ return false;
+ Scopes.push_back(Scope);
+ return true;
+}
+
//===----------------------------------------------------------------------===//
// DIDescriptor: dump routines for all descriptors.
//===----------------------------------------------------------------------===//