summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp8
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;
OpenPOWER on IntegriCloud