[all-commits] [llvm/llvm-project] 075e26: [ASTMatchers] Avoid pathological traversal over ne...

Stephen Kelly via All-commits all-commits at lists.llvm.org
Mon Feb 15 19:02:45 PST 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 075e2629b02d194313a069ce1ee9a8d40c7bd66f
      https://github.com/llvm/llvm-project/commit/075e2629b02d194313a069ce1ee9a8d40c7bd66f
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-02-15 (Mon, 15 Feb 2021)

  Changed paths:
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/lib/ASTMatchers/ASTMatchFinder.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

  Log Message:
  -----------
  [ASTMatchers] Avoid pathological traversal over nested lambdas

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

(cherry picked from commit 6f0df3cddb3e3f38df1baa7aa4d743a74bb46688)


  Commit: 94607512357da5c727d210cc34e642156429d19c
      https://github.com/llvm/llvm-project/commit/94607512357da5c727d210cc34e642156429d19c
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-02-15 (Mon, 15 Feb 2021)

  Changed paths:
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

  Log Message:
  -----------
  Ensure that we traverse non-op() method bodys of lambdas

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

(cherry picked from commit 43cc4f15008f8c700497d3d2b7020bfd29f5750f)


  Commit: 8c24a88dee6426ffa98cd820f1c8f4803bec1d86
      https://github.com/llvm/llvm-project/commit/8c24a88dee6426ffa98cd820f1c8f4803bec1d86
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-02-15 (Mon, 15 Feb 2021)

  Changed paths:
    M clang/lib/ASTMatchers/ASTMatchFinder.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

  Log Message:
  -----------
  [ASTMatchers] Fix traversal below range-for elements

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

(cherry picked from commit 79125085f16540579d27c7e4987f63eef9c4aa23)


  Commit: aaf23abe9d57af638644cedbc1ca6132f140a57d
      https://github.com/llvm/llvm-project/commit/aaf23abe9d57af638644cedbc1ca6132f140a57d
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-02-15 (Mon, 15 Feb 2021)

  Changed paths:
    M clang/lib/ASTMatchers/ASTMatchFinder.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

  Log Message:
  -----------
  Fix traversal with hasDescendant into lambdas

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

(cherry picked from commit bb57a3422a09dcdd572ccb42767a0dabb5f966dd)


  Commit: cd25aa9e409e961d64f5fb26bff3882f3a4db2d3
      https://github.com/llvm/llvm-project/commit/cd25aa9e409e961d64f5fb26bff3882f3a4db2d3
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-02-15 (Mon, 15 Feb 2021)

  Changed paths:
    M clang/include/clang/ASTMatchers/ASTMatchers.h
    M clang/lib/ASTMatchers/ASTMatchersInternal.cpp

  Log Message:
  -----------
  [ASTMatchers] Fix definition of decompositionDecl

(cherry picked from commit b10d445307a0f3c7e5522836b4331090aacaf349)


  Commit: e76f4385c2e1f95781584e0ac12a586dece8223a
      https://github.com/llvm/llvm-project/commit/e76f4385c2e1f95781584e0ac12a586dece8223a
  Author: Stephen Kelly <steveire at gmail.com>
  Date:   2021-02-15 (Mon, 15 Feb 2021)

  Changed paths:
    M clang/lib/ASTMatchers/ASTMatchFinder.cpp
    M clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

  Log Message:
  -----------
  [ASTMatchers] Fix matching after generic top-level matcher

With a matcher like

  expr(anyOf(integerLiteral(equals(42)), unless(expr())))

and code such as

  struct B {
    B(int);
  };

  B func1() { return 42; }

the top-level expr() would match each of the nodes which are not spelled
in the source and then ignore-traverse to match the integerLiteral node.
This would result in multiple results reported for the integerLiteral.

Fix that by only running matching logic on nodes which are not skipped
with the top-level matcher.

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

(cherry picked from commit d6a06365cf12bebe20a7d65cf3894608efc089b4)


Compare: https://github.com/llvm/llvm-project/compare/0d6859eb70c0...e76f4385c2e1


More information about the All-commits mailing list