[PATCH] D42213: [ASTMatchers] [NFC] Fix code examples

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 19 12:00:07 PST 2018

MaskRay added a comment.

I am also not sure about this function:  line 3548

  /// \brief Matches \c FunctionDecls and \c FunctionProtoTypes that have a
  /// specific parameter count.
  /// Given
  /// \code
  ///   void f(int i) {}
  ///   void g(int i, int j) {}
  ///   void h(int i, int j);
  ///   void j(int i);
  ///   void k(int x, int y, int z, ...);
  /// \endcode
  /// functionDecl(parameterCountIs(2))
  ///   matches void g(int i, int j) {}
  /// functionProtoType(parameterCountIs(2))
  ///   matches void h(int i, int j)
  /// functionProtoType(parameterCountIs(3))
  ///   matches void k(int x, int y, int z, ...);

Both `functionDecl` and `functionProtoType` match these functions as long as the parameter count is matched.

  % echo 'match functionDecl()'|clang-query =(printf 'void f(){}') -- -xc++
  % echo 'match functionProtoType()'|clang-query =(printf 'void f(){}') -- -xc++

  rC Clang


More information about the cfe-commits mailing list