aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-03-16 00:21:54 +0000
committerEric Christopher <echristo@apple.com>2012-03-16 00:21:54 +0000
commit75df9f23fa7e3c4e02753fb0405d69cd0d68e0ef (patch)
tree9b4243b6e2def9cc8204bc7d129a756edbcfc116
parentb99ea7cb3fe8af46bdc2ad68550632f5c16bdaa9 (diff)
Do the right thing on NULL uint64 fields.
Patch by Clemens Hammacher! Fixes PR12243 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152880 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/DebugInfo.cpp2
-rw-r--r--test/DebugInfo/bug_null_debuginfo.ll6
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 585a087a02..e30c0a9b33 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -68,7 +68,7 @@ uint64_t DIDescriptor::getUInt64Field(unsigned Elt) const {
return 0;
if (Elt < DbgNode->getNumOperands())
- if (ConstantInt *CI = dyn_cast<ConstantInt>(DbgNode->getOperand(Elt)))
+ if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(DbgNode->getOperand(Elt)))
return CI->getZExtValue();
return 0;
diff --git a/test/DebugInfo/bug_null_debuginfo.ll b/test/DebugInfo/bug_null_debuginfo.ll
new file mode 100644
index 0000000000..a7fdf70d71
--- /dev/null
+++ b/test/DebugInfo/bug_null_debuginfo.ll
@@ -0,0 +1,6 @@
+; RUN: llc
+
+
+!llvm.dbg.cu = !{!0}
+
+!0 = metadata !{null, null, null}