-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[analyzer] Check the safety of the object argument in a member functi…
…on call. (#81400) This PR makes alpha.webkit.UncountedCallArgsChecker eplicitly check the safety of the object argument in a member function call. It also removes the exemption of local variables from this checker so that each local variable's safety is checked if it's used in a function call instead of relying on the local variable checker to find those since local variable checker currently has exemption for "for" and "if" statements.
- Loading branch information
Showing
2 changed files
with
63 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s | ||
|
||
#include "mock-types.h" | ||
|
||
class RefCounted { | ||
public: | ||
void ref() const; | ||
void deref() const; | ||
void someFunction(); | ||
}; | ||
|
||
RefCounted* refCountedObj(); | ||
|
||
void test() | ||
{ | ||
refCountedObj()->someFunction(); | ||
// expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} | ||
} |