diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-12 22:21:33 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-12 22:21:33 +0000 |
commit | d1036128aba213359dc6756cac5c49231a0483ce (patch) | |
tree | fbfe98c9bd86089eae193c44397b950db932d28c /clang/lib/Sema/TreeTransform.h | |
parent | 212f3b91ee170d7ab3efb0a2dc23e763fd6aab66 (diff) | |
download | bcm5719-llvm-d1036128aba213359dc6756cac5c49231a0483ce.tar.gz bcm5719-llvm-d1036128aba213359dc6756cac5c49231a0483ce.zip |
When rebuilding an InitListExpr, don't give it a type.
InitListExprs without types (well, with type 'void') represent not-yet-analyzed
initializer lists; InitListExpr with types fool Sema into thinking they don't
need further analysis in some cases (particularly C++17 copy omission).
llvm-svn: 322414
Diffstat (limited to 'clang/lib/Sema/TreeTransform.h')
-rw-r--r-- | clang/lib/Sema/TreeTransform.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index ebfdbe83ef8..809187f0aee 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -2352,18 +2352,8 @@ public: /// Subclasses may override this routine to provide different behavior. ExprResult RebuildInitList(SourceLocation LBraceLoc, MultiExprArg Inits, - SourceLocation RBraceLoc, - QualType ResultTy) { - ExprResult Result - = SemaRef.ActOnInitList(LBraceLoc, Inits, RBraceLoc); - if (Result.isInvalid() || ResultTy->isDependentType()) - return Result; - - // Patch in the result type we were given, which may have been computed - // when the initial InitListExpr was built. - InitListExpr *ILE = cast<InitListExpr>((Expr *)Result.get()); - ILE->setType(ResultTy); - return Result; + SourceLocation RBraceLoc) { + return SemaRef.ActOnInitList(LBraceLoc, Inits, RBraceLoc); } /// \brief Build a new designated initializer expression. @@ -3394,11 +3384,10 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init, /*IsCall*/true, NewArgs, &ArgChanged)) return ExprError(); - // If this was list initialization, revert to list form. + // If this was list initialization, revert to syntactic list form. if (Construct->isListInitialization()) return getDerived().RebuildInitList(Construct->getLocStart(), NewArgs, - Construct->getLocEnd(), - Construct->getType()); + Construct->getLocEnd()); // Build a ParenListExpr to represent anything else. SourceRange Parens = Construct->getParenOrBraceRange(); @@ -9513,7 +9502,7 @@ TreeTransform<Derived>::TransformInitListExpr(InitListExpr *E) { } return getDerived().RebuildInitList(E->getLBraceLoc(), Inits, - E->getRBraceLoc(), E->getType()); + E->getRBraceLoc()); } template<typename Derived> |