diff options
author | Mike Stump <mrs@apple.com> | 2009-04-29 19:03:13 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-04-29 19:03:13 +0000 |
commit | 19c30c00e5e01e4608a43c7deb504f343f09e46d (patch) | |
tree | 562016df236e451dc15aca58efc9e30c47bf89f2 /lib/Sema/SemaDeclAttr.cpp | |
parent | c887d13b07d72c8e67d1a73a82d3167e866f50e5 (diff) |
Sema and CodeGen support for attributes on blocks. Radar 6441502
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 9e550ba44f..2df4e36cc9 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -408,10 +408,13 @@ static bool HandleCommonNoReturnAttr(Decl *d, const AttributeList &Attr, return false; } - if (!isFunctionOrMethod(d)) { - S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) - << attrName << 0 /*function*/; - return false; + if (!isFunctionOrMethod(d) && !isa<BlockDecl>(d)) { + ValueDecl *VD = dyn_cast<ValueDecl>(d); + if (VD == 0 || !VD->getType()->isBlockPointerType()) { + S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) + << attrName << 0 /*function*/; + return false; + } } return true; |