Skip to content

Commit 9610854

Browse files
boomanaiden154Gabor Horvath
authored andcommitted
[Analysis] Make ThreadSafety correctly handle base class destructors (llvm#169593)
1 parent 1eaef91 commit 9610854

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

clang/lib/Analysis/ThreadSafety.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,7 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
26592659
case CFGElement::AutomaticObjectDtor: {
26602660
CFGAutomaticObjDtor AD = BI.castAs<CFGAutomaticObjDtor>();
26612661
const auto *DD = AD.getDestructorDecl(AC.getASTContext());
2662-
if (!DD->hasAttrs())
2662+
if (!DD || !DD->hasAttrs())
26632663
break;
26642664

26652665
LocksetBuilder.handleCall(nullptr, DD,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wthread-safety -Wthread-safety-pointer -Wthread-safety-beta -Wno-thread-safety-negative -fcxx-exceptions -DUSE_CAPABILITY=0 %s
2+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wthread-safety -Wthread-safety-pointer -Wthread-safety-beta -Wno-thread-safety-negative -fcxx-exceptions -DUSE_CAPABILITY=1 %s
3+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 -Wthread-safety -Wthread-safety-pointer -Wthread-safety-beta -Wno-thread-safety-negative -fcxx-exceptions -DUSE_CAPABILITY=0 %s
4+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 -Wthread-safety -Wthread-safety-pointer -Wthread-safety-beta -Wno-thread-safety-negative -fcxx-exceptions -DUSE_CAPABILITY=1 %s
5+
// expected-no-diagnostics
6+
7+
struct foo {
8+
~foo();
9+
};
10+
struct bar : foo {};
11+
struct baz : bar {};
12+
baz foobar(baz a) { return a; }

0 commit comments

Comments
 (0)