]> granicus.if.org Git - clang/commitdiff
Check if an IdentifierInfo* is null when the FunctionDecl isn't a simple C function.
authorTed Kremenek <kremenek@apple.com>
Tue, 2 Oct 2012 04:36:54 +0000 (04:36 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 2 Oct 2012 04:36:54 +0000 (04:36 +0000)
Fixes <rdar://problem/12355298>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164988 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaChecking.cpp

index 7498d348920404ae6db437921c8ae3a74bdb5666..81be8bfe8f3ad56f9a405c940fa1d19e36bfe10a 100644 (file)
@@ -5510,8 +5510,12 @@ static Expr *findCapturingExpr(Sema &S, Expr *e, RetainCycleOwner &owner) {
   } else if (CallExpr *CE = dyn_cast<CallExpr>(e)) {
     if (CE->getNumArgs() == 1) {
       FunctionDecl *Fn = dyn_cast_or_null<FunctionDecl>(CE->getCalleeDecl());
-      if (Fn && Fn->getIdentifier()->isStr("_Block_copy"))
-        e = CE->getArg(0)->IgnoreParenCasts();
+      if (Fn) {
+        const IdentifierInfo *FnI = Fn->getIdentifier();
+        if (FnI && FnI->isStr("_Block_copy")) {
+          e = CE->getArg(0)->IgnoreParenCasts();
+        }
+      }
     }
   }