================
@@ -570,9 +570,17 @@ CIRGenFunction::emitArraySubscriptExpr(const
clang::ArraySubscriptExpr *e) {
}
// The base must be a pointer; emit it with an estimate of its alignment.
- cgm.errorNYI(e->getSourceRange(),
- "emitArraySubscriptExpr: The base must be a pointer");
- return {};
+ assert(e->getBase()->getType()->isPointerType() &&
+ "The base must be a pointer");
+
+ LValueBaseInfo eltBaseInfo;
+ const Address ptrAddr = emitPointerWithAlignment(e->getBase(), &eltBaseInfo);
+ // Propagate the alignment from the array itself to the result.
----------------
andykaylor wrote:
What happened to the call to EmitIdxAfterBase()? It looks like you've
simplified the code here (and in the earlier implementation), but I'm not sure
we don't need some of what has been eliminated. At least when we add support
for sanitizers we'll want the bounds check in emitIdxAfterBase.
https://github.com/llvm/llvm-project/pull/135493
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits