diff options
author | Sarah Spall <sarahspall@microsoft.com> | 2025-04-07 15:25:47 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-07 15:25:47 -0700 |
commit | 01bc672b8a41774feff445b07e749262597501e4 (patch) | |
tree | 4d2f782a36d35724dc98cd83ca8a4909e50dad3d /clang/lib/CodeGen | |
parent | ad9f15ab5335ed3c3c40d3c148658b8f2c4223d6 (diff) | |
download | llvm-01bc672b8a41774feff445b07e749262597501e4.zip llvm-01bc672b8a41774feff445b07e749262597501e4.tar.gz llvm-01bc672b8a41774feff445b07e749262597501e4.tar.bz2 |
[HLSL] Desugar ConstantArrayType when calculating cbuffer field layout (#134683)
When calculating the layout for a cbuffer field, if that field is a
ConstantArrayType, desguar it before casting it to a ConstantArrayType.
Closes #134668
---------
Co-authored-by: Eli Friedman <efriedma@quicinc.com>
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp b/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp index b546b6d..1ed3389 100644 --- a/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp +++ b/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp @@ -195,7 +195,7 @@ bool HLSLBufferLayoutBuilder::layoutField(const FieldDecl *FD, // Unwrap array to find the element type and get combined array size.
QualType Ty = FieldTy;
while (Ty->isConstantArrayType()) {
- const ConstantArrayType *ArrayTy = cast<ConstantArrayType>(Ty);
+ auto *ArrayTy = CGM.getContext().getAsConstantArrayType(Ty);
ArrayCount *= ArrayTy->getSExtSize();
Ty = ArrayTy->getElementType();
}
|