diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-02 17:05:05 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-02 17:05:05 +0000 |
commit | 5c7b1d9dd31abf15bdeb32ec2dd09b666114da7e (patch) | |
tree | 924cd6070d587f6ae88b1e13f65fbd8fbf1dc3f8 /include | |
parent | c53892f60f8828b82695fff8895223bf6abdc1a4 (diff) | |
download | external_llvm-5c7b1d9dd31abf15bdeb32ec2dd09b666114da7e.zip external_llvm-5c7b1d9dd31abf15bdeb32ec2dd09b666114da7e.tar.gz external_llvm-5c7b1d9dd31abf15bdeb32ec2dd09b666114da7e.tar.bz2 |
Add const qualifiers to dominates' arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80801 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 7622326..5d1e8ec 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -404,11 +404,15 @@ public: return dominatedBySlowTreeWalk(A, B); } - inline bool dominates(NodeT *A, NodeT *B) { + inline bool dominates(const NodeT *A, const NodeT *B) { if (A == B) return true; - return dominates(getNode(A), getNode(B)); + // Cast away the const qualifiers here. This is ok since + // this function doesn't actually return the values returned + // from getNode. + return dominates(getNode(const_cast<NodeT *>(A)), + getNode(const_cast<NodeT *>(B))); } NodeT *getRoot() const { @@ -736,15 +740,15 @@ public: return DT->dominates(A, B); } - inline bool dominates(BasicBlock* A, BasicBlock* B) const { + inline bool dominates(const BasicBlock* A, const BasicBlock* B) const { return DT->dominates(A, B); } // dominates - Return true if A dominates B. This performs the // special checks necessary if A and B are in the same basic block. - bool dominates(Instruction *A, Instruction *B) const { - BasicBlock *BBA = A->getParent(), *BBB = B->getParent(); - if (BBA != BBB) return DT->dominates(BBA, BBB); + bool dominates(const Instruction *A, const Instruction *B) const { + const BasicBlock *BBA = A->getParent(), *BBB = B->getParent(); + if (BBA != BBB) return dominates(BBA, BBB); // It is not possible to determine dominance between two PHI nodes // based on their ordering. @@ -752,7 +756,7 @@ public: return false; // Loop through the basic block until we find A or B. - BasicBlock::iterator I = BBA->begin(); + BasicBlock::const_iterator I = BBA->begin(); for (; &*I != A && &*I != B; ++I) /*empty*/; //if(!DT.IsPostDominators) { |