This is useful to make availability checking work with forward declarations, but there also seem to be other attributes that make sense here.
rdar://43118198
Paths
| Differential D65665
Support for attributes on @class declarations Needs ReviewPublic Authored by erik.pilkington on Aug 2 2019, 10:50 AM.
Details
Summary This is useful to make availability checking work with forward declarations, but there also seem to be other attributes that make sense here. rdar://43118198
Diff Detail Event TimelineComment Actions I don't think I know enough about ObjC semantics to say much about the language design aspects of this patch.
Comment Actions Have you looked through the attributes that can be written on @interfaces and verified that they're all sensible to write on a @class? It's not hard to imagine that *some* of them should be diagnosed when added to a non-definition.
Revision Contents
Diff 213082 clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/Sema.h
clang/lib/Parse/ParseObjc.cpp
clang/lib/Parse/Parser.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/test/CodeGenObjC/objc-asm-attribute-test.m
clang/test/Misc/pragma-attribute-objc.m
clang/test/Parser/attributes.mm
clang/test/SemaObjC/attr-forward-class.m
clang/test/SemaObjC/objc-asm-attribute-neg-test.m
|
Slight preference for using ParsedAttributesWithRange instead when making new interfaces -- we often need the range when trying to prohibit attributes in places, or for other diagnostic purposes.
However, this may not be feasible depending on where you're getting the attributes from (some parts of the parser are still unfortunately deficient in this regard).