Skip to content

Commit 22338cb

Browse files
committed
Updates based on PR review feedback
1 parent 60434e3 commit 22338cb

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

clang/lib/AST/DeclCXX.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,11 @@ void CXXRecordDecl::addedMember(Decl *D) {
14641464
}
14651465

14661466
// HLSL: All user-defined data types are aggregates and use aggregate
1467-
// initialization. This _needs_ to change in the future. There are two
1467+
// initialization, meanwhile most, but not all built-in types behave like
1468+
// aggregates. Resource types, and some other HLSL types that wrap handles
1469+
// don't behave like aggregates. We can identify these as different because we
1470+
// implicitly define "special" member functions, which aren't spellable in
1471+
// HLSL. This all _needs_ to change in the future. There are two
14681472
// relevant HLSL feature proposals that will depend on this changing:
14691473
// * 0005-strict-initializer-lists.md
14701474
// * https://github.com/microsoft/hlsl-specs/pull/325

clang/lib/CodeGen/CGExprAgg.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,9 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr(
17821782
// emit these we need to emit the opaque values before we emit the argument
17831783
// expressions themselves. This is a little hacky, but it prevents us needing
17841784
// to do a bigger AST-level change for a language feature that we need
1785-
// deprecate in the near future.
1785+
// deprecate in the near future. See related HLSL language proposals:
1786+
// * 0005-strict-initializer-lists.md
1787+
// * https://github.com/microsoft/hlsl-specs/pull/325
17861788
if (CGF.getLangOpts().HLSL && isa<InitListExpr>(ExprToVisit))
17871789
CGF.CGM.getHLSLRuntime().emitInitListOpaqueValues(
17881790
CGF, cast<InitListExpr>(ExprToVisit));

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3096,8 +3096,8 @@ static bool BuildInitializerList(Sema &S, ASTContext &Ctx, Expr *E,
30963096
if (Ty->isScalarType() || (Ty->isRecordType() && !Ty->isAggregateType()))
30973097
return CastInitializer(S, Ctx, E, List, DestTypes);
30983098

3099-
if (auto *ATy = Ty->getAs<VectorType>()) {
3100-
uint64_t Size = ATy->getNumElements();
3099+
if (auto *VecTy = Ty->getAs<VectorType>()) {
3100+
uint64_t Size = VecTy->getNumElements();
31013101

31023102
QualType SizeTy = Ctx.getSizeType();
31033103
uint64_t SizeTySize = Ctx.getTypeSize(SizeTy);
@@ -3115,8 +3115,8 @@ static bool BuildInitializerList(Sema &S, ASTContext &Ctx, Expr *E,
31153115
return true;
31163116
}
31173117

3118-
if (auto *VTy = dyn_cast<ConstantArrayType>(Ty.getTypePtr())) {
3119-
uint64_t Size = VTy->getZExtSize();
3118+
if (auto *ArrTy = dyn_cast<ConstantArrayType>(Ty.getTypePtr())) {
3119+
uint64_t Size = ArrTy->getZExtSize();
31203120
QualType SizeTy = Ctx.getSizeType();
31213121
uint64_t SizeTySize = Ctx.getTypeSize(SizeTy);
31223122
for (uint64_t I = 0; I < Size; ++I) {

0 commit comments

Comments
 (0)