[PATCH] DR712 - odr use and constant expressions
Faisal Vali
faisalv at yahoo.com
Mon Dec 16 08:21:34 PST 2013
Add the test files I forgot to attach with my last revision.
In case it helps with the review, some more details regarding the approach:
- As discussed in July 2013 - the use of a statement visitor is used to identify the potential results of an expression 'e' (so that constant expressions undergoing lvalue-to-rvalue can be constant folded and don't have to be marked odr-used) - called from UpdateLValueToRvalue
- During emission of MemberExpression (via member-ptrs or not) or IgnoredValueEmission - EvaluateAsInt is used to check too see if the emission can be folded (does this work for double's - i.e. all scalars - too?) - and if it can be folded - and if the objectexpression is not a pointer (do i need this check?) - and is a C++11 constant expression - then fold the entire emission.
- If in EmitDeclRefLValue - we get an unused variable (for e.g. (b ? cobj1 : obj2).x where cobj1 is constexpr) - then it must be an aggregate constexpr - so emit a temporary aggregate of that type initialized with the same init-expr as the declaration was initialized with as an lvalue.
Hi rsmith, rjmccall, doug.gregor,
http://llvm-reviews.chandlerc.com/D1140
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D1140?vs=6114&id=6124#toc
Files:
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGExprScalar.cpp
lib/Parse/ParseAST.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
test/CodeGenCXX/cxx11-DR712-lambda-constexpr.cpp
test/CodeGenCXX/cxx11-member-ptr-constexpr.cpp
test/CodeGenCXX/value-init.cpp
test/CXX/basic/basic.def.odr/p2-potential-results.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1140.3.patch
Type: text/x-patch
Size: 22518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131216/5f9e1e60/attachment.bin>
More information about the cfe-commits
mailing list