Add null checks and const-ify these accessors.
authorOwen Anderson <resistor@mac.com>
Fri, 20 Apr 2007 05:44:16 +0000 (05:44 +0000)
committerOwen Anderson <resistor@mac.com>
Fri, 20 Apr 2007 05:44:16 +0000 (05:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36270 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/Dominators.h

index 778b4eab7595b6979b1a9cd75dcbd0a5b9d7bac3..1d7e2f351c7bc4d9850a383eb95e563b10cf1bf2 100644 (file)
@@ -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<BasicBlock>() : 0;
   }
   
-  void getChildren(BasicBlock *A, std::vector<BasicBlock*>& children) {
+  void getChildren(BasicBlock *A, std::vector<BasicBlock*>& children) const {
+    if (!A) return;
     ETNode *NodeA = getNode(A);
     const ETNode* son = NodeA->getSon();