[PATCH] D55662: [Sema] If CheckPlaceholderExpr rewrites a placeholder expression when the type of an auto variable is being deduced, use the rewritten expression when performing initialization of the variable.
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 9 21:29:15 PST 2019
ahatanak marked an inline comment as done.
ahatanak added a comment.
In D55662#1349329 <https://reviews.llvm.org/D55662#1349329>, @rjmccall wrote:
> Oh, and please update the commit message to primarily talk about the changes to placeholder checking. You can discuss the impact on the repeated-use-of-weak warning in a follow-up paragraph.
This patch has three parts:
1. Use the expression that was rewritten during auto type deduction to perform auto variable initialization.
2. Call `CheckPlaceholderExpr` while an unevaluated context is still on the stack.
3. Check whether we are in an unevaluated context before calling `recordUseOfWeak` in `Sema::BuildInstanceMessage`.
I think I should commit 1 separately from 2 and 3.
================
Comment at: lib/Sema/SemaLambda.cpp:793
+ else
+ Args = Init;
+
----------------
rjmccall wrote:
> Please maintain the original order here, even though I suspect it doesn't matter: if this is direct-initialization, use the arguments, otherwise use either `DeducedAutoInit` or `Init`. Although really, consider just reassigning `Init` immediately after the `deduceVarType...` call.
The code that assigns `CXXDirectInit`'s expressions to `Arg` is no longer needed since `Sema::deduceVarTypeFromInitializer` removes the `ParenListExpr`.
If we move the code that declares the `InitializedEntity` variable up, we can reassign `Init` immediately after the call to `deduceVarTypeFromInitializer`.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55662/new/
https://reviews.llvm.org/D55662
More information about the cfe-commits
mailing list