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 | 0aa5c4565d822e77c73a815fedf87cd2bc825ec9 (patch) | |
tree | a0e34fed57968db0d307284d55ef7cb1460b66e1 /clang/lib/Sema/SemaDeclAttr.cpp | |
parent | 2cf4387931787df36699e976d811003d89ce5aff (diff) | |
download | bcm5719-llvm-0aa5c4565d822e77c73a815fedf87cd2bc825ec9.tar.gz bcm5719-llvm-0aa5c4565d822e77c73a815fedf87cd2bc825ec9.zip |
This patch finishes off the sentinel attribute handling for
blocks and function pointers.
llvm-svn: 71888
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c253b40bfee..f5b6595b180 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/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; |