[all-commits] [llvm/llvm-project] d6a063: [ASTMatchers] Fix matching after generic top-level...
Stephen Kelly via All-commits
all-commits at lists.llvm.org
Tue Feb 2 05:32:19 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d6a06365cf12bebe20a7d65cf3894608efc089b4
https://github.com/llvm/llvm-project/commit/d6a06365cf12bebe20a7d65cf3894608efc089b4
Author: Stephen Kelly <steveire at gmail.com>
Date: 2021-02-02 (Tue, 02 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
More information about the All-commits
mailing list