================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to