[PATCH] Refactor VariantMatcher to use a tagged union.

Manuel Klimek klimek at google.com
Wed Aug 21 07:40:37 PDT 2013

On Wed, Aug 21, 2013 at 4:40 PM, Samuel Benzaquen <sbenza at google.com> wrote:

> ================
> Comment at: include/clang/ASTMatchers/Dynamic/VariantValue.h:140
> @@ +139,3 @@
> +  };
> +  union {
> +    SingleRep *AsSingle;
> ----------------
> Manuel Klimek wrote:
> > Any reason not to use an interface with two implementations? This smells
> a lot like building our own inheritance implementation ...
> These two could hide behind an interface, but I don't know how the
> interface would work for the variadic case coming next (from D1427).
> The basic idea for that one is that on getTypedMatcher<T> it will convert
> all the inner matchers to Matcher<T>, then create a
> VariadicOperatorMatcherInterface<T> with them and return it.
> If I try to use interfaces, I will need two: one for the payload of the
> matcher, and one for the operations from <T>. It can be done, but it might
> be messier.
> I'll give it a try to see how it looks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130821/0ddf6bcb/attachment.html>

More information about the cfe-commits mailing list