From 4991a223c200bc56194bba45622d47446a881c93 Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 1 Jul 2026 12:50:42 -0500 Subject: [PATCH 1/2] [NFC] Don't string match WG type names This replaces string matching of WG type names with using the proper NodeIOFlags. This avoids the compiler incorrectly treating a user-defined type as if it is the built-in type. --- tools/clang/lib/AST/HlslTypes.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index 3a6174d3a9..a874e9acd4 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -604,14 +604,9 @@ bool IsHLSLNodeOutputType(clang::QualType type) { } bool IsHLSLNodeRecordArrayType(clang::QualType type) { - if (const RecordType *RT = type->getAs()) { - StringRef name = RT->getDecl()->getName(); - if (name == "ThreadNodeOutputRecords" || name == "GroupNodeOutputRecords" || - name == "GroupNodeInputRecords" || name == "RWGroupNodeInputRecords" || - name == "EmptyNodeInput") - return true; - } - return false; + return ((static_cast(GetNodeIOType(type)) & + static_cast(DXIL::NodeIOFlags::NodeArray)) == + static_cast(DXIL::NodeIOFlags::NodeArray)); } bool IsHLSLEmptyNodeRecordType(clang::QualType type) { From 65d69ccd19d3633378f62ffb10bdbd1c70e05bba Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Wed, 1 Jul 2026 13:51:31 -0500 Subject: [PATCH 2/2] Remove IsHLSLNodeRecordArrayType --- tools/clang/include/clang/AST/HlslTypes.h | 1 - tools/clang/lib/AST/HlslTypes.cpp | 6 ------ tools/clang/lib/SPIRV/SpirvEmitter.cpp | 1 - 3 files changed, 8 deletions(-) diff --git a/tools/clang/include/clang/AST/HlslTypes.h b/tools/clang/include/clang/AST/HlslTypes.h index 610d844616..cc72c51048 100644 --- a/tools/clang/include/clang/AST/HlslTypes.h +++ b/tools/clang/include/clang/AST/HlslTypes.h @@ -490,7 +490,6 @@ bool IsHLSLObjectWithImplicitROMemberAccess(clang::QualType type); bool IsHLSLRWNodeInputRecordType(clang::QualType type); bool IsHLSLRONodeInputRecordType(clang::QualType type); bool IsHLSLDispatchNodeInputRecordType(clang::QualType type); -bool IsHLSLNodeRecordArrayType(clang::QualType type); bool IsHLSLNodeOutputType(clang::QualType type); bool IsHLSLEmptyNodeRecordType(clang::QualType type); diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index a874e9acd4..6edbb3b862 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -603,12 +603,6 @@ bool IsHLSLNodeOutputType(clang::QualType type) { static_cast(DXIL::NodeIOFlags::Output); } -bool IsHLSLNodeRecordArrayType(clang::QualType type) { - return ((static_cast(GetNodeIOType(type)) & - static_cast(DXIL::NodeIOFlags::NodeArray)) == - static_cast(DXIL::NodeIOFlags::NodeArray)); -} - bool IsHLSLEmptyNodeRecordType(clang::QualType type) { return (static_cast(GetNodeIOType(type)) & static_cast(DXIL::NodeIOFlags::EmptyRecord)) == diff --git a/tools/clang/lib/SPIRV/SpirvEmitter.cpp b/tools/clang/lib/SPIRV/SpirvEmitter.cpp index 288b926f24..b7fd447787 100644 --- a/tools/clang/lib/SPIRV/SpirvEmitter.cpp +++ b/tools/clang/lib/SPIRV/SpirvEmitter.cpp @@ -11796,7 +11796,6 @@ SpirvInstruction *SpirvEmitter::processIntrinsicExtractRecordStruct( QualType objType = obj->getType(); unsigned n = callExpr->getNumArgs(); assert(hlsl::IsHLSLNodeType(objType)); - assert(n == 0 || n == 1 && hlsl::IsHLSLNodeRecordArrayType(objType)); QualType recordType = hlsl::GetHLSLNodeIOResultType(astContext, objType); SpirvInstruction *res = doExpr(obj);