Skip to content

Commit c68a9b3

Browse files
rniwaKornevNikita
authored andcommitted
[webkit.UncountedLambdaCapturesChecker] Fix debug assertion failure. (#117090)
Only call getThisType() on an instance method.
1 parent 918e91e commit c68a9b3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class UncountedLambdaCapturesChecker
5151

5252
bool TraverseCXXMethodDecl(CXXMethodDecl *CXXMD) override {
5353
llvm::SaveAndRestore SavedDecl(ClsType);
54-
ClsType = CXXMD->getThisType();
54+
if (CXXMD && CXXMD->isInstance())
55+
ClsType = CXXMD->getThisType();
5556
return DynamicRecursiveASTVisitor::TraverseCXXMethodDecl(CXXMD);
5657
}
5758

clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.UncountedLambdaCapturesChecker -verify %s
22

3+
struct A {
4+
static void b();
5+
};
6+
37
struct RefCountable {
48
void ref() {}
59
void deref() {}

0 commit comments

Comments
 (0)