summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-01-19 23:21:49 +0000
committerDevang Patel <dpatel@apple.com>2009-01-19 23:21:49 +0000
commitb79b5359fbe44bc82bedff2c081ed1db787f8d49 (patch)
tree57d05d6a0d2ab6f7893a7ce6b4884fe572976537 /lib/Analysis
parent6ff645bf0fcfc0c62e9d9126e1243ec8bf10abbc (diff)
downloadllvm-b79b5359fbe44bc82bedff2c081ed1db787f8d49.tar.gz
llvm-b79b5359fbe44bc82bedff2c081ed1db787f8d49.tar.bz2
llvm-b79b5359fbe44bc82bedff2c081ed1db787f8d49.tar.xz
Verify debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/DebugInfo.cpp94
1 files changed, 94 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index f27321780e..98335ae2dc 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -180,6 +180,100 @@ unsigned DIArray::getNumElements() const {
return C->getNumOperands();
}
+/// Verify - Verify that a compile unit is well formed.
+bool DICompileUnit::Verify() const {
+ if (isNull())
+ return false;
+ if (getFilename().empty())
+ return false;
+ // It is possible that directory and produce string is empty.
+ return true;
+}
+
+/// Verify - Verify that a type descriptor is well formed.
+bool DIType::Verify() const {
+ if (isNull())
+ return false;
+ if (getContext().isNull())
+ return false;
+
+ DICompileUnit CU = getCompileUnit();
+ if (!CU.isNull() && !CU.Verify())
+ return false;
+ return true;
+}
+
+/// Verify - Verify that a composite type descriptor is well formed.
+bool DICompositeType::Verify() const {
+ if (isNull())
+ return false;
+ if (getContext().isNull())
+ return false;
+
+ DICompileUnit CU = getCompileUnit();
+ if (!CU.isNull() && !CU.Verify())
+ return false;
+ return true;
+}
+
+/// Verify - Verify that a subprogram descriptor is well formed.
+bool DISubprogram::Verify() const {
+ if (isNull())
+ return false;
+
+ if (getContext().isNull())
+ return false;
+
+ DICompileUnit CU = getCompileUnit();
+ if (!CU.Verify())
+ return false;
+
+ DICompositeType Ty = getType();
+ if (!Ty.isNull() && !Ty.Verify())
+ return false;
+ return true;
+}
+
+/// Verify - Verify that a global variable descriptor is well formed.
+bool DIGlobalVariable::Verify() const {
+ if (isNull())
+ return false;
+
+ if (getContext().isNull())
+ return false;
+
+ DICompileUnit CU = getCompileUnit();
+ if (!CU.Verify())
+ return false;
+
+ DIType Ty = getType();
+ if (!Ty.Verify())
+ return false;
+
+ if (!getGlobal())
+ return false;
+
+ return true;
+}
+
+/// Verify - Verify that a variable descriptor is well formed.
+bool DIVariable::Verify() const {
+ if (isNull())
+ return false;
+
+ if (getContext().isNull())
+ return false;
+
+ DIType Ty = getType();
+ if (!Ty.Verify())
+ return false;
+
+
+ return true;
+}
+
+
+
//===----------------------------------------------------------------------===//
// DIFactory: Basic Helpers
//===----------------------------------------------------------------------===//