Fix some null checks to actually test the part that needs checking.
[oota-llvm.git] / include / llvm / Analysis / Dominators.h
index 778b4eab7595b6979b1a9cd75dcbd0a5b9d7bac3..45eed7fcdaf133ff9790ebb632496e84d21ec5dd 100644 (file)
@@ -322,14 +322,16 @@ public:
   }
   
   /// Return the immediate dominator of A.
-  BasicBlock *getIDom(BasicBlock *A) {
+  BasicBlock *getIDom(BasicBlock *A) const {
     ETNode *NodeA = getNode(A);
+    if (!NodeA) return 0;
     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 {
     ETNode *NodeA = getNode(A);
+    if (!NodeA) return;
     const ETNode* son = NodeA->getSon();
     
     if (!son) return;