aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-04-20 05:44:16 +0000
committerOwen Anderson <resistor@mac.com>2007-04-20 05:44:16 +0000
commit13e3a292c55137c63df13f49c723fa53371ada1e (patch)
treee048ec4595c732d5a74ad4983dc4be33f0181518
parentac79c9e6e008f9388ecba24fb4ce019db867d38d (diff)
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
-rw-r--r--include/llvm/Analysis/Dominators.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 778b4eab75..1d7e2f351c 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<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();