[clang] [HLSL] Implement HLSL intialization list support (PR #123141)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 12:58:24 PST 2025


================
@@ -2582,17 +2582,20 @@ static void BuildFlattenedTypeList(QualType BaseTy,
       continue;
     }
     if (const auto *RT = dyn_cast<RecordType>(T)) {
-      const RecordDecl *RD = RT->getDecl();
-      if (RD->isUnion()) {
+      const CXXRecordDecl *RD = RT->getAsCXXRecordDecl();
+      assert(RD && "HLSL record types should all be CXXRecordDecls!");
+
+      if (RD->isStandardLayout())
+        RD = RD->getStandardLayoutBaseWithFields();
+
+      // For types that we shouldn't decompose (unios and non-aggregates), just
----------------
bogner wrote:

```suggestion
      // For types that we shouldn't decompose (unions and non-aggregates), just
```

https://github.com/llvm/llvm-project/pull/123141


More information about the cfe-commits mailing list