[clang] [HLSL] Add implicit resource element type concepts to AST (PR #116413)

Joshua Batista via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 10:48:19 PST 2024


================
@@ -323,19 +325,114 @@ struct TemplateParameterListBuilder {
     return *this;
   }
 
-  BuiltinTypeDeclBuilder &finalizeTemplateArgs() {
+  // The concept specialization expression (CSE) constructed in
+  // constructConceptSpecializationExpr is constructed so that it
+  // matches the CSE that is constructed when parsing the below C++ code:
+  //
+  // template<typename T>
+  // concept is_typed_resource_element_compatible = sizeof(T) <= 16;
----------------
bob80905 wrote:

The purpose of this change is to just verify concept validation works. A very simple constraint expression is used, size <= 16 bytes. This is tested by inspecting the AST, and seeing the CSE in the AST. It's also verified by running simple tests that fail when size > 16, and pass when <= 16. 
I wanted to keep things separate because I want the PR to be kept as atomic as possible. This PR accomplishes the single purpose of introducing concept infrastructure and testing concept validation.
I intend the next and final PR to finalize the constraint expression, which will involve adding a bunch of tests that test each corner case of the constraint expression. This will also be a sizeable PR, which I figured would be best kept separate.

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


More information about the cfe-commits mailing list