rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.
This essentially looks fine. Let me know if you want me to take another look
once you've fixed the `ignorePointerCastsAndParens` bug with derived-to-base
conversions, otherwise go ahead.
================
Comment at: lib/AST/ExprConstant.cpp:499
@@ -496,1 +498,3 @@
+ /// MemberExpr with a base that can't be evaluated.
+ EM_ConstantExpressionOffsetFold,
} EvalMode;
----------------
Maybe rename to `OffsetFold` or `DesignatorFold`?
================
Comment at: lib/AST/ExprConstant.cpp:6263-6264
@@ +6262,4 @@
+ auto *SubExpr = Cast->getSubExpr();
+ if (!SubExpr->getType()->hasPointerRepresentation() || !SubExpr->isRValue())
+ return NoParens;
+ return ignorePointerCastsAndParens(SubExpr);
----------------
I don't think this is quite right: you should only skip past casts that don't
change the pointer value. In particular, this check will step past
derived-to-base pointer conversions, which may require an adjustment to the
pointer.
http://reviews.llvm.org/D12169
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits