aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

This turns out to be a bit of a mess: Alias and NoDebug use the same diagnostic 
kind text, neither of which match the actual subject list. Alias doesn't 
appertain to an obj-c method or property. NoDebug doesn't appertain to an obj-c 
property. The diagnostic text for that diagnostic kind doesn't match the 
subject list it is describing in either case. And the diagnostic text talks 
about "global variables" when what it really means are "variables that have 
global *storage*" and so static storage duration is a bit more accurate than 
"global variable" which implies that the following should diagnose:

  void f() {
    static int i __attribute__((nodebug));
  }

I have a WIP patch (http://reviews.llvm.org/D18768) that will hopefully make 
this situation better. Your current changes will add a bit of overhead to my 
refactoring, but it's a drop in the bucket compared to the other diagnostic 
wording changes, so I'm not overly concerned. I think the patch LGTM despite my 
comments.


================
Comment at: include/clang/Basic/Attr.td:977
@@ -976,1 +976,3 @@
+  let Subjects = SubjectList<[FunctionLike, ObjCMethod, GlobalVar], WarnDiag,
+                              "ExpectedFunctionGlobalVarMethodOrProperty">;
   let Documentation = [NoDebugDocs];
----------------
It's really strange that the diagnostic kind is 
`ExpectedFunctionGlobalVarMethodOrProperty` but the subject list does not have 
objective-c properties. It's even more strange that this diagnostic kind 
corresponds to the diagnostic text "functions and global variables" without 
mention of objective-c methods or properties. I see that the Alias attribute 
suffers from this same discombobulation.

================
Comment at: test/Sema/attr-nodebug.c:6
@@ -5,3 +5,3 @@
 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}}
 }
----------------
Global variables is a misnomer though since this really applies to variables 
with static storage duration (including local variables).


http://reviews.llvm.org/D19689



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to