[clang] Handle null dtor decl during consumed analysis (#170180)
See similar PR #169593. This is another case where null was not handled when returned from `getDestructorDecl`.
This commit is contained in:
parent
258cb467e9
commit
d7b5469b39
@ -1354,12 +1354,13 @@ void ConsumedAnalyzer::run(AnalysisDeclContext &AC) {
|
||||
|
||||
case CFGElement::AutomaticObjectDtor: {
|
||||
const CFGAutomaticObjDtor &DTor = B.castAs<CFGAutomaticObjDtor>();
|
||||
const auto *DD = DTor.getDestructorDecl(AC.getASTContext());
|
||||
if (!DD)
|
||||
break;
|
||||
|
||||
SourceLocation Loc = DTor.getTriggerStmt()->getEndLoc();
|
||||
const VarDecl *Var = DTor.getVarDecl();
|
||||
|
||||
Visitor.checkCallability(PropagationInfo(Var),
|
||||
DTor.getDestructorDecl(AC.getASTContext()),
|
||||
Loc);
|
||||
Visitor.checkCallability(PropagationInfo(Var), DD, Loc);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
9
clang/test/SemaCXX/no-warn-consumed-analysis.cpp
Normal file
9
clang/test/SemaCXX/no-warn-consumed-analysis.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify -Wconsumed -fcxx-exceptions -std=c++11 %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
struct foo {
|
||||
~foo();
|
||||
};
|
||||
struct bar : foo {};
|
||||
struct baz : bar {};
|
||||
baz foobar(baz a) { return a; }
|
||||
Loading…
x
Reference in New Issue
Block a user