From e71c32af9214951bc1acd4cad84bc1c712dd7543 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Wed, 12 Nov 2025 13:03:31 -0800 Subject: [PATCH 1/7] @llvm-beanz proof of concept --- lib/HLSL/HLLegalizeParameter.cpp | 5 +++-- tools/clang/lib/Sema/SemaHLSL.cpp | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/HLSL/HLLegalizeParameter.cpp b/lib/HLSL/HLLegalizeParameter.cpp index 141f163e15..9245d8e226 100644 --- a/lib/HLSL/HLLegalizeParameter.cpp +++ b/lib/HLSL/HLLegalizeParameter.cpp @@ -256,8 +256,9 @@ bool HLLegalizeParameter::runOnModule(Module &M) { continue; for (Argument &Arg : F.args()) { - if (!Arg.getType()->isPointerTy()) - continue; + Type *PtrTy = dyn_cast(Arg.getType()); + if (!PtrTy || 0 != PtrTy->getPointerAddressSpace()) + continue; Type *EltTy = dxilutil::GetArrayEltTy(Arg.getType()); if (dxilutil::IsHLSLObjectType(EltTy) || dxilutil::IsHLSLResourceType(EltTy)) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index e9c8c90a2d..e3b061007c 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -14655,6 +14655,8 @@ void hlsl::HandleDeclAttributeForHLSL(Sema &S, Decl *D, const AttributeList &A, VD->setType( S.Context.getAddrSpaceQualType(VD->getType(), DXIL::kTGSMAddrSpace)); } + if (ParmVarDecl *VD = dyn_cast(D)) + VD->setType(S.Context.getLValueReferenceType(VD->getType())); break; case AttributeList::AT_HLSLUniform: declAttr = ::new (S.Context) HLSLUniformAttr( @@ -15749,8 +15751,13 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, break; case AttributeList::AT_HLSLGroupShared: isGroupShared = true; - if (!isGlobal) { - Diag(pAttr->getLoc(), diag::err_hlsl_varmodifierna) + if (isParameter && (usageIn || usageOut)) { + Diag(pAttr->getLoc(), diag::err_hlsl_varmodifiersna) + << pAttr->getName() << "in/out/inout modifiers" << declarationType; + result = false; + } + if (!(isGlobal || isParameter)) { + Diag(pAttr->getLoc(), diag::err_hlsl_varmodifierna) << pAttr->getName() << declarationType << pAttr->getRange(); result = false; } @@ -15786,6 +15793,10 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, Diag(pAttr->getLoc(), diag::err_hlsl_usage_not_on_parameter) << pAttr->getName() << pAttr->getRange(); result = false; + } else if (isGroupShared) { + Diag(pAttr->getLoc(), diag::err_hlsl_varmodifiersna) + << pAttr->getName() << "groupshared" << declarationType; + result = false; } if (!IsUsageAttributeCompatible(pAttr->getKind(), usageIn, usageOut)) { Diag(pAttr->getLoc(), diag::err_hlsl_duplicate_parameter_usages) From 8b20e9edcffd02976ac4b3f5301b34e82bea70f3 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Thu, 13 Nov 2025 12:31:15 -0800 Subject: [PATCH 2/7] get basic tests working get compiler to error when types aren't exactly the same + arg not groupshared bug fix fix test disallow groupshared param in export/noinline funcs first check if there are attrs remove accidental change tests --- tools/clang/include/clang/AST/Decl.h | 2 + tools/clang/lib/AST/HlslTypes.cpp | 18 +++++++ tools/clang/lib/CodeGen/CGHLSLMS.cpp | 11 +++- tools/clang/lib/Sema/SemaDeclAttr.cpp | 5 ++ tools/clang/lib/Sema/SemaHLSL.cpp | 22 ++++++++ tools/clang/lib/Sema/SemaOverload.cpp | 14 ++++++ .../CodeGenHLSL/groupsharedArgs/ArrTest.hlsl | 16 ++++++ .../groupsharedArgs/ScalarTest.hlsl | 15 ++++++ .../groupsharedArgs/StructTest.hlsl | 33 ++++++++++++ .../groupsharedArgs/TemplateTest.hlsl | 33 ++++++++++++ .../groupsharedArgs/VectorTest.hlsl | 19 +++++++ .../v202x/groupshared/ExportNoInlineTest.hlsl | 11 ++++ .../v202x/groupshared/NotGroupSharedTest.hlsl | 18 +++++++ .../v202x/groupshared/ScalarTest.hlsl | 13 +++++ tools/clang/test/SemaHLSL/varmods-syntax.hlsl | 50 +++++++++---------- 15 files changed, 254 insertions(+), 26 deletions(-) create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl create mode 100644 tools/clang/test/SemaHLSL/v202x/groupshared/ExportNoInlineTest.hlsl create mode 100644 tools/clang/test/SemaHLSL/v202x/groupshared/NotGroupSharedTest.hlsl create mode 100644 tools/clang/test/SemaHLSL/v202x/groupshared/ScalarTest.hlsl diff --git a/tools/clang/include/clang/AST/Decl.h b/tools/clang/include/clang/AST/Decl.h index 985ad895ab..917eae3299 100644 --- a/tools/clang/include/clang/AST/Decl.h +++ b/tools/clang/include/clang/AST/Decl.h @@ -1458,6 +1458,8 @@ class ParmVarDecl : public VarDecl { void setModifierOut(bool value) { ParmVarDeclBits.IsModifierOut = value; } /// Synthesize a ParameterModifier value for this parameter. hlsl::ParameterModifier getParamModifiers() const { + if (!isModifierIn() && !isModifierOut()) + return hlsl::ParameterModifier(hlsl::ParameterModifier::Kind::Ref); if (isModifierIn() && !isModifierOut()) return hlsl::ParameterModifier(hlsl::ParameterModifier::Kind::In); if (isModifierIn() && isModifierOut()) diff --git a/tools/clang/lib/AST/HlslTypes.cpp b/tools/clang/lib/AST/HlslTypes.cpp index 00c18a81a9..530fd79019 100644 --- a/tools/clang/lib/AST/HlslTypes.cpp +++ b/tools/clang/lib/AST/HlslTypes.cpp @@ -292,6 +292,9 @@ bool HasHLSLReorderCoherent(clang::QualType type) { return false; } +/// Checks whether the pAttributes indicate a parameter is groupshared +bool IsParamAttributedAsGroupShared(clang::AttributeList *pAttributes); + /// Checks whether the pAttributes indicate a parameter is inout or out; if /// inout, pIsIn will be set to true. bool IsParamAttributedAsOut(clang::AttributeList *pAttributes, bool *pIsIn); @@ -934,6 +937,19 @@ unsigned GetHLSLOutputPatchCount(QualType type) { return argList[1].getAsIntegral().getLimitedValue(); } +bool IsParamAttributedAsGroupShared(clang::AttributeList *pAttributes) { + while (pAttributes != nullptr) { + switch (pAttributes->getKind()) { + case AttributeList::AT_HLSLGroupShared: + return true; + default: + break; + } + pAttributes = pAttributes->getNext(); + } + return false; +} + bool IsParamAttributedAsOut(clang::AttributeList *pAttributes, bool *pIsIn) { bool anyFound = false; bool inFound = false; @@ -967,6 +983,8 @@ bool IsParamAttributedAsOut(clang::AttributeList *pAttributes, bool *pIsIn) { hlsl::ParameterModifier ParamModFromAttributeList(clang::AttributeList *pAttributes) { + if (IsParamAttributedAsGroupShared(pAttributes)) + return ParameterModifier(hlsl::ParameterModifier::Kind::Ref); bool isIn, isOut; isOut = IsParamAttributedAsOut(pAttributes, &isIn); return ParameterModifier::FromInOut(isIn, isOut); diff --git a/tools/clang/lib/CodeGen/CGHLSLMS.cpp b/tools/clang/lib/CodeGen/CGHLSLMS.cpp index 6c68381a20..1e8bd32702 100644 --- a/tools/clang/lib/CodeGen/CGHLSLMS.cpp +++ b/tools/clang/lib/CodeGen/CGHLSLMS.cpp @@ -1309,6 +1309,14 @@ unsigned CGMSHLSLRuntime::AddTypeAnnotation(QualType Ty, const IncompleteArrayType *arrayTy = CGM.getContext().getAsIncompleteArrayType(Ty); arrayElementTy = arrayTy->getElementType(); + } else if (paramTy->isConstantArrayType()) { + // hacky because unclear proper usage of paramTy vs Ty... + const ConstantArrayType *arrayTy = + CGM.getContext().getAsConstantArrayType(paramTy); + DXASSERT(arrayTy != nullptr, "Must be array type here"); + + arraySize = arrayTy->getSize().getLimitedValue(); + arrayElementTy = arrayTy->getElementType(); } else { DXASSERT(0, "Must array type here"); } @@ -6232,7 +6240,8 @@ void CGMSHLSLRuntime::EmitHLSLOutParamConversionInit( } } else if (isAggregateType) { // aggregate in-only - emit RValue, unless LValueToRValue cast - EmitRValueAgg = true; + if (Param->isModifierIn()) + EmitRValueAgg = true; if (const ImplicitCastExpr *cast = dyn_cast(Arg)) { if (cast->getCastKind() == CastKind::CK_LValueToRValue) { EmitRValueAgg = false; diff --git a/tools/clang/lib/Sema/SemaDeclAttr.cpp b/tools/clang/lib/Sema/SemaDeclAttr.cpp index 085874a0ed..0d0040f0a8 100644 --- a/tools/clang/lib/Sema/SemaDeclAttr.cpp +++ b/tools/clang/lib/Sema/SemaDeclAttr.cpp @@ -4945,6 +4945,11 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, handleSimpleAttribute(S, D, Attr); break; case AttributeList::AT_NoInline: + if (S.LangOpts.HLSL) { + bool Handled = false; + hlsl::HandleDeclAttributeForHLSL(S, D, Attr, Handled); + if (Handled) break; + } handleSimpleAttribute(S, D, Attr); break; case AttributeList::AT_NoInstrumentFunction: // Interacts with -pg. diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index e3b061007c..886a2b65ba 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -14474,6 +14474,27 @@ void Sema::DiagnoseHLSLDeclAttr(const Decl *D, const Attr *A) { HLSLExternalSource *ExtSource = HLSLExternalSource::FromSema(this); const bool IsGCAttr = isa(A); const bool IsRCAttr = isa(A); + const bool IsExportAttr = isa(A); + const bool IsNoInlineAttr = isa(A); + if (IsExportAttr || IsNoInlineAttr) { + if (const FunctionDecl *FD = dyn_cast(D)) { + for (ParmVarDecl *PVD : FD->parameters()) { + if (!PVD->hasAttrs()) + continue; + for (Attr *A : PVD->getAttrs()) { + switch (A->getKind()) { + case clang::attr::HLSLGroupShared: { // todo improve this error msg + Diag(A->getLocation(), diag::err_hlsl_varmodifiersna) + << "groupshared" << "export/noinline" << "parameter"; + return; + break; + } + } + } + } + return; + } + } if (IsGCAttr || IsRCAttr) { const ValueDecl *TD = cast(D); if (TD->getType()->isDependentType()) @@ -14998,6 +15019,7 @@ void hlsl::HandleDeclAttributeForHLSL(Sema &S, Decl *D, const AttributeList &A, } if (declAttr != nullptr) { + S.DiagnoseHLSLDeclAttr(D, declAttr); DXASSERT_NOMSG(Handled); D->addAttr(declAttr); diff --git a/tools/clang/lib/Sema/SemaOverload.cpp b/tools/clang/lib/Sema/SemaOverload.cpp index 274b66646b..a588231522 100644 --- a/tools/clang/lib/Sema/SemaOverload.cpp +++ b/tools/clang/lib/Sema/SemaOverload.cpp @@ -4953,6 +4953,20 @@ InitCallParamConversions(Sema &S, const FunctionProtoType *Proto, ImplicitConversionSequence &OutConversion) { hlsl::ParameterModifier paramMods = Proto->getParamMods()[ArgIdx]; QualType ParamType = Proto->getParamType(ArgIdx); + + // must be a Ref; don't allow any conversions + if (!(paramMods.isAnyIn() || paramMods.isAnyOut())) { + if (!S.getASTContext().hasSameUnqualifiedType( + ParamType.getNonReferenceType(), Arg->getType()) || + Arg->getType().getQualifiers().getAddressSpace() != + hlsl::DXIL::kTGSMAddrSpace) { + InConversion.setBad(BadConversionSequence::no_conversion, Arg->getType(), + ParamType); + InConversion.Bad.FromExpr = Arg; // hack for now + return; + } + } + if (paramMods.isAnyIn()) { InConversion = TryCopyInitialization(S, Arg, ParamType, SuppressUserConversions, diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl new file mode 100644 index 0000000000..2630f72472 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl @@ -0,0 +1,16 @@ +// RUN: %dxc -E main -T cs_6_0 -HV 202x -fcgl %s | FileCheck %s + +groupshared float4 SharedArr[64]; + +// CHECK-LABEL: define internal void {{.*}}fn{{.*}}([64 x <4 x float>] addrspace(3)* dereferenceable(1024) %Arr, float %F) +// CHECK: [[ArrIdx:%.*]] = getelementptr inbounds [64 x <4 x float>], [64 x <4 x float>] addrspace(3)* %Arr, i32 0, i32 5 +// CHECK-NEXT: store <4 x float> {{.*}}, <4 x float> addrspace(3)* [[ArrIdx]], align 4 +void fn(groupshared float4 Arr[64], float F) { + float4 tmp = F.xxxx; + Arr[5] = tmp; +} + +[numthreads(4,1,1)] +void main() { + fn(SharedArr, 6.0); +} diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl new file mode 100644 index 0000000000..4ffef256d3 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl @@ -0,0 +1,15 @@ +// RUN: %dxc -E main -T cs_6_2 -enable-16bit-types -HV 202x -fcgl %s | FileCheck %s + +groupshared uint16_t SharedData; + +// CHECK-LABEL: fn1 +// CHECK: store i16 5, i16 addrspace(3)* %Sh, align 4 +void fn1(groupshared uint16_t Sh) { + Sh = 5; +} + +[numthreads(4, 1, 1)] +// call void @"\01?fn1@@YAXAAG@Z"(i16 addrspace(3)* dereferenceable(2) @"\01?SharedData@@3GA") +void main(uint3 TID : SV_GroupThreadID) { + fn1(SharedData); +} diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl new file mode 100644 index 0000000000..b62f1ed251 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -E main -T cs_6_3 -HV 202x -fcgl %s | FileCheck %s + +struct Shared { + int A; + float F; + double Arr[4]; +}; + +groupshared Shared SharedData; + +// CHECK-LABEL: fn1 +// CHECK: [[D:%.*]] = alloca double, align 8 +// CHECK: [[A:%.*]] = getelementptr inbounds %struct.Shared, %struct.Shared addrspace(3)* %Sh, i32 0, i32 0 +// CHECK: store i32 10, i32 addrspace(3)* [[A]], align 4 +// CHECK: [[F:%.*]] = getelementptr inbounds %struct.Shared, %struct.Shared addrspace(3)* %Sh, i32 0, i32 1 +// CHECK: store float 0x40263851E0000000, float addrspace(3)* %F, align 4 +// CHECK: store double 1.000000e+01, double* [[D]], align 8 +// CHECK: [[Z:%.*]] = load double, double* [[D]], align 8 +// CHECK: [[Arr:%.*]] = getelementptr inbounds %struct.Shared, %struct.Shared addrspace(3)* %Sh, i32 0, i32 2 +// CHECK: [[ArrIdx:%.*]] = getelementptr inbounds [4 x double], [4 x double] addrspace(3)* [[Arr]], i32 0, i32 1 +// CHECK: store double [[Z]], double addrspace(3)* [[ArrIdx]], align 4 +void fn1(groupshared Shared Sh) { + Sh.A = 10; + Sh.F = 11.11; + double D = 10.0; + Sh.Arr[1] = D; +} + +[numthreads(4, 1, 1)] +// call void @"\01?fn1@@YAXAAUShared@@@Z"(%struct.Shared addrspace(3)* dereferenceable(40) @"\01?SharedData@@3UShared@@A") +void main(uint3 TID : SV_GroupThreadID) { + fn1(SharedData); +} diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl new file mode 100644 index 0000000000..9db9aef5e3 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl @@ -0,0 +1,33 @@ +// RUN: %dxc -E main -T cs_6_3 -HV 202x -fcgl %s | FileCheck %s + +template struct Shared { + T A; + float F; + double Arr[4]; +}; + +groupshared Shared SharedData; + +// CHECK-LABEL: fn1 +// CHECK: [[D:%.*]] = alloca double, align 8 +// CHECK: [[A:%.*]] = getelementptr inbounds %"struct.Shared", %"struct.Shared" addrspace(3)* %Sh, i32 0, i32 0 +// CHECK: store i32 10, i32 addrspace(3)* [[A]], align 4 +// CHECK: [[F:%.*]] = getelementptr inbounds %"struct.Shared", %"struct.Shared" addrspace(3)* %Sh, i32 0, i32 1 +// CHECK: store float 0x40263851E0000000, float addrspace(3)* %F, align 4 +// CHECK: store double 1.000000e+01, double* [[D]], align 8 +// CHECK: [[Z:%.*]] = load double, double* [[D]], align 8 +// CHECK: [[Arr:%.*]] = getelementptr inbounds %"struct.Shared", %"struct.Shared" addrspace(3)* %Sh, i32 0, i32 2 +// CHECK: [[ArrIdx:%.*]] = getelementptr inbounds [4 x double], [4 x double] addrspace(3)* [[Arr]], i32 0, i32 1 +// CHECK: store double [[Z]], double addrspace(3)* [[ArrIdx]], align 4 +void fn1(groupshared Shared Sh) { + Sh.A = 10; + Sh.F = 11.11; + double D = 10.0; + Sh.Arr[1] = D; +} + +[numthreads(4, 1, 1)] +// call void @"\01?fn1@@YAXAAUShared@@@Z"(%struct.Shared addrspace(3)* dereferenceable(40) @"\01?SharedData@@3UShared@@A") +void main(uint3 TID : SV_GroupThreadID) { + fn1(SharedData); +} diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl new file mode 100644 index 0000000000..ba73529293 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl @@ -0,0 +1,19 @@ +// RUN: %dxc -E main -T cs_6_3 -HV 202x -fcgl %s | FileCheck %s + +groupshared float4 SharedData; + +// CHECK-LABEL: fn1 +// CHECK: [[Tmp:%.*]] = alloca <1 x float>, align 4 +// CHECK: store <1 x float> , <1 x float>* [[Tmp]] +// CHECK: [[Z:%.*]] = load <1 x float>, <1 x float>* [[Tmp]] +// CHECK: [[Y:%.*]] = shufflevector <1 x float> [[Z]], <1 x float> undef, <4 x i32> zeroinitializer +// CHECK: store <4 x float> [[Y]], <4 x float> addrspace(3)* %Sh, align 4 +void fn1(groupshared float4 Sh) { + Sh = 5.0.xxxx; +} + +[numthreads(4, 1, 1)] +// call void @"\01?fn1@@YAXAAV?$vector@M$03@@@Z"(<4 x float> addrspace(3)* dereferenceable(16) @"\01?SharedData@@3V?$vector@M$03@@A"), !dbg !25 ; line:13 col:3 +void main(uint3 TID : SV_GroupThreadID) { + fn1(SharedData); +} diff --git a/tools/clang/test/SemaHLSL/v202x/groupshared/ExportNoInlineTest.hlsl b/tools/clang/test/SemaHLSL/v202x/groupshared/ExportNoInlineTest.hlsl new file mode 100644 index 0000000000..56f8042491 --- /dev/null +++ b/tools/clang/test/SemaHLSL/v202x/groupshared/ExportNoInlineTest.hlsl @@ -0,0 +1,11 @@ +// RUN: %dxc -T lib_6_3 -HV 202x -verify %s + +export void fn1(groupshared uint Sh) { +// expected-error@-1{{groupshared and export/noinline cannot be used together for a parameter}} + Sh = 5; +} + +[noinline] void fn2(groupshared uint Sh) { +// expected-error@-1{{groupshared and export/noinline cannot be used together for a parameter}} + Sh = 6; +} diff --git a/tools/clang/test/SemaHLSL/v202x/groupshared/NotGroupSharedTest.hlsl b/tools/clang/test/SemaHLSL/v202x/groupshared/NotGroupSharedTest.hlsl new file mode 100644 index 0000000000..229141eb0c --- /dev/null +++ b/tools/clang/test/SemaHLSL/v202x/groupshared/NotGroupSharedTest.hlsl @@ -0,0 +1,18 @@ +// RUN: %dxc -T cs_6_3 -enable-16bit-types -HV 202x -verify %s + +RWStructuredBuffer Out : register(u0); + +groupshared uint16_t SharedData; + +void fn1(groupshared half Sh) { +// expected-note@-1{{candidate function not viable: 1st argument ('half') is in address space 0, but parameter must be in address space}} + Sh = 5; +} + +[numthreads(4, 1, 1)] +void main(uint3 TID : SV_GroupThreadID) { + half tmp = 1.0; + fn1(tmp); + // expected-error@-1{{no matching function for call to 'fn1'}} + Out[TID.x] = (uint4) SharedData.xxxx; +} diff --git a/tools/clang/test/SemaHLSL/v202x/groupshared/ScalarTest.hlsl b/tools/clang/test/SemaHLSL/v202x/groupshared/ScalarTest.hlsl new file mode 100644 index 0000000000..9d3703ea22 --- /dev/null +++ b/tools/clang/test/SemaHLSL/v202x/groupshared/ScalarTest.hlsl @@ -0,0 +1,13 @@ +// RUN: %dxc -T lib_6_3 -enable-16bit-types -HV 202x -verify %s + +groupshared uint16_t SharedData; + +void fn1(groupshared half Sh) { +// expected-note@-1{{candidate function not viable: no known conversion from '__attribute__((address_space(3))) uint16_t' to '__attribute__((address_space(3))) half &' for 1st argument}} + Sh = 5; +} + +void fn2() { + fn1(SharedData); + // expected-error@-1{{no matching function for call to 'fn1'}} +} diff --git a/tools/clang/test/SemaHLSL/varmods-syntax.hlsl b/tools/clang/test/SemaHLSL/varmods-syntax.hlsl index 8bb5bb2fc5..b9e312bfbf 100644 --- a/tools/clang/test/SemaHLSL/varmods-syntax.hlsl +++ b/tools/clang/test/SemaHLSL/varmods-syntax.hlsl @@ -497,33 +497,33 @@ struct s_inout { // Parameters // modify(lines, gen_code('float4 foo_%(id)s(%(mods)s float4 val) { return val; }', storage_combos)) // GENERATED_CODE:BEGIN -float4 foo_gro_ext(groupshared extern float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_ext': function must return a value}} */ +float4 foo_gro_ext(groupshared extern float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_ext': function must return a value}} */ float4 foo_ext_sta(extern static float4 val) { return val; } /* expected-error {{cannot combine with previous 'extern' declaration specifier}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'extern'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_ext_sta': function must return a value}} */ float4 foo_sta_uni(static uniform float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'static'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_sta_uni': function must return a value}} */ -float4 foo_gro(groupshared float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro': function must return a value}} */ -float4 foo_gro_pre(groupshared precise float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre': function must return a value}} */ -float4 foo_gro_pre_sta(groupshared precise static float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta': function must return a value}} */ -float4 foo_gro_pre_sta_vol(groupshared precise static volatile float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta_vol': function must return a value}} */ -float4 foo_gro_pre_sta_vol_con(groupshared precise static volatile const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta_vol_con': function must return a value}} */ -float4 foo_gro_pre_sta_con(groupshared precise static const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta_con': function must return a value}} */ -float4 foo_gro_pre_uni(groupshared precise uniform float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni': function must return a value}} */ -float4 foo_gro_pre_uni_vol(groupshared precise uniform volatile float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni_vol': function must return a value}} */ -float4 foo_gro_pre_uni_vol_con(groupshared precise uniform volatile const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni_vol_con': function must return a value}} */ -float4 foo_gro_pre_uni_con(groupshared precise uniform const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni_con': function must return a value}} */ -float4 foo_gro_pre_vol(groupshared precise volatile float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_vol': function must return a value}} */ -float4 foo_gro_pre_vol_con(groupshared precise volatile const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_vol_con': function must return a value}} */ -float4 foo_gro_pre_con(groupshared precise const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_con': function must return a value}} */ -float4 foo_gro_sta(groupshared static float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta': function must return a value}} */ -float4 foo_gro_sta_vol(groupshared static volatile float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta_vol': function must return a value}} */ -float4 foo_gro_sta_vol_con(groupshared static volatile const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta_vol_con': function must return a value}} */ -float4 foo_gro_sta_con(groupshared static const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta_con': function must return a value}} */ -float4 foo_gro_uni(groupshared uniform float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni': function must return a value}} */ -float4 foo_gro_uni_vol(groupshared uniform volatile float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni_vol': function must return a value}} */ -float4 foo_gro_uni_vol_con(groupshared uniform volatile const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni_vol_con': function must return a value}} */ -float4 foo_gro_uni_con(groupshared uniform const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni_con': function must return a value}} */ -float4 foo_gro_vol(groupshared volatile float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_vol': function must return a value}} */ -float4 foo_gro_vol_con(groupshared volatile const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_vol_con': function must return a value}} */ -float4 foo_gro_con(groupshared const float4 val) { return val; } /* expected-error {{'groupshared' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_con': function must return a value}} */ +float4 foo_gro(groupshared float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro': function must return a value}} */ +float4 foo_gro_pre(groupshared precise float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre': function must return a value}} */ +float4 foo_gro_pre_sta(groupshared precise static float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta': function must return a value}} */ +float4 foo_gro_pre_sta_vol(groupshared precise static volatile float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta_vol': function must return a value}} */ +float4 foo_gro_pre_sta_vol_con(groupshared precise static volatile const float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta_vol_con': function must return a value}} */ +float4 foo_gro_pre_sta_con(groupshared precise static const float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_sta_con': function must return a value}} */ +float4 foo_gro_pre_uni(groupshared precise uniform float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni': function must return a value}} */ +float4 foo_gro_pre_uni_vol(groupshared precise uniform volatile float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni_vol': function must return a value}} */ +float4 foo_gro_pre_uni_vol_con(groupshared precise uniform volatile const float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni_vol_con': function must return a value}} */ +float4 foo_gro_pre_uni_con(groupshared precise uniform const float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_uni_con': function must return a value}} */ +float4 foo_gro_pre_vol(groupshared precise volatile float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_vol': function must return a value}} */ +float4 foo_gro_pre_vol_con(groupshared precise volatile const float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_vol_con': function must return a value}} */ +float4 foo_gro_pre_con(groupshared precise const float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_pre_con': function must return a value}} */ +float4 foo_gro_sta(groupshared static float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta': function must return a value}} */ +float4 foo_gro_sta_vol(groupshared static volatile float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta_vol': function must return a value}} */ +float4 foo_gro_sta_vol_con(groupshared static volatile const float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta_vol_con': function must return a value}} */ +float4 foo_gro_sta_con(groupshared static const float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_sta_con': function must return a value}} */ +float4 foo_gro_uni(groupshared uniform float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni': function must return a value}} */ +float4 foo_gro_uni_vol(groupshared uniform volatile float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni_vol': function must return a value}} */ +float4 foo_gro_uni_vol_con(groupshared uniform volatile const float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni_vol_con': function must return a value}} */ +float4 foo_gro_uni_con(groupshared uniform const float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_uni_con': function must return a value}} */ +float4 foo_gro_vol(groupshared volatile float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_vol': function must return a value}} */ +float4 foo_gro_vol_con(groupshared volatile const float4 val) { return val; } /* expected-error {{'volatile' is not a valid modifier for a parameter}} fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_vol_con': function must return a value}} */ +float4 foo_gro_con(groupshared const float4 val) { return val; } /* fxc-error {{X3000: syntax error: unexpected token 'groupshared'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_gro_con': function must return a value}} */ float4 foo_ext(extern float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'extern'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_ext': function must return a value}} */ float4 foo_ext_pre(extern precise float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'extern'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_ext_pre': function must return a value}} */ float4 foo_ext_pre_uni(extern precise uniform float4 val) { return val; } /* expected-error {{invalid storage class specifier in function declarator}} fxc-error {{X3000: syntax error: unexpected token 'extern'}} fxc-error {{X3004: undeclared identifier 'val'}} fxc-error {{X3080: 'foo_ext_pre_uni': function must return a value}} */ From c3437faf4a337525e0247549a931cb5bb58baa78 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Tue, 16 Dec 2025 09:24:24 -0800 Subject: [PATCH 3/7] work on errors and warnings --- .../include/clang/Basic/DiagnosticSemaKinds.td | 7 +++++++ tools/clang/lib/Sema/SemaHLSL.cpp | 2 ++ tools/clang/lib/Sema/SemaOverload.cpp | 6 ++++++ .../SemaHLSL/v202x/groupshared/ExplicitCast.hlsl | 13 +++++++++++++ .../SemaHLSL/v202x/groupshared/InOutWarning.hlsl | 12 ++++++++++++ .../SemaHLSL/v202x/groupshared/Pre202xWarning.hlsl | 12 ++++++++++++ 6 files changed, 52 insertions(+) create mode 100644 tools/clang/test/SemaHLSL/v202x/groupshared/ExplicitCast.hlsl create mode 100644 tools/clang/test/SemaHLSL/v202x/groupshared/InOutWarning.hlsl create mode 100644 tools/clang/test/SemaHLSL/v202x/groupshared/Pre202xWarning.hlsl diff --git a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index 34a2195cbc..be12208111 100644 --- a/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -1597,6 +1597,13 @@ def warn_hlsl_sometimes_uninit_out_param : Warning< "its declaration is reached|" "%3 is called}2">, InGroup; +def warn_hlsl_groupshared_202x: Warning< + "Support for groupshared parameter annotation not added until HLSL 202x">, + InGroup; +def warn_hlsl_groupshared_inout: Warning< + "Passing groupshared variable to a parameter annotated with inout. See" + "'groupshared' parameter annotation added in 202x.">, + InGroup; // HLSL Change End - Add warning for uninitialized out param def warn_maybe_uninit_var : Warning< "variable %0 may be uninitialized when " diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 886a2b65ba..da1e5383db 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -15773,6 +15773,8 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, break; case AttributeList::AT_HLSLGroupShared: isGroupShared = true; + if (isParameter && getLangOpts().HLSLVersion < hlsl::LangStd::v202x) + Diag(pAttr->getLoc(), diag::warn_hlsl_groupshared_202x); if (isParameter && (usageIn || usageOut)) { Diag(pAttr->getLoc(), diag::err_hlsl_varmodifiersna) << pAttr->getName() << "in/out/inout modifiers" << declarationType; diff --git a/tools/clang/lib/Sema/SemaOverload.cpp b/tools/clang/lib/Sema/SemaOverload.cpp index a588231522..8ff76b10d6 100644 --- a/tools/clang/lib/Sema/SemaOverload.cpp +++ b/tools/clang/lib/Sema/SemaOverload.cpp @@ -4967,6 +4967,12 @@ InitCallParamConversions(Sema &S, const FunctionProtoType *Proto, } } + if (S.getLangOpts().HLSLVersion >= hlsl::LangStd::v202x && + paramMods.isAnyIn() && paramMods.isAnyOut() && + Arg->getType().getQualifiers().getAddressSpace() == + hlsl::DXIL::kTGSMAddrSpace) + S.Diag(Arg->getLocStart(), diag::warn_hlsl_groupshared_inout); + if (paramMods.isAnyIn()) { InConversion = TryCopyInitialization(S, Arg, ParamType, SuppressUserConversions, diff --git a/tools/clang/test/SemaHLSL/v202x/groupshared/ExplicitCast.hlsl b/tools/clang/test/SemaHLSL/v202x/groupshared/ExplicitCast.hlsl new file mode 100644 index 0000000000..55652e1866 --- /dev/null +++ b/tools/clang/test/SemaHLSL/v202x/groupshared/ExplicitCast.hlsl @@ -0,0 +1,13 @@ +// RUN: %dxc -T lib_6_3 -enable-16bit-types -HV 202x -verify %s + +groupshared uint16_t SharedData; + +void fn1(groupshared half Sh) { +// expected-note@-1{{candidate function not viable: 1st argument ('half') is in address space 0, but parameter must be in address space 3}} + Sh = 5; +} + +void fn2() { + fn1((half)SharedData); + // expected-error@-1{{no matching function for call to 'fn1'}} +} diff --git a/tools/clang/test/SemaHLSL/v202x/groupshared/InOutWarning.hlsl b/tools/clang/test/SemaHLSL/v202x/groupshared/InOutWarning.hlsl new file mode 100644 index 0000000000..9df686e643 --- /dev/null +++ b/tools/clang/test/SemaHLSL/v202x/groupshared/InOutWarning.hlsl @@ -0,0 +1,12 @@ +// RUN: %dxc -T lib_6_3 -HV 202x -verify %s + +groupshared uint SharedData; + +void fn1(inout uint Sh) { + Sh = 5; +} + +void fn2() { + fn1(SharedData); +// expected-warning@-1{{assing groupshared variable to a parameter annotated with inout. See'groupshared' parameter annotation added in 202x}} +} diff --git a/tools/clang/test/SemaHLSL/v202x/groupshared/Pre202xWarning.hlsl b/tools/clang/test/SemaHLSL/v202x/groupshared/Pre202xWarning.hlsl new file mode 100644 index 0000000000..1382be09a5 --- /dev/null +++ b/tools/clang/test/SemaHLSL/v202x/groupshared/Pre202xWarning.hlsl @@ -0,0 +1,12 @@ +// RUN: %dxc -T lib_6_3 -HV 2021 -verify %s + +groupshared uint SharedData; + +void fn1(groupshared uint Sh) { +// expected-warning@-1{{Support for groupshared parameter annotation not added until HLSL 202x}} + Sh = 5; +} + +void fn2() { + fn1(SharedData); +} From fdca3fc4d90e4fabe4425082cadacba53ea38a05 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Wed, 17 Dec 2025 16:14:30 -0800 Subject: [PATCH 4/7] make 202x to avoid adding warning for groupshared arg update tests to show new mangling --- lib/HLSL/HLLegalizeParameter.cpp | 2 +- tools/clang/lib/AST/MicrosoftMangle.cpp | 2 + tools/clang/lib/Sema/SemaDeclAttr.cpp | 3 +- tools/clang/lib/Sema/SemaHLSL.cpp | 4 +- tools/clang/lib/Sema/SemaOverload.cpp | 2 +- .../CodeGenHLSL/groupsharedArgs/ArrTest.hlsl | 2 +- .../groupsharedArgs/Overloads.hlsl | 37 +++++++++++++++++++ .../groupsharedArgs/ScalarTest.hlsl | 4 +- .../groupsharedArgs/StructTest.hlsl | 3 +- .../groupsharedArgs/TemplateTest.hlsl | 3 +- .../groupsharedArgs/VectorTest.hlsl | 3 +- tools/clang/test/SemaHLSL/varmods-syntax.hlsl | 2 +- 12 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/Overloads.hlsl diff --git a/lib/HLSL/HLLegalizeParameter.cpp b/lib/HLSL/HLLegalizeParameter.cpp index 9245d8e226..22fc05d6b6 100644 --- a/lib/HLSL/HLLegalizeParameter.cpp +++ b/lib/HLSL/HLLegalizeParameter.cpp @@ -258,7 +258,7 @@ bool HLLegalizeParameter::runOnModule(Module &M) { for (Argument &Arg : F.args()) { Type *PtrTy = dyn_cast(Arg.getType()); if (!PtrTy || 0 != PtrTy->getPointerAddressSpace()) - continue; + continue; Type *EltTy = dxilutil::GetArrayEltTy(Arg.getType()); if (dxilutil::IsHLSLObjectType(EltTy) || dxilutil::IsHLSLResourceType(EltTy)) diff --git a/tools/clang/lib/AST/MicrosoftMangle.cpp b/tools/clang/lib/AST/MicrosoftMangle.cpp index ae9f1cd7f8..66f4c9113a 100644 --- a/tools/clang/lib/AST/MicrosoftMangle.cpp +++ b/tools/clang/lib/AST/MicrosoftMangle.cpp @@ -2033,6 +2033,8 @@ void MicrosoftCXXNameMangler::mangleType(const LValueReferenceType *T, Qualifiers Quals, SourceRange Range) { QualType PointeeType = T->getPointeeType(); Out << (Quals.hasVolatile() ? 'B' : 'A'); + if (PointeeType.getQualifiers().getAddressSpace() == 3) + Out << 'G'; manglePointerExtQualifiers(Quals, PointeeType); mangleType(PointeeType, Range); } diff --git a/tools/clang/lib/Sema/SemaDeclAttr.cpp b/tools/clang/lib/Sema/SemaDeclAttr.cpp index 0d0040f0a8..8a45e56c2b 100644 --- a/tools/clang/lib/Sema/SemaDeclAttr.cpp +++ b/tools/clang/lib/Sema/SemaDeclAttr.cpp @@ -4948,7 +4948,8 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, if (S.LangOpts.HLSL) { bool Handled = false; hlsl::HandleDeclAttributeForHLSL(S, D, Attr, Handled); - if (Handled) break; + if (Handled) + break; } handleSimpleAttribute(S, D, Attr); break; diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index da1e5383db..bb00635c1d 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -15774,14 +15774,14 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth, case AttributeList::AT_HLSLGroupShared: isGroupShared = true; if (isParameter && getLangOpts().HLSLVersion < hlsl::LangStd::v202x) - Diag(pAttr->getLoc(), diag::warn_hlsl_groupshared_202x); + Diag(pAttr->getLoc(), diag::warn_hlsl_groupshared_202x); if (isParameter && (usageIn || usageOut)) { Diag(pAttr->getLoc(), diag::err_hlsl_varmodifiersna) << pAttr->getName() << "in/out/inout modifiers" << declarationType; result = false; } if (!(isGlobal || isParameter)) { - Diag(pAttr->getLoc(), diag::err_hlsl_varmodifierna) + Diag(pAttr->getLoc(), diag::err_hlsl_varmodifierna) << pAttr->getName() << declarationType << pAttr->getRange(); result = false; } diff --git a/tools/clang/lib/Sema/SemaOverload.cpp b/tools/clang/lib/Sema/SemaOverload.cpp index 8ff76b10d6..210109396c 100644 --- a/tools/clang/lib/Sema/SemaOverload.cpp +++ b/tools/clang/lib/Sema/SemaOverload.cpp @@ -4970,7 +4970,7 @@ InitCallParamConversions(Sema &S, const FunctionProtoType *Proto, if (S.getLangOpts().HLSLVersion >= hlsl::LangStd::v202x && paramMods.isAnyIn() && paramMods.isAnyOut() && Arg->getType().getQualifiers().getAddressSpace() == - hlsl::DXIL::kTGSMAddrSpace) + hlsl::DXIL::kTGSMAddrSpace) S.Diag(Arg->getLocStart(), diag::warn_hlsl_groupshared_inout); if (paramMods.isAnyIn()) { diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl index 2630f72472..f4bfd02570 100644 --- a/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ArrTest.hlsl @@ -2,7 +2,7 @@ groupshared float4 SharedArr[64]; -// CHECK-LABEL: define internal void {{.*}}fn{{.*}}([64 x <4 x float>] addrspace(3)* dereferenceable(1024) %Arr, float %F) +// CHECK-LABEL: define internal void @"\01?fn@@YAXAGAY0EA@$$CAV?$vector@M$03@@M@Z"([64 x <4 x float>] addrspace(3)* dereferenceable(1024) %Arr, float %F) // CHECK: [[ArrIdx:%.*]] = getelementptr inbounds [64 x <4 x float>], [64 x <4 x float>] addrspace(3)* %Arr, i32 0, i32 5 // CHECK-NEXT: store <4 x float> {{.*}}, <4 x float> addrspace(3)* [[ArrIdx]], align 4 void fn(groupshared float4 Arr[64], float F) { diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/Overloads.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/Overloads.hlsl new file mode 100644 index 0000000000..dcb06762d6 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/Overloads.hlsl @@ -0,0 +1,37 @@ +// RUN: %dxc -E main -T cs_6_0 -HV 202x -fcgl %s | FileCheck %s + +// Verify we are calling the correct overloads +void fn(groupshared float4 Arr[2]); +void fn(inout float4 Arr[2]); + +void fn2(groupshared int4 Shared); +void fn2(int4 Local); + +// CHECK-LABEL: define void @main() +[numthreads(4,1,1)] +void main() { + float4 Local[2] = {1.0.xxxx, 2.0.xxxx}; +// CHECK-DAG: call void @"\01?fn@@YAXY01$$CAV?$vector@M$03@@@Z"([2 x <4 x float>]* %Local) + fn(Local); + +// CHECK-DAG: call void @"\01?fn2@@YAXV?$vector@H$03@@@Z"(<4 x i32> + fn2(11.xxxx); +} + +void fn(groupshared float4 Arr[2]) { + Arr[1] = 7.0.xxxx; +} + +// CHECK-LABEL: define internal void @"\01?fn@@YAXY01$$CAV?$vector@M$03@@@Z"([2 x <4 x float>]* noalias %Arr) +void fn(inout float4 Arr[2]) { + Arr[1] = 5.0.xxxx; +} + +void fn2(groupshared int4 Shared) { + Shared.x = 10; +} + +// CHECK-DAG: define internal void @"\01?fn2@@YAXV?$vector@H$03@@@Z"(<4 x i32> %Local) +void fn2(int4 Local) { + int X = Local.y; +} diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl index 4ffef256d3..5fb170a15e 100644 --- a/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/ScalarTest.hlsl @@ -2,14 +2,14 @@ groupshared uint16_t SharedData; -// CHECK-LABEL: fn1 +// mangling changes added the first G +// CHECK-LABEL: @"\01?fn1@@YAXAGAG@Z" // CHECK: store i16 5, i16 addrspace(3)* %Sh, align 4 void fn1(groupshared uint16_t Sh) { Sh = 5; } [numthreads(4, 1, 1)] -// call void @"\01?fn1@@YAXAAG@Z"(i16 addrspace(3)* dereferenceable(2) @"\01?SharedData@@3GA") void main(uint3 TID : SV_GroupThreadID) { fn1(SharedData); } diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl index b62f1ed251..d5ec94bed6 100644 --- a/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/StructTest.hlsl @@ -8,7 +8,7 @@ struct Shared { groupshared Shared SharedData; -// CHECK-LABEL: fn1 +// CHECK-LABEL: @"\01?fn1@@YAXAGAUShared@@@Z" // CHECK: [[D:%.*]] = alloca double, align 8 // CHECK: [[A:%.*]] = getelementptr inbounds %struct.Shared, %struct.Shared addrspace(3)* %Sh, i32 0, i32 0 // CHECK: store i32 10, i32 addrspace(3)* [[A]], align 4 @@ -27,7 +27,6 @@ void fn1(groupshared Shared Sh) { } [numthreads(4, 1, 1)] -// call void @"\01?fn1@@YAXAAUShared@@@Z"(%struct.Shared addrspace(3)* dereferenceable(40) @"\01?SharedData@@3UShared@@A") void main(uint3 TID : SV_GroupThreadID) { fn1(SharedData); } diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl index 9db9aef5e3..48a615a196 100644 --- a/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/TemplateTest.hlsl @@ -8,7 +8,7 @@ template struct Shared { groupshared Shared SharedData; -// CHECK-LABEL: fn1 +// CHECK-LABEL: @"\01?fn1@@YAXAGAU?$Shared@H@@@Z" // CHECK: [[D:%.*]] = alloca double, align 8 // CHECK: [[A:%.*]] = getelementptr inbounds %"struct.Shared", %"struct.Shared" addrspace(3)* %Sh, i32 0, i32 0 // CHECK: store i32 10, i32 addrspace(3)* [[A]], align 4 @@ -27,7 +27,6 @@ void fn1(groupshared Shared Sh) { } [numthreads(4, 1, 1)] -// call void @"\01?fn1@@YAXAAUShared@@@Z"(%struct.Shared addrspace(3)* dereferenceable(40) @"\01?SharedData@@3UShared@@A") void main(uint3 TID : SV_GroupThreadID) { fn1(SharedData); } diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl index ba73529293..d34d4aa421 100644 --- a/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/VectorTest.hlsl @@ -2,7 +2,7 @@ groupshared float4 SharedData; -// CHECK-LABEL: fn1 +// CHECK-LABEL: @"\01?fn1@@YAXAGAV?$vector@M$03@@@Z" // CHECK: [[Tmp:%.*]] = alloca <1 x float>, align 4 // CHECK: store <1 x float> , <1 x float>* [[Tmp]] // CHECK: [[Z:%.*]] = load <1 x float>, <1 x float>* [[Tmp]] @@ -13,7 +13,6 @@ void fn1(groupshared float4 Sh) { } [numthreads(4, 1, 1)] -// call void @"\01?fn1@@YAXAAV?$vector@M$03@@@Z"(<4 x float> addrspace(3)* dereferenceable(16) @"\01?SharedData@@3V?$vector@M$03@@A"), !dbg !25 ; line:13 col:3 void main(uint3 TID : SV_GroupThreadID) { fn1(SharedData); } diff --git a/tools/clang/test/SemaHLSL/varmods-syntax.hlsl b/tools/clang/test/SemaHLSL/varmods-syntax.hlsl index b9e312bfbf..17fa7cd810 100644 --- a/tools/clang/test/SemaHLSL/varmods-syntax.hlsl +++ b/tools/clang/test/SemaHLSL/varmods-syntax.hlsl @@ -1,4 +1,4 @@ -// RUN: %dxc -Tlib_6_3 -verify %s +// RUN: %dxc -Tlib_6_3 -HV 202x -verify %s // The following is meant to be processed by the CodeTags extension in the "VS For Everything" Visual Studio extension: /* From c3cadacf7c5223deff9a24727f8252cbb6afe0c7 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 5 Jan 2026 09:57:53 -0800 Subject: [PATCH 5/7] self review --- tools/clang/lib/CodeGen/CGHLSLMS.cpp | 11 +++-------- tools/clang/lib/Sema/SemaHLSL.cpp | 6 ++++-- tools/clang/lib/Sema/SemaOverload.cpp | 2 +- .../groupsharedArgs/MatrixTest.hlsl | 18 ++++++++++++++++++ 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 tools/clang/test/CodeGenHLSL/groupsharedArgs/MatrixTest.hlsl diff --git a/tools/clang/lib/CodeGen/CGHLSLMS.cpp b/tools/clang/lib/CodeGen/CGHLSLMS.cpp index 1e8bd32702..ee7724c3a9 100644 --- a/tools/clang/lib/CodeGen/CGHLSLMS.cpp +++ b/tools/clang/lib/CodeGen/CGHLSLMS.cpp @@ -1245,6 +1245,9 @@ unsigned CGMSHLSLRuntime::AddTypeAnnotation(QualType Ty, if (const ReferenceType *RefType = dyn_cast(paramTy)) paramTy = RefType->getPointeeType(); + if (const ReferenceType *RefType = dyn_cast(Ty)) + Ty = RefType->getPointeeType(); + // Get size. llvm::Type *Type = CGM.getTypes().ConvertType(paramTy); unsigned size = dataLayout.getTypeAllocSize(Type); @@ -1309,14 +1312,6 @@ unsigned CGMSHLSLRuntime::AddTypeAnnotation(QualType Ty, const IncompleteArrayType *arrayTy = CGM.getContext().getAsIncompleteArrayType(Ty); arrayElementTy = arrayTy->getElementType(); - } else if (paramTy->isConstantArrayType()) { - // hacky because unclear proper usage of paramTy vs Ty... - const ConstantArrayType *arrayTy = - CGM.getContext().getAsConstantArrayType(paramTy); - DXASSERT(arrayTy != nullptr, "Must be array type here"); - - arraySize = arrayTy->getSize().getLimitedValue(); - arrayElementTy = arrayTy->getElementType(); } else { DXASSERT(0, "Must array type here"); } diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index bb00635c1d..9dcf670956 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -14483,9 +14483,11 @@ void Sema::DiagnoseHLSLDeclAttr(const Decl *D, const Attr *A) { continue; for (Attr *A : PVD->getAttrs()) { switch (A->getKind()) { - case clang::attr::HLSLGroupShared: { // todo improve this error msg + case clang::attr::HLSLGroupShared: { Diag(A->getLocation(), diag::err_hlsl_varmodifiersna) - << "groupshared" << "export/noinline" << "parameter"; + << "groupshared" + << "export/noinline" + << "parameter"; return; break; } diff --git a/tools/clang/lib/Sema/SemaOverload.cpp b/tools/clang/lib/Sema/SemaOverload.cpp index 210109396c..d874186e28 100644 --- a/tools/clang/lib/Sema/SemaOverload.cpp +++ b/tools/clang/lib/Sema/SemaOverload.cpp @@ -4962,7 +4962,7 @@ InitCallParamConversions(Sema &S, const FunctionProtoType *Proto, hlsl::DXIL::kTGSMAddrSpace) { InConversion.setBad(BadConversionSequence::no_conversion, Arg->getType(), ParamType); - InConversion.Bad.FromExpr = Arg; // hack for now + InConversion.Bad.FromExpr = Arg; return; } } diff --git a/tools/clang/test/CodeGenHLSL/groupsharedArgs/MatrixTest.hlsl b/tools/clang/test/CodeGenHLSL/groupsharedArgs/MatrixTest.hlsl new file mode 100644 index 0000000000..913a364d63 --- /dev/null +++ b/tools/clang/test/CodeGenHLSL/groupsharedArgs/MatrixTest.hlsl @@ -0,0 +1,18 @@ +// RUN: %dxc -E main -T cs_6_3 -HV 202x -fcgl %s | FileCheck %s + +groupshared float4x4 SharedData; + +// CHECK-LABEL: @"\01?fn1@@YAXAGAV?$matrix@M$03$03@@@Z" +// CHECK: [[M1:%.*]] = addrspacecast %class.matrix.float.4.4 addrspace(3)* %Sh to %class.matrix.float.4.4* +// CHECK: [[A:%.*]] = call <4 x float>* @"dx.hl.subscript.colMajor[].rn.<4 x float>* (i32, %class.matrix.float.4.4*, i32, i32, i32, i32)"(i32 1, %class.matrix.float.4.4* [[M1]], i32 0, i32 4, i32 8, i32 12) +// CHECK: [[B:%.*]] = getelementptr <4 x float>, <4 x float>* [[A]], i32 0, i32 1 +// CHECK: store float 5.000000e+00, float* [[B]] +// CHECK: ret void +void fn1(groupshared float4x4 Sh) { + Sh[0][1] = 5.0; +} + +[numthreads(4,1,1)] +void main(uint3 TID : SV_GroupThreadID) { + fn1(SharedData); +} From 8511e4efe9344b5a326a358463f14582da38fe07 Mon Sep 17 00:00:00 2001 From: Sarah Spall Date: Mon, 5 Jan 2026 10:16:00 -0800 Subject: [PATCH 6/7] attempt to make clang format happy --- tools/clang/lib/Sema/SemaHLSL.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 9dcf670956..56bb346cfa 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -14485,9 +14485,9 @@ void Sema::DiagnoseHLSLDeclAttr(const Decl *D, const Attr *A) { switch (A->getKind()) { case clang::attr::HLSLGroupShared: { Diag(A->getLocation(), diag::err_hlsl_varmodifiersna) - << "groupshared" - << "export/noinline" - << "parameter"; + << "groupshared" + << "export/noinline" + << "parameter"; return; break; } From 03e93a7ea3b2c173aa349003e3b9b1f799ce21a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 6 Jan 2026 21:38:05 +0000 Subject: [PATCH 7/7] chore: autopublish 2026-01-06T21:38:05Z --- tools/clang/lib/CodeGen/CGHLSLMS.cpp | 2 +- tools/clang/lib/Sema/SemaHLSL.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/clang/lib/CodeGen/CGHLSLMS.cpp b/tools/clang/lib/CodeGen/CGHLSLMS.cpp index ee7724c3a9..200f62f68d 100644 --- a/tools/clang/lib/CodeGen/CGHLSLMS.cpp +++ b/tools/clang/lib/CodeGen/CGHLSLMS.cpp @@ -1247,7 +1247,7 @@ unsigned CGMSHLSLRuntime::AddTypeAnnotation(QualType Ty, if (const ReferenceType *RefType = dyn_cast(Ty)) Ty = RefType->getPointeeType(); - + // Get size. llvm::Type *Type = CGM.getTypes().ConvertType(paramTy); unsigned size = dataLayout.getTypeAllocSize(Type); diff --git a/tools/clang/lib/Sema/SemaHLSL.cpp b/tools/clang/lib/Sema/SemaHLSL.cpp index 56bb346cfa..07fbd523b6 100644 --- a/tools/clang/lib/Sema/SemaHLSL.cpp +++ b/tools/clang/lib/Sema/SemaHLSL.cpp @@ -14485,7 +14485,7 @@ void Sema::DiagnoseHLSLDeclAttr(const Decl *D, const Attr *A) { switch (A->getKind()) { case clang::attr::HLSLGroupShared: { Diag(A->getLocation(), diag::err_hlsl_varmodifiersna) - << "groupshared" + << "groupshared" << "export/noinline" << "parameter"; return;