[clang] [llvm] [HLSL] Add implicit resource element type concepts to AST (PR #116413)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 17:10:40 PST 2024
================
@@ -472,10 +569,91 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S,
.addDefaultHandleConstructor(S);
}
+Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
+ TemplateTypeParmDecl *T) {
+ ASTContext &Context = S.getASTContext();
+
+ // Obtain the QualType for 'unsigned long'
+ QualType BoolTy = Context.BoolTy;
+
+ // Create a QualType that points to this TemplateTypeParmDecl
+ QualType TType = Context.getTypeDeclType(T);
+
+ // Create a TypeSourceInfo for the template type parameter 'T'
+ TypeSourceInfo *TTypeSourceInfo =
+ Context.getTrivialTypeSourceInfo(TType, NameLoc);
+
+ TypeTraitExpr *TypedResExpr = TypeTraitExpr::Create(
+ Context, BoolTy, NameLoc, UTT_IsTypedResourceElementCompatible,
+ {TTypeSourceInfo}, NameLoc, true);
+
+ TypeTraitExpr *IsIntangibleExpr =
----------------
llvm-beanz wrote:
You don't need to check whether or not it is intangible, you only need to check if it is typed resource element compatible, because all intangible types are not typed resource element compatible.
https://github.com/llvm/llvm-project/pull/116413
More information about the cfe-commits
mailing list