aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/DebugInfo.cpp
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
commit208098ba9cdd450ea53c98a66e174ffaa210fd2e (patch)
tree57d05d6a0d2ab6f7893a7ce6b4884fe572976537 /lib/Analysis/DebugInfo.cpp
parentf5a6c93350ca35ed57b378294f2eb1df2252a6c0 (diff)
downloadexternal_llvm-208098ba9cdd450ea53c98a66e174ffaa210fd2e.zip
external_llvm-208098ba9cdd450ea53c98a66e174ffaa210fd2e.tar.gz
external_llvm-208098ba9cdd450ea53c98a66e174ffaa210fd2e.tar.bz2
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/DebugInfo.cpp')
-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 f273217..98335ae 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
//===----------------------------------------------------------------------===//