Skip to content

Commit 6c0e660

Browse files
authored
Merge branch 'main' into cfi/aarch64
2 parents c4aef66 + 78671db commit 6c0e660

File tree

104 files changed

+1107
-621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1107
-621
lines changed

.clang-format-ignore

Whitespace-only changes.

clang-tools-extra/clang-doc/HTMLGenerator.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,6 @@ genHTML(const EnumInfo &I, const ClangDocContext &CDCtx) {
716716

717717
maybeWriteSourceFileRef(Out, CDCtx, I.DefLoc);
718718

719-
std::string Description;
720719
if (!I.Description.empty())
721720
Out.emplace_back(genHTML(I.Description));
722721

@@ -759,7 +758,6 @@ genHTML(const FunctionInfo &I, const ClangDocContext &CDCtx,
759758

760759
maybeWriteSourceFileRef(Out, CDCtx, I.DefLoc);
761760

762-
std::string Description;
763761
if (!I.Description.empty())
764762
Out.emplace_back(genHTML(I.Description));
765763

@@ -777,7 +775,6 @@ genHTML(const NamespaceInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
777775

778776
Out.emplace_back(std::make_unique<TagNode>(HTMLTag::TAG_H1, InfoTitle));
779777

780-
std::string Description;
781778
if (!I.Description.empty())
782779
Out.emplace_back(genHTML(I.Description));
783780

@@ -820,7 +817,6 @@ genHTML(const RecordInfo &I, Index &InfoIndex, const ClangDocContext &CDCtx,
820817

821818
maybeWriteSourceFileRef(Out, CDCtx, I.DefLoc);
822819

823-
std::string Description;
824820
if (!I.Description.empty())
825821
Out.emplace_back(genHTML(I.Description));
826822

clang/include/clang/Basic/DiagnosticGroups.td

+3
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,9 @@ def HLSLExtension : DiagGroup<"hlsl-extensions", [HLSL202y]>;
16121612
// Warning for mix packoffset and non-packoffset.
16131613
def HLSLMixPackOffset : DiagGroup<"mix-packoffset">;
16141614

1615+
// Warning for implicit resource bindings.
1616+
def HLSLImplicitBinding : DiagGroup<"hlsl-implicit-binding">;
1617+
16151618
// Warnings for DXIL validation
16161619
def DXILValidation : DiagGroup<"dxil-validation">;
16171620

clang/include/clang/Basic/DiagnosticSemaKinds.td

+1
Original file line numberDiff line numberDiff line change
@@ -12734,6 +12734,7 @@ def warn_hlsl_deprecated_register_type_i: Warning<"binding type 'i' ignored. The
1273412734
def err_hlsl_unsupported_register_number : Error<"register number should be an integer">;
1273512735
def err_hlsl_expected_space : Error<"invalid space specifier '%0' used; expected 'space' followed by an integer, like space1">;
1273612736
def err_hlsl_space_on_global_constant : Error<"register space cannot be specified on global constants">;
12737+
def warn_hlsl_implicit_binding : Warning<"resource has implicit register binding">, InGroup<HLSLImplicitBinding>, DefaultError;
1273712738
def warn_hlsl_packoffset_mix : Warning<"cannot mix packoffset elements with nonpackoffset elements in a cbuffer">,
1273812739
InGroup<HLSLMixPackOffset>;
1273912740
def err_hlsl_packoffset_overlap : Error<"packoffset overlap between %0, %1">;

clang/include/clang/Driver/Types.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ TYPE("assembler-with-cpp", Asm, PP_Asm, "S", phases
8888
// modules when Flang needs to emit pre-processed files. Therefore, the
8989
// `PP_TYPE` is set to `PP_Fortran` so that the driver is fine with
9090
// "pre-processing a pre-processed file".
91-
TYPE("f95", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
92-
TYPE("f95-cpp-input", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
91+
TYPE("f95", Fortran, PP_Fortran, nullptr, phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
92+
TYPE("f95-cpp-input", PP_Fortran, PP_Fortran, "i", phases::Preprocess, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
9393
TYPE("java", Java, INVALID, nullptr, phases::Compile, phases::Backend, phases::Assemble, phases::Link)
9494

9595
// LLVM IR/LTO types. We define separate types for IR and LTO because LTO

clang/lib/Parse/ParseHLSL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Decl *Parser::ParseHLSLBuffer(SourceLocation &DeclEnd) {
7575
Decl *D = Actions.HLSL().ActOnStartBuffer(getCurScope(), IsCBuffer, BufferLoc,
7676
Identifier, IdentifierLoc,
7777
T.getOpenLocation());
78+
Actions.ProcessDeclAttributeList(Actions.CurScope, D, Attrs);
7879

7980
while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) {
8081
// FIXME: support attribute on constants inside cbuffer/tbuffer.
@@ -98,7 +99,6 @@ Decl *Parser::ParseHLSLBuffer(SourceLocation &DeclEnd) {
9899
BufferScope.Exit();
99100
Actions.HLSL().ActOnFinishBuffer(D, DeclEnd);
100101

101-
Actions.ProcessDeclAttributeList(Actions.CurScope, D, Attrs);
102102
return D;
103103
}
104104

clang/lib/Sema/SemaHLSL.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ static bool isResourceRecordTypeOrArrayOf(const Type *Ty) {
305305
return HLSLAttributedResourceType::findHandleTypeOnResource(Ty) != nullptr;
306306
}
307307

308+
static bool isResourceRecordTypeOrArrayOf(VarDecl *VD) {
309+
return isResourceRecordTypeOrArrayOf(VD->getType().getTypePtr());
310+
}
311+
308312
// Returns true if the type is a leaf element type that is not valid to be
309313
// included in HLSL Buffer, such as a resource class, empty struct, zero-sized
310314
// array, or a builtin intangible type. Returns false it is a valid leaf element
@@ -541,6 +545,10 @@ void SemaHLSL::ActOnFinishBuffer(Decl *Dcl, SourceLocation RBrace) {
541545
// create buffer layout struct
542546
createHostLayoutStructForBuffer(SemaRef, BufDecl);
543547

548+
if (std::none_of(Dcl->attr_begin(), Dcl->attr_end(),
549+
[](Attr *A) { return isa<HLSLResourceBindingAttr>(A); }))
550+
SemaRef.Diag(Dcl->getLocation(), diag::warn_hlsl_implicit_binding);
551+
544552
SemaRef.PopDeclContext();
545553
}
546554

@@ -3248,10 +3256,12 @@ void SemaHLSL::collectResourceBindingsOnVarDecl(VarDecl *VD) {
32483256
void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) {
32493257
assert(VD->hasGlobalStorage() && "expected global variable");
32503258

3259+
bool HasBinding = false;
32513260
for (Attr *A : VD->attrs()) {
32523261
HLSLResourceBindingAttr *RBA = dyn_cast<HLSLResourceBindingAttr>(A);
32533262
if (!RBA)
32543263
continue;
3264+
HasBinding = true;
32553265

32563266
RegisterType RT = RBA->getRegisterType();
32573267
assert(RT != RegisterType::I && "invalid or obsolete register type should "
@@ -3278,6 +3288,9 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) {
32783288
<< static_cast<int>(RT);
32793289
}
32803290
}
3291+
3292+
if (!HasBinding && isResourceRecordTypeOrArrayOf(VD))
3293+
SemaRef.Diag(VD->getLocation(), diag::warn_hlsl_implicit_binding);
32813294
}
32823295

32833296
static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E,

clang/test/AST/HLSL/ByteAddressBuffers-AST.hlsl

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
22
// RUN: -DRESOURCE=ByteAddressBuffer %s | FileCheck -DRESOURCE=ByteAddressBuffer \
33
// RUN: -check-prefix=EMPTY %s
44
//
5-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
5+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
66
// RUN: -DRESOURCE=ByteAddressBuffer %s | FileCheck -DRESOURCE=ByteAddressBuffer \
77
// RUN: -check-prefixes=CHECK,CHECK-SRV,CHECK-NOSUBSCRIPT %s
88
//
9-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
9+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1010
// RUN: -DRESOURCE=RWByteAddressBuffer %s | FileCheck -DRESOURCE=RWByteAddressBuffer \
1111
// RUN: -check-prefix=EMPTY %s
1212
//
13-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
13+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
1414
// RUN: -DRESOURCE=RWByteAddressBuffer %s | FileCheck -DRESOURCE=RWByteAddressBuffer \
1515
// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-NOSUBSCRIPT %s
1616
//
17-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
17+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1818
// RUN: -DRESOURCE=RasterizerOrderedByteAddressBuffer %s | FileCheck -DRESOURCE=RasterizerOrderedByteAddressBuffer \
1919
// RUN: -check-prefix=EMPTY %s
2020
//
21-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
21+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
2222
// RUN: -DRESOURCE=RasterizerOrderedByteAddressBuffer %s | FileCheck -DRESOURCE=RasterizerOrderedByteAddressBuffer \
2323
// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-NOSUBSCRIPT %s
2424

clang/test/AST/HLSL/OutArgExpr.hlsl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: rm -f %t.pch
2-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-pch -finclude-default-header -o %t.pch %s
3-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -include-pch %t.pch %s -ast-dump | FileCheck --check-prefix=AST %s
4-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -include-pch %t.pch %s -ast-print | FileCheck %s
2+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-compute -emit-pch -finclude-default-header -o %t.pch %s
3+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -include-pch %t.pch %s -ast-dump | FileCheck --check-prefix=AST %s
4+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-compute -finclude-default-header -include-pch %t.pch %s -ast-print | FileCheck %s
55

66

77
#ifndef TEST_HLSL

clang/test/AST/HLSL/StructuredBuffers-AST.hlsl

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
22
// RUN: -DRESOURCE=StructuredBuffer %s | FileCheck -DRESOURCE=StructuredBuffer \
33
// RUN: -check-prefix=EMPTY %s
44
//
5-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
5+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
66
// RUN: -DRESOURCE=StructuredBuffer %s | FileCheck -DRESOURCE=StructuredBuffer \
77
// RUN: -check-prefixes=CHECK,CHECK-SRV,CHECK-SUBSCRIPT,CHECK-LOAD %s
88
//
9-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
9+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1010
// RUN: -DRESOURCE=RWStructuredBuffer %s | FileCheck -DRESOURCE=RWStructuredBuffer \
1111
// RUN: -check-prefix=EMPTY %s
1212
//
13-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
13+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
1414
// RUN: -DRESOURCE=RWStructuredBuffer %s | FileCheck -DRESOURCE=RWStructuredBuffer \
1515
// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-SUBSCRIPT,CHECK-COUNTER,CHECK-LOAD %s
1616
//
17-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
17+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1818
// RUN: -DRESOURCE=AppendStructuredBuffer %s | FileCheck -DRESOURCE=AppendStructuredBuffer \
1919
// RUN: -check-prefix=EMPTY %s
2020
//
21-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
21+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
2222
// RUN: -DRESOURCE=AppendStructuredBuffer %s | FileCheck -DRESOURCE=AppendStructuredBuffer \
2323
// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-NOSUBSCRIPT,CHECK-APPEND %s
2424
//
25-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
25+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
2626
// RUN: -DRESOURCE=ConsumeStructuredBuffer %s | FileCheck -DRESOURCE=ConsumeStructuredBuffer \
2727
// RUN: -check-prefix=EMPTY %s
2828
//
29-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
29+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
3030
// RUN: -DRESOURCE=ConsumeStructuredBuffer %s | FileCheck -DRESOURCE=ConsumeStructuredBuffer \
3131
// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-NOSUBSCRIPT,CHECK-CONSUME %s
3232
//
33-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
33+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
3434
// RUN: -DRESOURCE=RasterizerOrderedStructuredBuffer %s | FileCheck -DRESOURCE=RasterizerOrderedStructuredBuffer \
3535
// RUN: -check-prefix=EMPTY %s
3636
//
37-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
37+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
3838
// RUN: -DRESOURCE=RasterizerOrderedStructuredBuffer %s | FileCheck -DRESOURCE=RasterizerOrderedStructuredBuffer \
3939
// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-ROV,CHECK-SUBSCRIPT,CHECK-LOAD %s
4040

clang/test/AST/HLSL/TypedBuffers-AST.hlsl

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \
22
// RUN: -DRESOURCE=RWBuffer %s | FileCheck -DRESOURCE=RWBuffer -check-prefix=EMPTY %s
33
//
4-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
4+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \
55
// RUN: -DRESOURCE=RWBuffer %s | FileCheck -DRESOURCE=RWBuffer \
66
// RUN: -check-prefixes=CHECK,CHECK-UAV %s
77

@@ -66,7 +66,7 @@ RESOURCE<float> Buffer;
6666
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t
6767
// CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
6868
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]]
69-
// CHECK-SAME: ' lvalue .__handle {{.*}}
69+
// CHECK-SAME: ' lvalue .__handle {{.*}}
7070
// CHECK-NEXT: CXXThisExpr {{.*}} 'const [[RESOURCE]]<element_type>' lvalue implicit this
7171
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'Index' 'unsigned int'
7272
// CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
@@ -81,7 +81,7 @@ RESOURCE<float> Buffer;
8181
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t
8282
// CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
8383
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]]
84-
// CHECK-SAME: ' lvalue .__handle {{.*}}
84+
// CHECK-SAME: ' lvalue .__handle {{.*}}
8585
// CHECK-NEXT: CXXThisExpr {{.*}} '[[RESOURCE]]<element_type>' lvalue implicit this
8686
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'Index' 'unsigned int'
8787
// CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline
@@ -96,7 +96,7 @@ RESOURCE<float> Buffer;
9696
// CHECK-NEXT: MemberExpr {{.*}} '__hlsl_resource_t
9797
// CHECK-SAME{LITERAL}: [[hlsl::resource_class(UAV)]]
9898
// CHECK-SAME{LITERAL}: [[hlsl::contained_type(element_type)]]
99-
// CHECK-SAME: ' lvalue .__handle {{.*}}
99+
// CHECK-SAME: ' lvalue .__handle {{.*}}
100100
// CHECK-NEXT: CXXThisExpr {{.*}} '[[RESOURCE]]<element_type>' lvalue implicit this
101101
// CHECK-NEXT: DeclRefExpr {{.*}} 'unsigned int' ParmVar {{.*}} 'Index' 'unsigned int'
102102
// CHECK-NEXT: AlwaysInlineAttr {{.*}} Implicit always_inline

clang/test/AST/HLSL/ast-dump-comment-cbuffer.hlsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -Wdocumentation -ast-dump=json -x hlsl -triple dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefix=JSON
2-
// RUN: %clang_cc1 -Wdocumentation -ast-dump -x hlsl -triple dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefix=AST
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -Wdocumentation -ast-dump=json -x hlsl -triple dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefix=JSON
2+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -Wdocumentation -ast-dump -x hlsl -triple dxil-pc-shadermodel6.3-library %s | FileCheck %s --check-prefix=AST
33

44
// JSON:"kind": "HLSLBufferDecl",
55
// JSON:"name": "A",

clang/test/AST/HLSL/cbuffer.hlsl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
22

33
struct EmptyStruct {
44
};
@@ -55,14 +55,14 @@ cbuffer CB {
5555
}
5656
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(OneFloat, __cblayout_CB), "");
5757

58-
// Check that buffer layout struct does not include resources or empty types
58+
// Check that buffer layout struct does not include resources or empty types
5959
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
6060
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
6161
cbuffer CB {
6262
// CHECK: VarDecl {{.*}} used a2 'hlsl_constant float'
6363
float a2;
6464
// CHECK: VarDecl {{.*}} b2 'RWBuffer<float>':'hlsl::RWBuffer<float>'
65-
RWBuffer<float> b2;
65+
RWBuffer<float> b2;
6666
// CHECK: VarDecl {{.*}} c2 'EmptyStruct'
6767
EmptyStruct c2;
6868
// CHECK: VarDecl {{.*}} d2 'float[0]'
@@ -123,7 +123,7 @@ _Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(TwoFloats, __cblay
123123

124124
// check that layout struct is created for E because because its base struct
125125
// is empty and should be eliminated, and BTypedef should reuse the previously
126-
// defined '__cblayout_B'
126+
// defined '__cblayout_B'
127127
// CHECK: HLSLBufferDecl {{.*}} line:[[# @LINE + 2]]:9 cbuffer CB
128128
// CHECK: HLSLResourceClassAttr {{.*}} Implicit CBuffer
129129
cbuffer CB {

clang/test/AST/HLSL/cbuffer_and_namespaces.hlsl

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
22

33
// CHECK: CXXRecordDecl {{.*}} struct EmptyStruct definition
44
struct EmptyStruct {
@@ -7,11 +7,11 @@ struct EmptyStruct {
77
// CHECK: NamespaceDecl {{.*}} NS1
88
namespace NS1 {
99
// CHECK: CXXRecordDecl {{.*}} struct Foo definition
10-
struct Foo {
10+
struct Foo {
1111
float a;
1212
EmptyStruct es;
1313
};
14-
14+
1515
// CHECK: CXXRecordDecl {{.*}} struct Bar definition
1616
struct Bar {
1717
// CHECK: CXXRecordDecl {{.*}} struct Foo definition
@@ -56,7 +56,7 @@ struct CB1ExpectedShape {
5656
_Static_assert(__builtin_hlsl_is_scalarized_layout_compatible(CB1ExpectedShape, __cblayout_CB1), "");
5757

5858
namespace NS2 {
59-
struct Foo {
59+
struct Foo {
6060
float d[4];
6161
EmptyStruct es;
6262
};

clang/test/AST/HLSL/default_cbuffer.hlsl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.3-library -ast-dump -o - %s | FileCheck %s
22

33
struct EmptyStruct {
44
};
@@ -14,7 +14,7 @@ struct S {
1414
float a;
1515

1616
// CHECK: VarDecl {{.*}} b 'RWBuffer<float>':'hlsl::RWBuffer<float>'
17-
RWBuffer<float> b;
17+
RWBuffer<float> b;
1818

1919
// CHECK: VarDecl {{.*}} c 'EmptyStruct'
2020
EmptyStruct c;

clang/test/AST/HLSL/is_structured_resource_element_compatible_concept.hlsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_structured_resource_element_compatible %s | FileCheck %s
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_structured_resource_element_compatible %s | FileCheck %s
22

33
// CHECK: ConceptDecl {{.*}} __is_structured_resource_element_compatible
44
// CHECK: |-TemplateTypeParmDecl {{.*}} referenced typename depth 0 index 0 element_type

clang/test/AST/HLSL/is_typed_resource_element_compatible_concept.hlsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_typed_resource_element_compatible %s | FileCheck %s
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -ast-dump-filter=__is_typed_resource_element_compatible %s | FileCheck %s
22

33
// CHECK: ConceptDecl {{.*}} __is_typed_resource_element_compatible
44
// CHECK: |-TemplateTypeParmDecl {{.*}} referenced typename depth 0 index 0 element_type

clang/test/AST/HLSL/packoffset.hlsl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -fnative-half-type -ast-dump -x hlsl %s | FileCheck %s
1+
// RUN: %clang_cc1 -Wno-hlsl-implicit-binding -triple dxil-unknown-shadermodel6.3-library -S -finclude-default-header -fnative-half-type -ast-dump -x hlsl %s | FileCheck %s
22

33

44
// CHECK: HLSLBufferDecl {{.*}} cbuffer A

0 commit comments

Comments
 (0)