[PATCH] Refactor VariantMatcher to use a tagged union.

Stefanus Du Toit stefanus.du.toit at intel.com
Tue Aug 20 08:16:33 PDT 2013



================
Comment at: lib/ASTMatchers/Dynamic/VariantValue.cpp:160
@@ -84,1 +159,3 @@
+      if (CanConstructCallback(*AsPolymorphic->Matchers[i]))
+        return AsPolymorphic->Matchers[i];
     }
----------------
This changes the behaviour of this function - previously if more than one matcher passed the test it would return null, now it returns the first one. I don't know if you intended that, but if you did, you should update the comment at the function's declaration.

================
Comment at: lib/ASTMatchers/Dynamic/VariantValue.cpp:156
@@ +155,3 @@
+  case RT_Nothing: return NULL;
+  case RT_Single: return AsSingle->Matcher.get();
+  case RT_Polymorphic:
----------------
Shouldn't this still call CanConstructCallback()?


http://llvm-reviews.chandlerc.com/D1446



More information about the cfe-commits mailing list