diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-08-07 01:02:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-08-07 01:02:05 +0000 |
commit | 955516e6c7f94e8dd1076c0351742ced9876b16c (patch) | |
tree | 52ec48e7ed6907de9a3cc748cb412c713d11427a | |
parent | c3b4c52a4def71413c9f4c29d5434106820295cb (diff) | |
download | bcm5719-llvm-955516e6c7f94e8dd1076c0351742ced9876b16c.tar.gz bcm5719-llvm-955516e6c7f94e8dd1076c0351742ced9876b16c.zip |
attribute "unused" also applies to functions.
llvm-svn: 54440
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 3f9da3bebe0..54f6579e36c 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -346,11 +346,9 @@ static void HandleUnusedAttr(Decl *d, const AttributeList &Attr, Sema &S) { return; } - VarDecl *VD = dyn_cast<VarDecl>(d); - - if (!VD) { + if (!isa<VarDecl>(d) && !getFunctionProto(d)) { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type, - "unused", "variable"); + "unused", "variable and function"); return; } |