llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-analysis Author: None (macurtis-amd) <details> <summary>Changes</summary> See similar PR #<!-- -->169593. This is another case where null was not be handled when returned from `getDestructorDecl`. --- Full diff: https://github.com/llvm/llvm-project/pull/170180.diff 2 Files Affected: - (modified) clang/lib/Analysis/Consumed.cpp (+5-4) - (added) clang/test/SemaCXX/no-warn-consumed-analysis.cpp (+9) ``````````diff diff --git a/clang/lib/Analysis/Consumed.cpp b/clang/lib/Analysis/Consumed.cpp index f2c714ab1528d..efc7098e52042 100644 --- a/clang/lib/Analysis/Consumed.cpp +++ b/clang/lib/Analysis/Consumed.cpp @@ -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; } diff --git a/clang/test/SemaCXX/no-warn-consumed-analysis.cpp b/clang/test/SemaCXX/no-warn-consumed-analysis.cpp new file mode 100644 index 0000000000000..59d503661a0b1 --- /dev/null +++ b/clang/test/SemaCXX/no-warn-consumed-analysis.cpp @@ -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; } `````````` </details> https://github.com/llvm/llvm-project/pull/170180 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
