Skip to content

Commit

Permalink
[alpha.webkit.UncountedCallArgsChecker] Treat (foo())->bar() like foo…
Browse files Browse the repository at this point in the history
…()->bar(). (#91052)
  • Loading branch information
rniwa authored May 6, 2024
1 parent 29d447a commit b86accc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ tryToFindPtrOrigin(const Expr *E, bool StopAtFirstRefCountedObj) {
E = tempExpr->getSubExpr();
continue;
}
if (auto *tempExpr = dyn_cast<ParenExpr>(E)) {
E = tempExpr->getSubExpr();
continue;
}
if (auto *cast = dyn_cast<CastExpr>(E)) {
if (StopAtFirstRefCountedObj) {
if (auto *ConversionFunc =
Expand Down
11 changes: 11 additions & 0 deletions clang/test/Analysis/Checkers/WebKit/call-args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,17 @@ namespace default_arg {
}
}

namespace cxx_member_func {
Ref<RefCountable> provideProtected();
void foo() {
provide()->trivial();
provide()->method();
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
provideProtected()->method();
(provideProtected())->method();
};
}

namespace cxx_member_operator_call {
// The hidden this-pointer argument without a corresponding parameter caused couple bugs in parameter <-> argument attribution.
struct Foo {
Expand Down

0 comments on commit b86accc

Please sign in to comment.