It's possible for a global variable to be optimized out of a metadata object. So

we should allow a "null" with this dyn_cast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83573 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2009-10-08 20:52:51 +00:00
parent 632606c724
commit 26c6cf4cec
2 changed files with 73 additions and 1 deletions

View File

@@ -116,7 +116,7 @@ GlobalVariable *DIDescriptor::getGlobalVariableField(unsigned Elt) const {
return 0;
if (Elt < DbgNode->getNumElements())
return dyn_cast<GlobalVariable>(DbgNode->getElement(Elt));
return dyn_cast_or_null<GlobalVariable>(DbgNode->getElement(Elt));
return 0;
}