]> granicus.if.org Git - clang/commitdiff
Look through block pointers and ObjC object pointers
authorMatt Beaumont-Gay <matthewbg@google.com>
Thu, 5 May 2011 00:59:35 +0000 (00:59 +0000)
committerMatt Beaumont-Gay <matthewbg@google.com>
Thu, 5 May 2011 00:59:35 +0000 (00:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130906 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/Sema.cpp

index c47827153d0b6be8655e2320775ba1adae942e66..a994133afeea0392d1d8b13f929dac9a28c45035 100644 (file)
@@ -812,10 +812,9 @@ bool Sema::isExprCallable(const Expr &E, QualType &ZeroArgCallReturnTy,
   // but we can at least check if the type is "function of 0 arguments".
   QualType ExprTy = E.getType();
   const FunctionType *FunTy = NULL;
-  if (const PointerType *Ptr = ExprTy->getAs<PointerType>())
-    FunTy = Ptr->getPointeeType()->getAs<FunctionType>();
-  else if (const ReferenceType *Ref = ExprTy->getAs<ReferenceType>())
-    FunTy = Ref->getPointeeType()->getAs<FunctionType>();
+  QualType PointeeTy = ExprTy->getPointeeType();
+  if (!PointeeTy.isNull())
+    FunTy = PointeeTy->getAs<FunctionType>();
   if (!FunTy)
     FunTy = ExprTy->getAs<FunctionType>();
   if (!FunTy && ExprTy == Context.BoundMemberTy) {