summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Benzaquen <sbenza@google.com>2014-10-01 17:58:42 +0000
committerSamuel Benzaquen <sbenza@google.com>2014-10-01 17:58:42 +0000
commite261aa4311018816475f72c8cfba9a5e816ff6a8 (patch)
tree1b1dbf1536a252baea1c44f71688148e69c582d8
parent25a7174e7a2ef0267486170570380a4dc2d0dd32 (diff)
downloadbcm5719-llvm-e261aa4311018816475f72c8cfba9a5e816ff6a8.tar.gz
bcm5719-llvm-e261aa4311018816475f72c8cfba9a5e816ff6a8.zip
Do not use delegated constructors.
Do not use delegated constructors. It is not supported on all platforms yet. Fixes build broken by r218769. llvm-svn: 218779
-rw-r--r--clang/include/clang/ASTMatchers/ASTMatchersInternal.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index a89b37a6b23..f00277c1a61 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -367,7 +367,10 @@ public:
Matcher(const Matcher<From> &Other,
typename std::enable_if<std::is_base_of<From, T>::value &&
!std::is_same<From, T>::value>::type * = 0)
- : Matcher(Other.Implementation) {}
+ : Implementation(restrictMatcher(Other.Implementation)) {
+ assert(Implementation.getSupportedKind().isSame(
+ ast_type_traits::ASTNodeKind::getFromNodeKind<T>()));
+ }
/// \brief Implicitly converts \c Matcher<Type> to \c Matcher<QualType>.
///
@@ -432,9 +435,12 @@ public:
private:
template <typename U> friend class Matcher;
+ static DynTypedMatcher restrictMatcher(const DynTypedMatcher &Other) {
+ return Other.dynCastTo(ast_type_traits::ASTNodeKind::getFromNodeKind<T>());
+ }
+
explicit Matcher(const DynTypedMatcher &Implementation)
- : Implementation(Implementation.dynCastTo(
- ast_type_traits::ASTNodeKind::getFromNodeKind<T>())) {
+ : Implementation(restrictMatcher(Implementation)) {
assert(this->Implementation.getSupportedKind()
.isSame(ast_type_traits::ASTNodeKind::getFromNodeKind<T>()));
}
OpenPOWER on IntegriCloud