[clang] [CIR] Upstream ArraySubscriptExpr for fixed size array (PR #134536)
Amr Hesham via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 7 10:54:52 PDT 2025
================
@@ -232,6 +233,161 @@ LValue CIRGenFunction::emitUnaryOpLValue(const UnaryOperator *e) {
llvm_unreachable("Unknown unary operator kind!");
}
+/// If the specified expr is a simple decay from an array to pointer,
+/// return the array subexpression.
+/// FIXME: this could be abstracted into a commeon AST helper.
+static const Expr *isSimpleArrayDecayOperand(const Expr *e) {
+ // If this isn't just an array->pointer decay, bail out.
+ const auto *castExpr = dyn_cast<CastExpr>(e);
+ if (!castExpr || castExpr->getCastKind() != CK_ArrayToPointerDecay)
+ return nullptr;
+
+ // If this is a decay from variable width array, bail out.
+ const Expr *subExpr = castExpr->getSubExpr();
+ if (subExpr->getType()->isVariableArrayType())
----------------
AmrDeveloper wrote:
As far as I understand, it's internal to be nullptr, not a missing feature or implementation similar to Clang
https://github.com/llvm/llvm-project/blob/783201b184572a07efe2dc6b6b9110873421cf11/clang/lib/CodeGen/CGExpr.cpp#L4054-L4068
https://github.com/llvm/llvm-project/pull/134536
More information about the cfe-commits
mailing list