diff options
author | Samuel Benzaquen <sbenza@google.com> | 2015-07-17 16:05:27 +0000 |
---|---|---|
committer | Samuel Benzaquen <sbenza@google.com> | 2015-07-17 16:05:27 +0000 |
commit | b063f5c7e173a02d7eaa39387ed8f06c2026a70b (patch) | |
tree | 1a167bda028c3f7faa4bb12bc228a038cca0e3ea /clang/lib | |
parent | 2bec8500ef9f558d9bc61ec90d4a4f64625e86dc (diff) | |
download | bcm5719-llvm-b063f5c7e173a02d7eaa39387ed8f06c2026a70b.tar.gz bcm5719-llvm-b063f5c7e173a02d7eaa39387ed8f06c2026a70b.zip |
[ASTMatchers] Use provided target NodeKind instead of inferring it from the matchers.
Individual matchers might not be convertible to each other's kind, but
they might still all be convertible to the target kind.
All the callers already know the target kind, so just pass it down.
llvm-svn: 242534
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 10 | ||||
-rw-r--r-- | clang/lib/ASTMatchers/Dynamic/VariantValue.cpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp index 069fcba474b..463cf0ba9df 100644 --- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -110,15 +110,15 @@ static llvm::ManagedStatic<TrueMatcherImpl> TrueMatcherInstance; DynTypedMatcher DynTypedMatcher::constructVariadic( DynTypedMatcher::VariadicOperator Op, + ast_type_traits::ASTNodeKind SupportedKind, std::vector<DynTypedMatcher> InnerMatchers) { assert(InnerMatchers.size() > 0 && "Array must not be empty."); assert(std::all_of(InnerMatchers.begin(), InnerMatchers.end(), - [&InnerMatchers](const DynTypedMatcher &M) { - return InnerMatchers[0].canConvertTo(M.SupportedKind); - }) && - "SupportedKind must be convertible to a common type!"); + [SupportedKind](const DynTypedMatcher &M) { + return M.canConvertTo(SupportedKind); + }) && + "InnerMatchers must be convertible to SupportedKind!"); - auto SupportedKind = InnerMatchers[0].SupportedKind; // We must relax the restrict kind here. // The different operators might deal differently with a mismatch. // Make it the same as SupportedKind, since that is the broadest type we are diff --git a/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp b/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp index 9d8be470058..8f3c70c1a8d 100644 --- a/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp +++ b/clang/lib/ASTMatchers/Dynamic/VariantValue.cpp @@ -72,7 +72,7 @@ VariantMatcher::MatcherOps::constructVariadicOperator( return llvm::None; DynMatchers.push_back(*Inner); } - return DynTypedMatcher::constructVariadic(Op, DynMatchers); + return DynTypedMatcher::constructVariadic(Op, NodeKind, DynMatchers); } VariantMatcher::Payload::~Payload() {} |