[PATCH] Improve -Winvalid-noreturn
Richard Trieu
rtrieu at google.com
Fri May 1 18:56:04 PDT 2015
No longer warn on this false positive for -Winvalid-noreturn
```
__attribute__((noreturn)) void fail();
struct A {
~A() __attribute__((noreturn)) { fail(); }
};
struct B {
B() {}
~B() __attribute__((noreturn)) { fail(); }
};
__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.
http://reviews.llvm.org/D9454
Files:
include/clang/AST/DeclCXX.h
lib/AST/DeclCXX.cpp
lib/Analysis/CFG.cpp
test/SemaCXX/attr-noreturn.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9454.24852.patch
Type: text/x-patch
Size: 6551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150502/cb11c184/attachment.bin>
More information about the cfe-commits
mailing list