[PATCH] Refactor VariantMatcher::MatcherOps to reduce the amount of generated code.

Samuel Benzaquen sbenza at google.com
Wed Sep 3 10:41:36 PDT 2014


I am not opposed to making the compiler faster, but I am not in a position to do that.

================
Comment at: lib/ASTMatchers/ASTMatchersInternal.cpp:29-37
@@ -28,1 +28,11 @@
 
+bool DynTypedMatcher::canConvertTo(ast_type_traits::ASTNodeKind To) const {
+  const auto SourceKind = getSupportedKind();
+  auto QualKind = ast_type_traits::ASTNodeKind::getFromNodeKind<QualType>();
+  auto TypeKind = ast_type_traits::ASTNodeKind::getFromNodeKind<Type>();
+  if (To.isSame(QualKind)) {
+    return SourceKind.isSame(TypeKind) || SourceKind.isSame(QualKind);
+  }
+  return SourceKind.isBaseOf(To);
+}
+
----------------
klimek wrote:
> This needs a comment or two :)
Done.

http://reviews.llvm.org/D5124






More information about the cfe-commits mailing list