[clang] [HLSL] Handle incomplete array types (PR #133508)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 8 13:24:41 PDT 2025
================
@@ -3249,166 +3249,204 @@ void SemaHLSL::processExplicitBindingsOnDecl(VarDecl *VD) {
}
}
}
-
-static bool CastInitializer(Sema &S, ASTContext &Ctx, Expr *E,
- llvm::SmallVectorImpl<Expr *> &List,
- llvm::SmallVectorImpl<QualType> &DestTypes) {
- if (List.size() >= DestTypes.size()) {
- List.push_back(E);
- // This is odd, but it isn't technically a failure due to conversion, we
- // handle mismatched counts of arguments differently.
+namespace {
+class InitListTransformer {
+ Sema &S;
+ ASTContext &Ctx;
+ QualType InitTy;
+ QualType *DstIt = nullptr;
+ Expr **ArgIt = nullptr;
+ bool Wrap;
+
+ bool castInitializer(Expr *E) {
+ assert(DstIt && "This should always be something!");
+ if (DstIt == DestTypes.end()) {
+ if (!Wrap) {
+ ArgExprs.push_back(E);
+ // This is odd, but it isn't technically a failure due to conversion, we
+ // handle mismatched counts of arguments differently.
+ return true;
+ }
+ DstIt = DestTypes.begin();
+ }
+ InitializedEntity Entity =
+ InitializedEntity::InitializeParameter(Ctx, *DstIt, true);
----------------
llvm-beanz wrote:
Good catch. I'll add a comment, but this is an obj-c thing. I should have left this as `false`.
https://github.com/llvm/llvm-project/pull/133508
More information about the cfe-commits
mailing list