[PATCH] Special case 0 and 1 matcher in makeAllOfComposite().

Samuel Benzaquen sbenza at google.com
Thu Oct 9 11:32:43 PDT 2014


================
Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:450
@@ -436,2 +449,3 @@
   template <typename U> friend class Matcher;
+  friend class DynTypedMatcher;
 
----------------
klimek wrote:
> What is this needed for? I'd prefer if we could get rid of it, but if not, it should have a comment explaining it (so we can take it out if we don't need it any more).
Matcher(DynTypedMatcher) is private because it is essentially "unsafe". You can easily create a matcher that matches nothing.
It is only called by explicit conversions like Matcher<T>::dynCastTo<U> and DynTypedMatcher::unconditionalConvertTo<T>. The friendship is for those functions.

http://reviews.llvm.org/D5675






More information about the cfe-commits mailing list