From: Owen Anderson Date: Fri, 20 Apr 2007 05:44:16 +0000 (+0000) Subject: Add null checks and const-ify these accessors. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=13e3a292c55137c63df13f49c723fa53371ada1e;p=oota-llvm.git Add null checks and const-ify these accessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36270 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 778b4eab759..1d7e2f351c7 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -322,13 +322,16 @@ public: } /// Return the immediate dominator of A. - BasicBlock *getIDom(BasicBlock *A) { + BasicBlock *getIDom(BasicBlock *A) const { + if (!A) return 0; + ETNode *NodeA = getNode(A); const ETNode *idom = NodeA->getFather(); return idom ? idom->getData() : 0; } - void getChildren(BasicBlock *A, std::vector& children) { + void getChildren(BasicBlock *A, std::vector& children) const { + if (!A) return; ETNode *NodeA = getNode(A); const ETNode* son = NodeA->getSon();