From 356b63a6668d8b010b53921941576189ee4bd459 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 7 Aug 2008 01:02:05 +0000 Subject: [PATCH] attribute "unused" also applies to functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54440 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaDeclAttr.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 3f9da3bebe..54f6579e36 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -346,11 +346,9 @@ static void HandleUnusedAttr(Decl *d, const AttributeList &Attr, Sema &S) { return; } - VarDecl *VD = dyn_cast(d); - - if (!VD) { + if (!isa(d) && !getFunctionProto(d)) { S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type, - "unused", "variable"); + "unused", "variable and function"); return; } -- 2.40.0