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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 13 11:11:45 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 *> {
----------------
zygoloid wrote:

As a general principle we try to keep our AST nodes small. This change isn't going to make a big difference by itself, but abandoning that principle and making a bunch of changes like this would. I think it's worth putting in a small amount of effort here, but if it doesn't work out nicely then it's fine to remove the optimization. We can find other places to save space.

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


More information about the cfe-commits mailing list