Some HLSL functionality is gated on the target shader model version.
Enabling the use of availability markup allows us to diagnose
availability issues easily in the frontend.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaAvailability.cpp | ||
---|---|---|
201 | This should jsut be a 'case' label added above, we are already switching on getOS. | |
clang/test/SemaHLSL/AvailabilityMarkup.hlsl | ||
11 | Not sure how I feel about us testing the headers AND functionality in the same place. @aaron.ballman : Does this seem inappropriate to you? |
Updating based on feedback from @erichkeane. Thank you for the fast feedback!
- Moved ShaderModel check into a switch case.
- Added additional self-contained test case with more variations.
Besides the request for re-organizing the the test files, LGTM.
clang/test/SemaHLSL/AvailabilityMarkup.hlsl | ||
---|---|---|
15 | So minor thing, and one that I am going to start pushing for more, is better organization of 'expected-diagnostics'. I think they should better reflect the order and 'cause' of the diagnostic, particularly with notes. So something like: // expected-warning@+3 {{... only available ...}} // expected-note@#FN60_LOC {{ marked as being introduced...}} // expected-note@+1{{enclose...}} Then on line 5, add the comment: // FN60 I have this preference because it makes it more clear to the reader where the notes come from. I realize this is a new direction, and perhaps pushing my ability to request, but I'd still appreciate it happening here (I WILL be pushing for it on template reviews, where I think it is even MORE beneficial, thanks to 'instantiation of' diagnostics, and I have the authority to demand it :) ). | |
clang/test/SemaHLSL/WaveBuiltinAvailability.hlsl | ||
10 | Same here, though perhaps less-so. You can use @hlsl_intrinsics.h:14 I believe to specify the line as well (which would be nice!) but keeping the diagnostics in 'emitted order' is more important to me. |
clang/test/SemaHLSL/AvailabilityMarkup.hlsl | ||
---|---|---|
15 | I was completely unaware of the ability to create labels like that. That's awesome. I'll update the tests. |
Still looks good to me, no nits. As far as using the bookmarks, I tend to use them for things that are 'far away' instead of 'right here', and stick to the @+/@- bits for 'local' ones.
clang/test/SemaHLSL/AvailabilityMarkup.hlsl | ||
---|---|---|
14 | Your preference here, but the @+3 here is acceptable when they are 'local'. I have no preference either way. |
This should jsut be a 'case' label added above, we are already switching on getOS.