summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-01-23 21:00:27 +0000
committerTed Kremenek <kremenek@apple.com>2013-01-23 21:00:27 +0000
commit54cd3c681104cc47967650387d0081f4ef814499 (patch)
tree50ade0d503e89be0d87ceea068cd1dd2e50ac406 /clang/lib
parent39e2738c8b846a32677bb23baed6367692cf45ac (diff)
downloadbcm5719-llvm-54cd3c681104cc47967650387d0081f4ef814499.tar.gz
bcm5719-llvm-54cd3c681104cc47967650387d0081f4ef814499.zip
Honor attribute 'analyzer_noreturn' on Objective-C methods.
This isn't likely a full solution, but it catches the common cases and can be refined over time. Fixes <rdar://problem/11634353>. llvm-svn: 173291
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
index 37d91138f06..351eabf8df3 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
@@ -101,6 +101,13 @@ static bool END_WITH_NULL isMultiArgSelector(const Selector *Sel, ...) {
void NoReturnFunctionChecker::checkPostObjCMessage(const ObjCMethodCall &Msg,
CheckerContext &C) const {
+ // Check if the method is annotated with analyzer_noreturn.
+ const ObjCMethodDecl *MD = Msg.getDecl()->getCanonicalDecl();
+ if (MD->hasAttr<AnalyzerNoReturnAttr>()) {
+ C.generateSink();
+ return;
+ }
+
// HACK: This entire check is to handle two messages in the Cocoa frameworks:
// -[NSAssertionHandler
// handleFailureInMethod:object:file:lineNumber:description:]
OpenPOWER on IntegriCloud