[clang] 42b1d08 - Revert "[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations"
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 6 13:38:24 PST 2023
Author: ziqingluo-90
Date: 2023-01-06T13:37:13-08:00
New Revision: 42b1d08b955d6cfa0b78ceca62605bddc905461a
URL: https://github.com/llvm/llvm-project/commit/42b1d08b955d6cfa0b78ceca62605bddc905461a
DIFF: https://github.com/llvm/llvm-project/commit/42b1d08b955d6cfa0b78ceca62605bddc905461a.diff
LOG: Revert "[Fix][-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations"
This reverts commit 6d140b952805bd9277fba666520ce46c19f2c637.
This commit may causes `test/SemaCXX/warn-unsafe-buffer-usage.cpp` failure.
Added:
Modified:
clang/lib/Analysis/UnsafeBufferUsage.cpp
Removed:
################################################################################
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index f03fe7505ad4a..d941cf5fe74f5 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -26,7 +26,7 @@ class MatchDescendantVisitor
// Creates an AST visitor that matches `Matcher` on all
// descendants of a given node "n" except for the ones
// belonging to a
diff erent callable of "n".
- MatchDescendantVisitor(const internal::DynTypedMatcher &Matcher,
+ MatchDescendantVisitor(const internal::DynTypedMatcher *Matcher,
internal::ASTMatchFinder *Finder,
internal::BoundNodesTreeBuilder *Builder,
internal::ASTMatchFinder::BindKind Bind)
@@ -89,7 +89,7 @@ class MatchDescendantVisitor
template <typename T> bool match(const T &Node) {
internal::BoundNodesTreeBuilder RecursiveBuilder(*Builder);
- if (Matcher.matches(DynTypedNode::create(Node), Finder,
+ if (Matcher->matches(DynTypedNode::create(Node), Finder,
&RecursiveBuilder)) {
ResultBindings.addMatch(RecursiveBuilder);
Matches = true;
@@ -99,7 +99,7 @@ class MatchDescendantVisitor
return true;
}
- const internal::DynTypedMatcher & Matcher;
+ const internal::DynTypedMatcher *const Matcher;
internal::ASTMatchFinder *const Finder;
internal::BoundNodesTreeBuilder *const Builder;
internal::BoundNodesTreeBuilder ResultBindings;
@@ -108,7 +108,7 @@ class MatchDescendantVisitor
};
AST_MATCHER_P(Stmt, forEveryDescendant, internal::Matcher<Stmt>, innerMatcher) {
- MatchDescendantVisitor Visitor(DynTypedMatcher(innerMatcher), Finder,
+ MatchDescendantVisitor Visitor(new DynTypedMatcher(innerMatcher), Finder,
Builder, ASTMatchFinder::BK_All);
return Visitor.findMatch(DynTypedNode::create(Node));
}
More information about the cfe-commits
mailing list