https://github.com/bob80905 created https://github.com/llvm/llvm-project/pull/116407
None >From 68985e64694b0f6e0e779d4711bbff8afb3fe6b2 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 10 Oct 2024 14:31:25 -0700 Subject: [PATCH 01/19] ConceptSpecializationExpr shows up in AST!!! --- clang/include/clang/Sema/HLSLExternalSemaSource.h | 2 ++ clang/lib/AST/DeclTemplate.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Sema/HLSLExternalSemaSource.h b/clang/include/clang/Sema/HLSLExternalSemaSource.h index 3c7495e66055dc..0266bc0f8b336e 100644 --- a/clang/include/clang/Sema/HLSLExternalSemaSource.h +++ b/clang/include/clang/Sema/HLSLExternalSemaSource.h @@ -47,6 +47,8 @@ class HLSLExternalSemaSource : public ExternalSemaSource { using ExternalASTSource::CompleteType; /// Complete an incomplete HLSL builtin type void CompleteType(TagDecl *Tag) override; + + ConceptDecl *getTypedBufferConceptDecl(Sema &S, CXXRecordDecl *Decl); }; } // namespace clang diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index a221d619672b38..4a185aedf825de 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -1071,10 +1071,10 @@ ConceptDecl *ConceptDecl::Create(ASTContext &C, DeclContext *DC, TemplateParameterList *Params, Expr *ConstraintExpr) { bool Invalid = AdoptTemplateParameterList(Params, DC); - auto *TD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr); + auto *CD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr); if (Invalid) - TD->setInvalidDecl(); - return TD; + CD->setInvalidDecl(); + return CD; } ConceptDecl *ConceptDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { >From 44b662c59077d1fca6f8a3629a1589588db84942 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 10 Oct 2024 15:51:23 -0700 Subject: [PATCH 02/19] CSE is in the right spot in the AST --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index d90a7d3c697a04..f39954d1ff7cd9 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -414,13 +414,13 @@ struct TemplateParameterListBuilder { ConceptSpecializationExpr *CSE = ConceptSpecializationExpr::Create(Context, CR, ImplicitCSEDecl, &CS); - return CSE; } BuiltinTypeDeclBuilder &finalizeTemplateArgs(ConceptDecl *CD = nullptr) { if (Params.empty()) return Builder; + ConceptSpecializationExpr *CSE = CD ? constructConceptSpecializationExpr(S, CD) : nullptr; >From 7df0434530083fbcc9473528229c27f192e5fe93 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 10 Oct 2024 17:55:46 -0700 Subject: [PATCH 03/19] templateArg is aligned correctly on the AST --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index f39954d1ff7cd9..1760e2e7738be2 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -342,6 +342,7 @@ struct TemplateParameterListBuilder { RWBuffer<int> Buf; } +<<<<<<< HEAD When dumping the AST and filtering for "RWBuffer", the resulting AST structure is what we're trying to construct below, specifically the CSE portion. >From cff6af2700d61dc9a9821b1b5e037662f5b2b5ba Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Tue, 15 Oct 2024 11:42:26 -0700 Subject: [PATCH 04/19] template arguments are in the right spot! --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index 1760e2e7738be2..9f5532cfb8b264 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -342,7 +342,6 @@ struct TemplateParameterListBuilder { RWBuffer<int> Buf; } -<<<<<<< HEAD When dumping the AST and filtering for "RWBuffer", the resulting AST structure is what we're trying to construct below, specifically the CSE portion. @@ -446,6 +445,9 @@ struct TemplateParameterListBuilder { QualType T = Builder.Template->getInjectedClassNameSpecialization(); T = S.Context.getInjectedClassNameType(Builder.Record, T); + ArrayRef<TemplateArgument> TempArgs = + Builder.Template->getInjectedTemplateArgs(); + return Builder; } }; @@ -460,7 +462,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addSimpleTemplateParams( Sema &S, ArrayRef<StringRef> Names, ConceptDecl *CD = nullptr) { TemplateParameterListBuilder Builder = this->addTemplateArgumentList(S); for (StringRef Name : Names) - Builder.addTypeParameter(Name); + Builder.addTypenameTypeParameter(Name); return Builder.finalizeTemplateArgs(CD); } >From 93ccc1d8bd23947f4eb777e08afb362e7e8b1cc2 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Wed, 16 Oct 2024 12:48:09 -0700 Subject: [PATCH 05/19] remove useless function --- clang/include/clang/Sema/HLSLExternalSemaSource.h | 2 -- clang/lib/Sema/HLSLExternalSemaSource.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/clang/include/clang/Sema/HLSLExternalSemaSource.h b/clang/include/clang/Sema/HLSLExternalSemaSource.h index 0266bc0f8b336e..3c7495e66055dc 100644 --- a/clang/include/clang/Sema/HLSLExternalSemaSource.h +++ b/clang/include/clang/Sema/HLSLExternalSemaSource.h @@ -47,8 +47,6 @@ class HLSLExternalSemaSource : public ExternalSemaSource { using ExternalASTSource::CompleteType; /// Complete an incomplete HLSL builtin type void CompleteType(TagDecl *Tag) override; - - ConceptDecl *getTypedBufferConceptDecl(Sema &S, CXXRecordDecl *Decl); }; } // namespace clang diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index 9f5532cfb8b264..132aad07cf0acd 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -462,7 +462,7 @@ BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addSimpleTemplateParams( Sema &S, ArrayRef<StringRef> Names, ConceptDecl *CD = nullptr) { TemplateParameterListBuilder Builder = this->addTemplateArgumentList(S); for (StringRef Name : Names) - Builder.addTypenameTypeParameter(Name); + Builder.addTypeParameter(Name); return Builder.finalizeTemplateArgs(CD); } >From 6ca40b81216a66576192a034bf1a044b029ae18b Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Wed, 16 Oct 2024 13:40:15 -0700 Subject: [PATCH 06/19] some variable renaming, function rearranging --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 103 +++++++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index 132aad07cf0acd..fbf7dc9fb0901b 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -298,11 +298,12 @@ struct TemplateParameterListBuilder { BuiltinTypeDeclBuilder &Builder; Sema &S; llvm::SmallVector<NamedDecl *> Params; + TemplateParameterListBuilder(Sema &S, BuiltinTypeDeclBuilder &RB) : Builder(RB), S(S) {} - ~TemplateParameterListBuilder() { finalizeTemplateArgs(); } + ~TemplateParameterListBuilder() { finalizeTemplateArgs(nullptr); } TemplateParameterListBuilder & addTypeParameter(StringRef Name, QualType DefaultValue = QualType()) { @@ -322,7 +323,7 @@ struct TemplateParameterListBuilder { SourceLocation())); Params.emplace_back(Decl); return *this; - } + } /* The concept specialization expression (CSE) constructed in @@ -664,6 +665,104 @@ ConceptDecl *constructTypedBufferConceptDecl(Sema &S, NamespaceDecl *NSD) { return CD; } +BinaryOperator *getSizeOfLEQ16Expr(clang::ASTContext &context, + SourceLocation NameLoc, + TemplateTypeParmDecl *T) { + // Obtain the QualType for 'unsigned long' + clang::QualType unsignedLongType = context.UnsignedLongTy; + + // Create a QualType that points to this TemplateTypeParmDecl + clang::QualType TType = context.getTypeDeclType(T); + + // Create a TypeSourceInfo for the template type parameter 'T' + clang::TypeSourceInfo *TTypeSourceInfo = + context.getTrivialTypeSourceInfo(TType, NameLoc); + + clang::UnaryExprOrTypeTraitExpr *sizeOfExpr = new (context) + clang::UnaryExprOrTypeTraitExpr(clang::UETT_SizeOf, TTypeSourceInfo, + unsignedLongType, NameLoc, NameLoc); + + // Create an IntegerLiteral for the value '16' with size type + clang::QualType sizeType = context.getSizeType(); + llvm::APInt sizeValue = llvm::APInt(context.getTypeSize(sizeType), 16); + clang::IntegerLiteral *sizeLiteral = new (context) + clang::IntegerLiteral(context, sizeValue, sizeType, NameLoc); + + clang::QualType BoolTy = context.BoolTy; + + clang::BinaryOperator *binaryOperator = clang::BinaryOperator::Create( + context, sizeOfExpr, // Left-hand side expression + sizeLiteral, // Right-hand side expression + clang::BO_LE, // Binary operator kind (<=) + BoolTy, // Result type (bool) + clang::VK_LValue, // Value kind + clang::OK_Ordinary, // Object kind + NameLoc, // Source location of operator + FPOptionsOverride()); + + return binaryOperator; +} + +Expr *getTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc, + TemplateTypeParmDecl *T) { + clang::ASTContext &context = S.getASTContext(); + + // first get the "sizeof(T) <= 16" expression, as a binary operator + BinaryOperator *sizeOfLEQ16 = getSizeOfLEQ16Expr(context, NameLoc, T); + // TODO: add the '__builtin_hlsl_is_line_vector_layout_compatible' builtin + // and return a binary operator that evaluates the builtin on the given + // template type parameter 'T' + return sizeOfLEQ16; +} + +ConceptDecl *getTypedBufferConceptDecl(Sema &S) { + DeclContext *DC = S.CurContext; + clang::ASTContext &context = S.getASTContext(); + SourceLocation DeclLoc = SourceLocation(); + + IdentifierInfo &IsValidLineVectorII = + context.Idents.get("is_valid_line_vector"); + IdentifierInfo &ElementTypeII = + context.Idents.get("element_type"); + clang::TemplateTypeParmDecl *T = clang::TemplateTypeParmDecl::Create( + context, context.getTranslationUnitDecl(), DeclLoc, DeclLoc, + /*depth=*/0, + /*position=*/0, + /*id=*/&ElementTypeII, + /*Typename=*/true, + /*ParameterPack=*/false); + + T->setDeclContext(DC); + T->setReferenced(); + + // Create and Attach Template Parameter List to ConceptDecl + llvm::ArrayRef<NamedDecl *> TemplateParams = {T}; + clang::TemplateParameterList *ConceptParams = + clang::TemplateParameterList::Create(context, DeclLoc, DeclLoc, + TemplateParams, DeclLoc, nullptr); + + DeclarationName DeclName = DeclarationName(&IsValidLineVectorII); + Expr *ConstraintExpr = getTypedBufferConstraintExpr(S, DeclLoc, T); + + // Create a ConceptDecl + clang::ConceptDecl *conceptDecl = clang::ConceptDecl::Create( + context, + context.getTranslationUnitDecl(), // DeclContext + DeclLoc, // Source location of start of concept + DeclName, // Source location of end of concept + ConceptParams, // Template type parameter + ConstraintExpr // Expression defining the concept + ); + + // Attach the template parameter list to the ConceptDecl + conceptDecl->setTemplateParameters(ConceptParams); + + // Add the concept declaration to the Translation Unit Decl + context.getTranslationUnitDecl()->addDecl(conceptDecl); + + return conceptDecl; +} + void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { CXXRecordDecl *Decl; ConceptDecl *TypedBufferConcept = >From 0de7090210b854c89a8384acfef2d3aa9f0242c1 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Wed, 16 Oct 2024 13:42:13 -0700 Subject: [PATCH 07/19] clang format --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index fbf7dc9fb0901b..ef70a93c036e64 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -298,7 +298,6 @@ struct TemplateParameterListBuilder { BuiltinTypeDeclBuilder &Builder; Sema &S; llvm::SmallVector<NamedDecl *> Params; - TemplateParameterListBuilder(Sema &S, BuiltinTypeDeclBuilder &RB) : Builder(RB), S(S) {} @@ -323,7 +322,7 @@ struct TemplateParameterListBuilder { SourceLocation())); Params.emplace_back(Decl); return *this; - } + } /* The concept specialization expression (CSE) constructed in @@ -722,8 +721,7 @@ ConceptDecl *getTypedBufferConceptDecl(Sema &S) { IdentifierInfo &IsValidLineVectorII = context.Idents.get("is_valid_line_vector"); - IdentifierInfo &ElementTypeII = - context.Idents.get("element_type"); + IdentifierInfo &ElementTypeII = context.Idents.get("element_type"); clang::TemplateTypeParmDecl *T = clang::TemplateTypeParmDecl::Create( context, context.getTranslationUnitDecl(), DeclLoc, DeclLoc, /*depth=*/0, >From e685e6784916db665991d029bd88e39d69b2d692 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 17 Oct 2024 11:03:52 -0700 Subject: [PATCH 08/19] add default nullptr, remove comments --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index ef70a93c036e64..eb9241cd18ee95 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -302,7 +302,7 @@ struct TemplateParameterListBuilder { TemplateParameterListBuilder(Sema &S, BuiltinTypeDeclBuilder &RB) : Builder(RB), S(S) {} - ~TemplateParameterListBuilder() { finalizeTemplateArgs(nullptr); } + ~TemplateParameterListBuilder() { finalizeTemplateArgs(); } TemplateParameterListBuilder & addTypeParameter(StringRef Name, QualType DefaultValue = QualType()) { @@ -744,13 +744,8 @@ ConceptDecl *getTypedBufferConceptDecl(Sema &S) { // Create a ConceptDecl clang::ConceptDecl *conceptDecl = clang::ConceptDecl::Create( - context, - context.getTranslationUnitDecl(), // DeclContext - DeclLoc, // Source location of start of concept - DeclName, // Source location of end of concept - ConceptParams, // Template type parameter - ConstraintExpr // Expression defining the concept - ); + context, context.getTranslationUnitDecl(), DeclLoc, DeclName, + ConceptParams, ConstraintExpr); // Attach the template parameter list to the ConceptDecl conceptDecl->setTemplateParameters(ConceptParams); >From 023b81a0120b9f46a303177279fdbbe49fc4ddf8 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 17 Oct 2024 16:18:52 -0700 Subject: [PATCH 09/19] remove unused var, use vector to extend memory lifetime, may need to extend further --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index eb9241cd18ee95..2638d3f7515115 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -445,9 +445,6 @@ struct TemplateParameterListBuilder { QualType T = Builder.Template->getInjectedClassNameSpecialization(); T = S.Context.getInjectedClassNameType(Builder.Record, T); - ArrayRef<TemplateArgument> TempArgs = - Builder.Template->getInjectedTemplateArgs(); - return Builder; } }; @@ -734,7 +731,9 @@ ConceptDecl *getTypedBufferConceptDecl(Sema &S) { T->setReferenced(); // Create and Attach Template Parameter List to ConceptDecl - llvm::ArrayRef<NamedDecl *> TemplateParams = {T}; + std::vector<NamedDecl *> TemplateParamsVec = {T}; + llvm::ArrayRef<NamedDecl *> TemplateParams(TemplateParamsVec); + clang::TemplateParameterList *ConceptParams = clang::TemplateParameterList::Create(context, DeclLoc, DeclLoc, TemplateParams, DeclLoc, nullptr); >From 22ab32732d06722ec56d1ceeba063e3510cf2ffb Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Fri, 18 Oct 2024 00:33:43 -0700 Subject: [PATCH 10/19] address everything --- clang/lib/AST/DeclTemplate.cpp | 6 +++--- clang/lib/Sema/HLSLExternalSemaSource.cpp | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index 4a185aedf825de..a221d619672b38 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -1071,10 +1071,10 @@ ConceptDecl *ConceptDecl::Create(ASTContext &C, DeclContext *DC, TemplateParameterList *Params, Expr *ConstraintExpr) { bool Invalid = AdoptTemplateParameterList(Params, DC); - auto *CD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr); + auto *TD = new (C, DC) ConceptDecl(DC, L, Name, Params, ConstraintExpr); if (Invalid) - CD->setInvalidDecl(); - return CD; + TD->setInvalidDecl(); + return TD; } ConceptDecl *ConceptDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) { diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index 2638d3f7515115..2ee1db07134457 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -414,6 +414,7 @@ struct TemplateParameterListBuilder { ConceptSpecializationExpr *CSE = ConceptSpecializationExpr::Create(Context, CR, ImplicitCSEDecl, &CS); + return CSE; } @@ -731,12 +732,9 @@ ConceptDecl *getTypedBufferConceptDecl(Sema &S) { T->setReferenced(); // Create and Attach Template Parameter List to ConceptDecl - std::vector<NamedDecl *> TemplateParamsVec = {T}; - llvm::ArrayRef<NamedDecl *> TemplateParams(TemplateParamsVec); - clang::TemplateParameterList *ConceptParams = - clang::TemplateParameterList::Create(context, DeclLoc, DeclLoc, - TemplateParams, DeclLoc, nullptr); + clang::TemplateParameterList::Create(context, DeclLoc, DeclLoc, {T}, + DeclLoc, nullptr); DeclarationName DeclName = DeclarationName(&IsValidLineVectorII); Expr *ConstraintExpr = getTypedBufferConstraintExpr(S, DeclLoc, T); >From 530afd23913ab2826d8cd4144853091b971cb7b0 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Fri, 18 Oct 2024 14:05:40 -0700 Subject: [PATCH 11/19] undo formatting problem --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index 2ee1db07134457..fba767776b0ebb 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -334,6 +334,7 @@ struct TemplateParameterListBuilder { template<typename element_type> requires is_typed_resource_element_compatible<element_type> + struct RWBuffer { element_type Val; }; >From 269c0864c07eb9a16a08415cb4c016226cacf4b7 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Fri, 18 Oct 2024 14:28:04 -0700 Subject: [PATCH 12/19] get rid of clang:: specifier for enum values >From 427f623e4c54473444b467ea5876942de326e645 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Fri, 18 Oct 2024 15:57:22 -0700 Subject: [PATCH 13/19] clang format >From e636c9452ee71f1e4aa6d2da7805137b0c397ba4 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Tue, 5 Nov 2024 14:49:38 -0800 Subject: [PATCH 14/19] fix typo >From 48757eab9f3c4133bd23537bb3ad71f244c64a90 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 7 Nov 2024 14:43:35 -0800 Subject: [PATCH 15/19] address damyan, clarify comments --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index fba767776b0ebb..2ee1db07134457 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -334,7 +334,6 @@ struct TemplateParameterListBuilder { template<typename element_type> requires is_typed_resource_element_compatible<element_type> - struct RWBuffer { element_type Val; }; >From 1d288f27aae0015136602cc6b936205d5af8fc45 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Thu, 7 Nov 2024 16:07:54 -0800 Subject: [PATCH 16/19] nfc to kick off bots again >From 80384c9ed3b77bf7bd7888be54a0201444df9a79 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Fri, 8 Nov 2024 15:29:42 -0800 Subject: [PATCH 17/19] clarify comment, add concept AST test >From b2ce314764298fcd29f1dc15914a71dcd9ab32bd Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Wed, 13 Nov 2024 15:25:58 -0800 Subject: [PATCH 18/19] use namespace decl as context >From b69515f25818f69146c91fe3a9b1190620c00a35 Mon Sep 17 00:00:00 2001 From: Joshua Batista <jbati...@microsoft.com> Date: Fri, 15 Nov 2024 08:38:25 -0800 Subject: [PATCH 19/19] update new tests --- clang/test/AST/HLSL/AppendStructuredBuffer-AST.hlsl | 4 ++-- clang/test/AST/HLSL/ConsumeStructuredBuffer-AST.hlsl | 4 ++-- clang/test/AST/HLSL/RWStructuredBuffer-AST.hlsl | 4 ++-- .../test/AST/HLSL/RasterizerOrderedStructuredBuffer-AST.hlsl | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/clang/test/AST/HLSL/AppendStructuredBuffer-AST.hlsl b/clang/test/AST/HLSL/AppendStructuredBuffer-AST.hlsl index 5a13ca7735f999..8dbab44024d34d 100644 --- a/clang/test/AST/HLSL/AppendStructuredBuffer-AST.hlsl +++ b/clang/test/AST/HLSL/AppendStructuredBuffer-AST.hlsl @@ -12,7 +12,7 @@ // instantiated specialization. // EMPTY: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit AppendStructuredBuffer -// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // EMPTY-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class AppendStructuredBuffer // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final @@ -26,7 +26,7 @@ AppendStructuredBuffer<int> Buffer; #endif // CHECK: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit AppendStructuredBuffer -// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class AppendStructuredBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final diff --git a/clang/test/AST/HLSL/ConsumeStructuredBuffer-AST.hlsl b/clang/test/AST/HLSL/ConsumeStructuredBuffer-AST.hlsl index b75f3fcb959cfc..f27941b539b6a8 100644 --- a/clang/test/AST/HLSL/ConsumeStructuredBuffer-AST.hlsl +++ b/clang/test/AST/HLSL/ConsumeStructuredBuffer-AST.hlsl @@ -12,7 +12,7 @@ // instantiated specialization. // EMPTY: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit ConsumeStructuredBuffer -// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // EMPTY-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class ConsumeStructuredBuffer // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final @@ -26,7 +26,7 @@ ConsumeStructuredBuffer<int> Buffer; #endif // CHECK: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit ConsumeStructuredBuffer -// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class ConsumeStructuredBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final diff --git a/clang/test/AST/HLSL/RWStructuredBuffer-AST.hlsl b/clang/test/AST/HLSL/RWStructuredBuffer-AST.hlsl index 4a1e1d7570e5e9..5058eab40b1aeb 100644 --- a/clang/test/AST/HLSL/RWStructuredBuffer-AST.hlsl +++ b/clang/test/AST/HLSL/RWStructuredBuffer-AST.hlsl @@ -12,7 +12,7 @@ // instantiated specialization. // EMPTY: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit RWStructuredBuffer -// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // EMPTY-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class RWStructuredBuffer // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final @@ -26,7 +26,7 @@ RWStructuredBuffer<int> Buffer; #endif // CHECK: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit RWStructuredBuffer -// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class RWStructuredBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final diff --git a/clang/test/AST/HLSL/RasterizerOrderedStructuredBuffer-AST.hlsl b/clang/test/AST/HLSL/RasterizerOrderedStructuredBuffer-AST.hlsl index f334e1bb6db3fc..bd05432a09e01c 100644 --- a/clang/test/AST/HLSL/RasterizerOrderedStructuredBuffer-AST.hlsl +++ b/clang/test/AST/HLSL/RasterizerOrderedStructuredBuffer-AST.hlsl @@ -12,7 +12,7 @@ // instantiated specialization. // EMPTY: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit RasterizerOrderedStructuredBuffer -// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// EMPTY-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // EMPTY-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit <undeserialized declarations> class RasterizerOrderedStructuredBuffer // EMPTY-NEXT: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final @@ -26,7 +26,7 @@ RasterizerOrderedStructuredBuffer<int> Buffer; #endif // CHECK: ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit RasterizerOrderedStructuredBuffer -// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> class depth 0 index 0 element_type +// CHECK-NEXT: TemplateTypeParmDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> typename depth 0 index 0 element_type // CHECK-NEXT: CXXRecordDecl 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> <invalid sloc> implicit class RasterizerOrderedStructuredBuffer definition // CHECK: FinalAttr 0x{{[0-9A-Fa-f]+}} <<invalid sloc>> Implicit final _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits