[all-commits] [llvm/llvm-project] c359f9: [AST Matchers] Restrict `optionally` matcher to a ...

Yitzhak Mandelbaum via All-commits all-commits at lists.llvm.org
Thu Mar 5 11:49:28 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c359f9537ffb17c4f40a933980ddb515d7ee923b
      https://github.com/llvm/llvm-project/commit/c359f9537ffb17c4f40a933980ddb515d7ee923b
  Author: Yitzhak Mandelbaum <yitzhakm at google.com>
  Date:   2020-03-05 (Thu, 05 Mar 2020)

  Changed paths:
    M clang/docs/LibASTMatchersReference.html
    M clang/include/clang/ASTMatchers/ASTMatchers.h
    M clang/lib/ASTMatchers/ASTMatchersInternal.cpp
    M clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

  Log Message:
  -----------
  [AST Matchers] Restrict `optionally` matcher to a single argument.

Summary:
Currently, `optionally` can take multiple arguments, which commits it to a
particular strategy for those arguments (in this case, "for each"). We limit the
matcher to a single argument, which avoids any potential confusion and
simplifies the implementation. The user can retrieve multiple-argument
optionality, by explicitly using the desired operator (like `forEach`, `anyOf`,
`allOf`, etc.) with all children wrapped in `optionally`.

Reviewers: sbenza, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75556




More information about the All-commits mailing list