[cfe-commits] r173292 - /cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp

Ted Kremenek kremenek at apple.com
Wed Jan 23 13:12:49 PST 2013


Author: kremenek
Date: Wed Jan 23 15:12:49 2013
New Revision: 173292

URL: http://llvm.org/viewvc/llvm-project?rev=173292&view=rev
Log:
Add missing null check.  Not sure why my tests passed before.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp?rev=173292&r1=173291&r2=173292&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NoReturnFunctionChecker.cpp Wed Jan 23 15:12:49 2013
@@ -102,10 +102,12 @@
 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:





More information about the cfe-commits mailing list