[PATCH] D19689: Add Subjects to NoDebugAttr [NFC]
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 29 10:09:28 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL268065: Add a Subjects line to NoDebugAttr [NFC]. (authored by probinson).
Changed prior to commit:
http://reviews.llvm.org/D19689?vs=55482&id=55618#toc
Repository:
rL LLVM
http://reviews.llvm.org/D19689
Files:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/Sema/attr-nodebug.c
cfe/trunk/test/SemaObjC/attr-nodebug.m
Index: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp
@@ -3572,18 +3572,6 @@
}
static void handleNoDebugAttr(Sema &S, Decl *D, const AttributeList &Attr) {
- if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
- if (!VD->hasGlobalStorage())
- S.Diag(Attr.getLoc(),
- diag::warn_attribute_requires_functions_or_static_globals)
- << Attr.getName();
- } else if (!isFunctionOrMethod(D)) {
- S.Diag(Attr.getLoc(),
- diag::warn_attribute_requires_functions_or_static_globals)
- << Attr.getName();
- return;
- }
-
D->addAttr(::new (S.Context)
NoDebugAttr(Attr.getRange(), S.Context,
Attr.getAttributeSpellingListIndex()));
Index: cfe/trunk/include/clang/Basic/Attr.td
===================================================================
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -973,6 +973,8 @@
def NoDebug : InheritableAttr {
let Spellings = [GCC<"nodebug">];
+ let Subjects = SubjectList<[FunctionLike, ObjCMethod, GlobalVar], WarnDiag,
+ "ExpectedFunctionGlobalVarMethodOrProperty">;
let Documentation = [NoDebugDocs];
}
Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2512,9 +2512,6 @@
def warn_incomplete_encoded_type : Warning<
"encoding of %0 type is incomplete because %1 component has unknown encoding">,
InGroup<DiagGroup<"encode-type">>;
-def warn_attribute_requires_functions_or_static_globals : Warning<
- "%0 only applies to variables with static storage duration and functions">,
- InGroup<IgnoredAttributes>;
def warn_gnu_inline_attribute_requires_inline : Warning<
"'gnu_inline' attribute requires function to be marked 'inline',"
" attribute ignored">,
Index: cfe/trunk/test/Sema/attr-nodebug.c
===================================================================
--- cfe/trunk/test/Sema/attr-nodebug.c
+++ cfe/trunk/test/Sema/attr-nodebug.c
@@ -3,7 +3,7 @@
int a __attribute__((nodebug));
void b() {
- int b __attribute__((nodebug)); // expected-warning {{'nodebug' only applies to variables with static storage duration and functions}}
+ int b __attribute__((nodebug)); // expected-warning {{'nodebug' attribute only applies to functions and global variables}}
}
void t1() __attribute__((nodebug));
Index: cfe/trunk/test/SemaObjC/attr-nodebug.m
===================================================================
--- cfe/trunk/test/SemaObjC/attr-nodebug.m
+++ cfe/trunk/test/SemaObjC/attr-nodebug.m
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+ at interface NSObject
+- (void)doSomething __attribute__((nodebug));
+ at end
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19689.55618.patch
Type: text/x-patch
Size: 3017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160429/f42ab4cc/attachment.bin>
More information about the cfe-commits
mailing list