[PATCH] Split registry matcher resolution into a lookup phase and a construction phase.

Samuel Benzaquen sbenza at google.com
Mon Nov 18 06:50:27 PST 2013



================
Comment at: include/clang/ASTMatchers/Dynamic/Registry.h:40
@@ -33,3 +39,3 @@
   ///
-  /// Consult the registry of known matchers and construct the appropriate
-  /// matcher by name.
+  /// \return An opaque pointer which may be used to refer to the matcher
+  /// constructor, or null if not found.  In that case \c Error will contain the
----------------
If you describe it as an "opaque pointer", I think you should return MatcherCtor* (with the appropriate change in the typedef above).

================
Comment at: include/clang/ASTMatchers/Dynamic/Registry.h:49
@@ -36,3 +48,3 @@
   ///
   /// \param MatcherName The name of the matcher to instantiate.
   ///
----------------
s/MatcherName/Ctor/

================
Comment at: lib/ASTMatchers/Dynamic/Parser.cpp:245
@@ -244,1 +244,3 @@
 
+  MatcherCtor Ctor =
+      S->lookupMatcherCtor(NameToken.Text, NameToken.Range, Error);
----------------
Move this call closer to the first use of Ctor.

================
Comment at: unittests/ASTMatchers/Dynamic/ParserTest.cpp:73
@@ +72,3 @@
+  typedef std::map<std::string, ast_matchers::internal::Matcher<Stmt> >
+  ExpectedMatchersTy;
+  ExpectedMatchersTy ExpectedMatchers;
----------------
Is Ty short for Type?


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



More information about the cfe-commits mailing list