[PATCH] D56892: Add a priority field to availability attributes to prioritize explicit attributes from declaration over attributes from '#pragma clang attribute'

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 06:36:18 PST 2019


aaron.ballman added a comment.

I think the documentation for the attribute should be updated to explain this new behavior, otherwise this will be a very inexplicable feature to users.

One question I have is: will this feature also be needed by other attributes? This seems like a somewhat general problem between explicit attributes, implicit attributes, and attributes added via the pragma. It might not be worth generalizing yet, but I'm curious to know whether we'll need this for things like visibility and type_visibility as well.



================
Comment at: include/clang/Sema/Sema.h:2467
+  /// already has an availability attribute with a lower priority for the
+  /// specified platform.
+  enum AvailabilityPriority : int {
----------------
We should have a comment somewhere (perhaps here) that makes it clear that the priorities we calculate and store on the semantic attribute object are not expected to match values in this enumeration, but instead be treated as a plain integer value. This enumeration is just giving a name to some of the addends used to calculate that value.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56892/new/

https://reviews.llvm.org/D56892





More information about the cfe-commits mailing list