File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
test/SemaHLSL/Availability Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,9 @@ static bool ShouldDiagnoseAvailabilityInContext(
187187 // For libraries the availability will be checked later in
188188 // DiagnoseHLSLAvailability class once where the specific environment/shader
189189 // stage of the caller is known.
190- if (S.getLangOpts ().HLSL ) {
190+ // We only do this for APIs that are not explicitly deprecated. Any API that
191+ // is explicitly deprecated we always issue a diagnostic on.
192+ if (S.getLangOpts ().HLSL && K != AR_Deprecated) {
191193 if (!S.getLangOpts ().HLSLStrictAvailability ||
192194 (DeclEnv != nullptr &&
193195 S.getASTContext ().getTargetInfo ().getTriple ().getEnvironment () ==
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.2-compute -std=hlsl202x -verify %s
2+
3+ [[deprecated ("Woah!" )]] // expected-note{{'myFn' has been explicitly marked deprecated here}}
4+ void myFn () {}
5+
6+ [[deprecated ("X is bad... chose Y instead" )]] // expected-note{{'X' has been explicitly marked deprecated here}}
7+ static const int X = 5 ;
8+
9+ enum States {
10+ Inactive,
11+ Active,
12+ Bored,
13+ Sleep [[deprecated ("We don't allow sleep anymore!" )]], // expected-note{{'Sleep' has been explicitly marked deprecated here}}
14+ Tired,
15+ };
16+
17+ __attribute__ ((availability (shadermodel, introduced = 6.0 , deprecated = 6.5 )))
18+ void fn65 () {}
19+
20+ __attribute__ ((availability (shadermodel, introduced = 6.0 , deprecated = 6.2 )))
21+ void fn62 () {} // expected-note{{'fn62' has been explicitly marked deprecated here}}
22+
23+ void myOtherFn () {}
24+
25+ void otherFn () {
26+ myFn (); // expected-warning{{'myFn' is deprecated: Woah!}}
27+
28+ int Y = X; // expected-warning{{'X' is deprecated: X is bad... chose Y instead}}
29+
30+ States S = Bored;
31+ S = Sleep; // expected-warning{{'Sleep' is deprecated: We don't allow sleep anymore!}}
32+ S = Tired;
33+
34+ fn65 (); // No warning here because we're targeting 6.2 where this isn't yet deprecated.
35+
36+ fn62 (); // expected-warning{{'fn62' is deprecated: first deprecated in Shader Model 6.2}}
37+ }
You can’t perform that action at this time.
0 commit comments