]> granicus.if.org Git - clang/commitdiff
Minor tweak to support format attribute on blocks. No change in functionality.
authorFariborz Jahanian <fjahanian@apple.com>
Mon, 18 May 2009 17:39:25 +0000 (17:39 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Mon, 18 May 2009 17:39:25 +0000 (17:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72020 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp

index 1cdca22242bfb46a71c71610bdaa6643e21b8d1d..2c2e4d3c0f1860b77a5a4b7bb451723182a6e699 100644 (file)
@@ -24,7 +24,7 @@ using namespace clang;
 //  Helper functions
 //===----------------------------------------------------------------------===//
 
-static const FunctionType *getFunctionType(Decl *d) {
+static const FunctionType *getFunctionType(Decl *d, bool blocksToo = true) {
   QualType Ty;
   if (ValueDecl *decl = dyn_cast<ValueDecl>(d))
     Ty = decl->getType();
@@ -37,7 +37,7 @@ static const FunctionType *getFunctionType(Decl *d) {
   
   if (Ty->isFunctionPointerType())
     Ty = Ty->getAsPointerType()->getPointeeType();
-  else if (Ty->isBlockPointerType())
+  else if (blocksToo && Ty->isBlockPointerType())
     Ty = Ty->getAsBlockPointerType()->getPointeeType();
 
   return Ty->getAsFunctionType();
@@ -50,7 +50,7 @@ static const FunctionType *getFunctionType(Decl *d) {
 /// type (function or function-typed variable) or an Objective-C
 /// method.
 static bool isFunctionOrMethod(Decl *d) {
-  return getFunctionType(d) || isa<ObjCMethodDecl>(d);
+  return getFunctionType(d, false) || isa<ObjCMethodDecl>(d);
 }
 
 /// isFunctionOrMethodOrBlock - Return true if the given decl has function