File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -417,6 +417,8 @@ Improvements to Clang's diagnostics
417417 or continue (#GH166013)
418418- Clang now emits a diagnostic in case `vector_size ` or `ext_vector_type `
419419 attributes are used with a negative size (#GH165463).
420+ - Clang no longer emits ``-Wmissing-noreturn `` for virtual methods where
421+ the function body consists of a `throw ` expression (#GH167247).
420422
421423Improvements to Clang's time-trace
422424----------------------------------
Original file line number Diff line number Diff line change @@ -1966,8 +1966,9 @@ static bool isKnownToAlwaysThrow(const FunctionDecl *FD) {
19661966 if (const auto *EWC = dyn_cast<ExprWithCleanups>(OnlyStmt)) {
19671967 OnlyStmt = EWC->getSubExpr ();
19681968 }
1969- // Check if the only statement is a throw expression.
1970- return isa<CXXThrowExpr>(OnlyStmt);
1969+
1970+ const auto *MD = dyn_cast<CXXMethodDecl>(FD);
1971+ return isa<CXXThrowExpr>(OnlyStmt) && !(MD && MD->isVirtual ());
19711972}
19721973
19731974void clang::inferNoReturnAttr (Sema &S, const Decl *D) {
Original file line number Diff line number Diff line change @@ -53,3 +53,12 @@ int gnu_throws() {
5353int cxx11_throws () {
5454 throw 0 ;
5555}
56+
57+ namespace GH167247 {
58+ struct S {
59+ virtual ~S () = default ;
60+ virtual void m () {
61+ throw std::runtime_error (" This method always throws" );
62+ }
63+ };
64+ }
You can’t perform that action at this time.
0 commit comments