From: Eric Christopher Date: Fri, 16 Mar 2012 00:21:54 +0000 (+0000) Subject: Do the right thing on NULL uint64 fields. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=75df9f23fa7e3c4e02753fb0405d69cd0d68e0ef;p=oota-llvm.git 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 --- diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 585a087a02a..e30c0a9b330 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(DbgNode->getOperand(Elt))) + if (ConstantInt *CI = dyn_cast_or_null(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 00000000000..a7fdf70d71c --- /dev/null +++ b/test/DebugInfo/bug_null_debuginfo.ll @@ -0,0 +1,6 @@ +; RUN: llc + + +!llvm.dbg.cu = !{!0} + +!0 = metadata !{null, null, null}