[clang] [Clang][HLSL] Add environment parameter to availability attribute (PR #89809)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 25 18:20:21 PDT 2024


================
@@ -3859,7 +3862,7 @@ def warn_availability_fuchsia_unavailable_minor : Warning<
   InGroup<Availability>;
 
 def warn_unguarded_availability :
-  Warning<"%0 is only available on %1 %2 or newer">,
+  Warning<"%0 %select{is only|is not}5 available %select{|in %4 environment }3on %1 %2 %select{or newer|}5">,
----------------
hekota wrote:

If the API is available in higher version the warning will always be:

"%0 is only available on %1 %2 or newer"

The other formulation is only used when the API is not available in any future version for the target environment. This happens when there is an attribute narrowing down the availability to specific environment that is different from the current one. I kept the message under one ID so it can be turned on/off with `-Wunguarded-availability-new`.

https://github.com/llvm/llvm-project/pull/89809


More information about the cfe-commits mailing list