[PATCH] D12169: Relax constexpr rules to improve __builtin_object_size's accuracy
George Burgess IV via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 11:48:51 PDT 2015
george.burgess.iv updated this revision to Diff 32985.
george.burgess.iv added a comment.
Mostly redid the patch; removed OutermostExprEvaluator, moved evaluation intent into `EvaluationMode`, made it so the more interesting rulebreaking that `__builtin_object_size` allows is only allowed when evaluating `__builtin_object_size`.
Not entirely sold on adding 4 EvaluationModes, but we need to know two bits of information, both of which impact how we evaluate things:
- Whether we're evaluating an actual ConstantExpression or a PotentialConstantExpression (if we always assume the former, we get memory corruption by reaching into `CallStackFrame::Arguments` sometimes; if we assume the latter, `attribute(enable_if)` breaks).
- If we're allowed to assume that the base of a `MemberExpr` is valid.
Also, I'm not 100% on calling `LValue.set(MaybeAnRValue)` if we are assuming that the base of a `MemberExpr` is valid. However, in such a case, I would think that it's safe to assume that the caller doesn't care about the base. Plus, it's In The Documentation(TM) that you shouldn't rely on `Result.getLValueBase()` being a valid base when the EvalMode would allow this assumption to be made.
http://reviews.llvm.org/D12169
Files:
lib/AST/ExprConstant.cpp
test/CodeGen/object-size.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12169.32985.patch
Type: text/x-patch
Size: 23427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150824/94b56541/attachment-0001.bin>
More information about the cfe-commits
mailing list