================ @@ -1402,6 +1402,29 @@ def CXX11NoReturn : InheritableAttr { let Documentation = [CXX11NoReturnDocs]; } +def NoLock : DeclOrTypeAttr { + let Spellings = [CXX11<"clang", "nolock">, + C23<"clang", "nolock">, + GNU<"clang_nolock">]; + + // Subjects - not needed? + //let Subjects = SubjectList<[FunctionLike, Block, TypedefName], ErrorDiag>; ---------------- dougsonos wrote:
I was cribbing from AnnotateType which also has no Subjects. I added these tests, which seem to indicate that type attributes have some built-in defense. ``` int nl_var [[clang::nolock]]; // expected-warning {{ 'nolock' only applies to function types; type here is 'int' }} struct nl_struct {} [[clang::nolock]]; // expected-warning {{ attribute 'nolock' is ignored, place it after "struct" to apply attribute to type declaration }} struct [[clang::nolock]] nl_struct2 {}; // expected-error {{ 'nolock' attribute cannot be applied to a declaration }} ``` https://github.com/llvm/llvm-project/pull/84983 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits