[llvm-branch-commits] [cfe-branch] r155120 - /cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchersMacros.h

Manuel Klimek klimek at google.com
Thu Apr 19 04:46:43 PDT 2012


Author: klimek
Date: Thu Apr 19 06:46:43 2012
New Revision: 155120

URL: http://llvm.org/viewvc/llvm-project?rev=155120&view=rev
Log:
Adding a description for how to add matchers to a user visible namespace.


Modified:
    cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchersMacros.h

Modified: cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchersMacros.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchersMacros.h?rev=155120&r1=155119&r2=155120&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchersMacros.h (original)
+++ cfe/branches/tooling/include/clang/ASTMatchers/ASTMatchersMacros.h Thu Apr 19 06:46:43 2012
@@ -20,6 +20,18 @@
 //  to only have the functions (which is all the user cares about) in the
 //  'ast_matchers' namespace and hide the boilerplate.
 //
+//  To define a matcher in user code, always put it into the clang::ast_matchers
+//  namespace and refer to the internal types via the 'internal::':
+//
+//  namespace clang {
+//  namespace ast_matchers {
+//  AST_MATCHER_P(MemberExpr, Member,
+//                internal::Matcher<ValueDecl>, InnerMatcher) {
+//    return InnerMatcher.matches(*Node.getMemberDecl(), Finder, Builder);
+//  }
+//  } // end namespace ast_matchers
+//  } // end namespace clang
+//
 //===----------------------------------------------------------------------===//
 
 #ifndef LLVM_CLANG_AST_MATCHERS_AST_MATCHERS_MACROS_H





More information about the llvm-branch-commits mailing list