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

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 13:53:49 PST 2019


erik.pilkington added a comment.

This seems pretty reasonable to me. I agree that a more general mechanism to override #pca (/implicit) attributes would be pretty useful, but I guess there is no need to jump the gun on that.



================
Comment at: include/clang/Sema/Sema.h:2471
+    /// declaration.
+    AP_Explicit,
+
----------------
Maybe add `= 0` (and `=1` and `=2`) explicitly to indicate that their relative values matter here.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:2479
+  int PriorityModifier =
+      AL.isPragmaClangAttribute() ? Sema::AP_PragmaClangAttribute : 0;
+  AvailabilityAttr *NewAttr = S.mergeAvailabilityAttr(
----------------
Use AP_Explicit here instead of 0?


================
Comment at: lib/Sema/SemaDeclAttr.cpp:2483
+      Deprecated.Version, Obsoleted.Version, IsUnavailable, Str, IsStrict,
+      Replacement, Sema::AMK_None, PriorityModifier + Sema::AP_Explicit, Index);
   if (NewAttr)
----------------
... And the avoid adding it back on here?


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