Add missing null check. Not sure why my tests passed before.

llvm-svn: 173292
This commit is contained in:
Ted Kremenek 2013-01-23 21:12:49 +00:00
parent 54cd3c6811
commit 5b4500b43a
1 changed files with 6 additions and 4 deletions

View File

@ -102,10 +102,12 @@ 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;
if (const ObjCMethodDecl *MD = Msg.getDecl()) {
MD = MD->getCanonicalDecl();
if (MD->hasAttr<AnalyzerNoReturnAttr>()) {
C.generateSink();
return;
}
}
// HACK: This entire check is to handle two messages in the Cocoa frameworks: