diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-01-23 21:00:27 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-01-23 21:00:27 +0000 |
commit | a5b6469a55fb8796353b073f6c12694b0adc77c2 (patch) | |
tree | 8d6058f8d1aa8531ccf7838fe8fcbcd96adaf9a3 /lib | |
parent | e438bac04165937036e41c321fa0d5567d1e520c (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp b/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp index 37d91138f0..351eabf8df 100644 --- a/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp +++ b/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:] |