[PATCH] D41921: [Parse] Forward brace locations to TypeConstructExpr
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 13 08:39:38 PST 2018
aaron.ballman added a comment.
On the whole, this approach looks reasonable to me. Just a few minor nits for clarity.
================
Comment at: lib/Sema/SemaExprCXX.cpp:1286-1293
+ if (ListInitialization)
+ // FIXME: CXXUnresolvedConstructExpr does not model list-initialization
+ // directly. We work around this by dropping the locations of the braces.
+ return CXXUnresolvedConstructExpr::Create(
+ Context, TInfo, SourceLocation(), Exprs, SourceLocation());
+ else
+ return CXXUnresolvedConstructExpr::Create(
----------------
I think this could be changed to reduce the number of returns:
```
SourceLocation Open, Close; // Or use a range and get rid of the funky std::tie() calls
// FIXME: <blah>
if (!ListInitialization)
std::tie(Open, Close) = std::tie(LParenOrBraceLoc, RParenOrBraceLoc);
return CXXUnresolvedConstructExpr::Create(Context, TInfo, Open, Exprs, Close);
```
================
Comment at: lib/Sema/SemaExprCXX.cpp:1380
QualType ResultType = Result.get()->getType();
- Result = CXXFunctionalCastExpr::Create(
- Context, ResultType, Expr::getValueKindForType(Ty), TInfo,
- CK_NoOp, Result.get(), /*Path=*/nullptr, LParenLoc, RParenLoc);
+ if (ListInitialization)
+ Result = CXXFunctionalCastExpr::Create(
----------------
Can use the same trick here.
https://reviews.llvm.org/D41921
More information about the cfe-commits
mailing list