diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-01-06 01:23:10 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-01-06 01:23:10 +0000 |
commit | a0b2ba1d0ec27240f922c95b5acd8df905e3d3e0 (patch) | |
tree | f0a376e75b0ccaf43e84818d73e16b99f5d1439f /lib/Sema/SemaDeclAttr.cpp | |
parent | 84e49865cbc2392787efcf2211ec53a947128a9e (diff) |
Minor refactoring of sentinel warning on blocks. Add a test for this warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 0b8e9fa2d0..cdba6208db 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1878,10 +1878,11 @@ static void handleSentinelAttr(Sema &S, Decl *D, const AttributeList &Attr) { S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 0; return; } - } else if (isa<BlockDecl>(D)) { - // Note! BlockDecl is typeless. Variadic diagnostics will be issued by the - // caller. - ; + } else if (BlockDecl *BD = dyn_cast<BlockDecl>(D)) { + if (!BD->isVariadic()) { + S.Diag(Attr.getLoc(), diag::warn_attribute_sentinel_not_variadic) << 1; + return; + } } else if (const VarDecl *V = dyn_cast<VarDecl>(D)) { QualType Ty = V->getType(); if (Ty->isBlockPointerType() || Ty->isFunctionPointerType()) { |