Skip to content

Commit

Permalink
Add a workaround for building with old versions of clang.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153820 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
espindola committed Mar 31, 2012
1 parent f10037b commit 6226c49
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions include/llvm/Analysis/Dominators.h
Expand Up @@ -346,16 +346,7 @@ class DominatorTreeBase : public DominatorBase<NodeT> {
return dominates(A, B);
}

inline bool properlyDominates(const NodeT *A, const NodeT *B) {
if (A == B)
return false;

// 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)));
}
bool properlyDominates(const NodeT *A, const NodeT *B);

bool dominatedBySlowTreeWalk(const DomTreeNodeBase<NodeT> *A,
const DomTreeNodeBase<NodeT> *B) const {
Expand Down Expand Up @@ -429,16 +420,7 @@ class DominatorTreeBase : public DominatorBase<NodeT> {
return dominatedBySlowTreeWalk(A, B);
}

inline bool dominates(const NodeT *A, const NodeT *B) {
if (A == B)
return true;

// 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)));
}
bool dominates(const NodeT *A, const NodeT *B);

NodeT *getRoot() const {
assert(this->Roots.size() == 1 && "Should always have entry node!");
Expand Down Expand Up @@ -704,6 +686,32 @@ class DominatorTreeBase : public DominatorBase<NodeT> {
}
};

// These two functions are declare out of line as a workaround for building
// with old (< r147295) versions of clang because of pr11642.
template<class NodeT>
bool DominatorTreeBase<NodeT>::dominates(const NodeT *A, const NodeT *B) {
if (A == B)
return true;

// 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)));
}
template<class NodeT>
bool
DominatorTreeBase<NodeT>::properlyDominates(const NodeT *A, const NodeT *B) {
if (A == B)
return false;

// 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)));
}

EXTERN_TEMPLATE_INSTANTIATION(class DominatorTreeBase<BasicBlock>);

//===-------------------------------------
Expand Down

0 comments on commit 6226c49

Please sign in to comment.