[PATCH] ASTMatchers: Add a matcher to detect whether a decl or stmt is inside a template instantiation.

Alexander Kornienko alexfh at google.com
Mon Sep 1 09:14:23 PDT 2014


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2970
@@ -2969,1 +2969,3 @@
 
+/// \brief Matches declarations inside of a template instantiation, even if the
+/// decl is the instantiation.
----------------
I find this comment somewhat hard to understand. I'd say that this matches declarations that are template instantiations or are inside template instantiations.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2998
@@ +2997,3 @@
+/// \endcode
+/// declStmt(isInstantiated())
+///   matches 'int i;' and 'unsigned i'.
----------------
Did you mean isInTemplateInstantiation (here and below)?

================
Comment at: lib/ASTMatchers/Dynamic/Registry.cpp:245
@@ -244,2 +244,3 @@
   REGISTER_MATCHER(isInteger);
+  REGISTER_MATCHER(isInTemplateInstantiation);
   REGISTER_MATCHER(isListInitialization);
----------------
Why do you register only one matcher?

http://reviews.llvm.org/D5085






More information about the cfe-commits mailing list