aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfWriter.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
commitb79b5359fbe44bc82bedff2c081ed1db787f8d49 (patch)
tree57d05d6a0d2ab6f7893a7ce6b4884fe572976537 /lib/CodeGen/AsmPrinter/DwarfWriter.cpp
parent6ff645bf0fcfc0c62e9d9126e1243ec8bf10abbc (diff)
Verify debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfWriter.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfWriter.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index f74e1a46e6..18be9bf3b5 100644
--- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -3029,6 +3029,9 @@ public:
/// ValidDebugInfo - Return true if V represents valid debug info value.
bool ValidDebugInfo(Value *V) {
+ if (!V)
+ return false;
+
if (!shouldEmit)
return false;
@@ -3046,7 +3049,21 @@ public:
if (Version != DIDescriptor::Version7 && Version != DIDescriptor::Version6)
return false;
- //FIXME - Check individual descriptors.
+ unsigned Tag = DI.getTag();
+ switch (Tag) {
+ case DW_TAG_variable:
+ assert (DIVariable(GV).Verify() && "Invalid DebugInfo value");
+ break;
+ case DW_TAG_compile_unit:
+ assert (DICompileUnit(GV).Verify() && "Invalid DebugInfo value");
+ break;
+ case DW_TAG_subprogram:
+ assert (DISubprogram(GV).Verify() && "Invalid DebugInfo value");
+ break;
+ default:
+ break;
+ }
+
return true;
}