diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-15 20:33:25 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-05-15 20:33:25 +0000 |
commit | daf0415583e33d5d279197c65e9227c1ed92474b (patch) | |
tree | 2f0bbb1fd3db3edb7e166dabbcf0c884f214f7b2 /lib/Sema/SemaDeclAttr.cpp | |
parent | e28be4386b3b2af45462339fc04c0924ffa78e93 (diff) |
This patch finishes off the sentinel attribute handling for
blocks and function pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index c253b40bfe..f5b6595b18 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -726,11 +726,9 @@ static void HandleSentinelAttr(Decl *d, const AttributeList &Attr, Sema &S) { ; } else if (const VarDecl *V = dyn_cast<VarDecl>(d)) { QualType Ty = V->getType(); - if (Ty->isBlockPointerType()) { - const BlockPointerType *BPT = Ty->getAsBlockPointerType(); - QualType FnType = BPT->getPointeeType(); - const FunctionType *FT = FnType->getAsFunctionType(); - assert(FT && "Block has non-function type?"); + if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) { + const FunctionType *FT = Ty->isFunctionPointerType() ? getFunctionType(d) + : Ty->getAsBlockPointerType()->getPointeeType()->getAsFunctionType(); if (!cast<FunctionProtoType>(FT)->isVariadic()) { S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic); return; |