[clang] [HLSL] Implement array temporary support (PR #79382)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 07:45:33 PDT 2024


================
@@ -3173,41 +3174,46 @@ class ArrayType : public Type, public llvm::FoldingSetNode {
     return T->getTypeClass() == ConstantArray ||
            T->getTypeClass() == VariableArray ||
            T->getTypeClass() == IncompleteArray ||
-           T->getTypeClass() == DependentSizedArray;
+           T->getTypeClass() == DependentSizedArray ||
+           T->getTypeClass() == ArrayParameter;
   }
 };
 
 /// Represents the canonical version of C arrays with a specified constant size.
 /// For example, the canonical type for 'int A[4 + 4*100]' is a
 /// ConstantArrayType where the element type is 'int' and the size is 404.
-class ConstantArrayType final
-    : public ArrayType,
-      private llvm::TrailingObjects<ConstantArrayType, const Expr *> {
----------------
llvm-beanz wrote:

@zygoloid do you think the optimization is important to preserve? I guessed it might be safe to eliminate because other array types store the `SizeExpr` pointer, but if it's important I can make a separate PR to change the implementation as you suggested and we can merge that change first.

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


More information about the cfe-commits mailing list