No longer warn on this false positive for -Winvalid-noreturn
__attribute__((noreturn)) void fail(); struct A { ~A() __attribute__((noreturn)) { fail(); } }; struct B : A { B() {} }; __attribute__((noreturn)) void test_1() { A a; } // no warning __attribute__((noreturn)) void test_2() { B b; } // false positive warning here
A new method CXXDesctructorDecl:isAnyDestructorNoReturn that checks if any destructor invoked from the destructor is marked no return. This includes base classes, virtual base classes, and members. Then, replace use of FunctionDecl::isNoReturn with this new method when constructing the CFG.