From: Devang Patel Date: Wed, 30 Sep 2009 21:26:51 +0000 (+0000) Subject: Check for null MDNode element while printing comment. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=4d7a2061f147cf64c0cdd36e67ca71e1d89c16f3;p=oota-llvm.git Check for null MDNode element while printing comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83172 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index fbd62dd0728..34ce7bb9964 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -874,7 +874,7 @@ static void WriteMDNodeComment(const MDNode *Node, formatted_raw_ostream &Out) { if (Node->getNumElements() < 1) return; - ConstantInt *CI = dyn_cast(Node->getElement(0)); + ConstantInt *CI = dyn_cast_or_null(Node->getElement(0)); if (!CI) return; unsigned Val = CI->getZExtValue(); unsigned Tag = Val & ~LLVMDebugVersionMask;