From 1b4ebfab2b93e02e85d30d0176a2e635e753f901 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 5 Sep 2009 07:40:38 +0000 Subject: [PATCH] Pass the ConstructLoc to BuildCXXConstructExpr. llvm-svn: 81068 --- clang/lib/Sema/Sema.h | 12 ++++++++---- clang/lib/Sema/SemaDeclCXX.cpp | 22 ++++++++++------------ clang/lib/Sema/SemaExprCXX.cpp | 6 ++++-- clang/lib/Sema/SemaInit.cpp | 3 ++- clang/lib/Sema/TreeTransform.h | 4 +++- 5 files changed, 27 insertions(+), 20 deletions(-) diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h index 4b9447740add..ba466db77a5a 100644 --- a/clang/lib/Sema/Sema.h +++ b/clang/lib/Sema/Sema.h @@ -1812,13 +1812,17 @@ public: QualType DeclInitType, Expr **Exprs, unsigned NumExprs); - OwningExprResult BuildCXXConstructExpr(QualType DeclInitType, + /// BuildCXXConstructExpr - Creates a complete call to a constructor, + /// including handling of its default argument expressions. + OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, + QualType DeclInitType, CXXConstructorDecl *Constructor, Expr **Exprs, unsigned NumExprs); - /// BuildCXXConstructExpr - Creates a complete call to a constructor, - /// including handling of its default argument expressions. - OwningExprResult BuildCXXConstructExpr(QualType DeclInitType, + // FIXME: Can re remove this and have the above BuildCXXConstructExpr check if + // the constructor can be elidable? + OwningExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, + QualType DeclInitType, CXXConstructorDecl *Constructor, bool Elidable, Expr **Exprs, unsigned NumExprs); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index f8c59f480096..3ee40e842c65 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2808,7 +2808,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, } Sema::OwningExprResult -Sema::BuildCXXConstructExpr(QualType DeclInitType, +Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, CXXConstructorDecl *Constructor, Expr **Exprs, unsigned NumExprs) { bool Elidable = false; @@ -2830,18 +2830,16 @@ Sema::BuildCXXConstructExpr(QualType DeclInitType, Elidable = true; } - return BuildCXXConstructExpr(DeclInitType, Constructor, Elidable, - Exprs, NumExprs); + return BuildCXXConstructExpr(ConstructLoc, DeclInitType, Constructor, + Elidable, Exprs, NumExprs); } /// BuildCXXConstructExpr - Creates a complete call to a constructor, /// including handling of its default argument expressions. Sema::OwningExprResult -Sema::BuildCXXConstructExpr(QualType DeclInitType, - CXXConstructorDecl *Constructor, - bool Elidable, - Expr **Exprs, - unsigned NumExprs) { +Sema::BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, + CXXConstructorDecl *Constructor, bool Elidable, + Expr **Exprs, unsigned NumExprs) { ExprOwningPtr Temp(this, CXXConstructExpr::Create(Context, DeclInitType, @@ -2856,8 +2854,7 @@ Sema::BuildCXXConstructExpr(QualType DeclInitType, ParmVarDecl *Param = FDecl->getParamDecl(j); OwningExprResult ArgExpr = - BuildCXXDefaultArgExpr(/*FIXME:*/SourceLocation(), - FDecl, Param); + BuildCXXDefaultArgExpr(ConstructLoc, FDecl, Param); if (ArgExpr.isInvalid()) return ExprError(); @@ -2901,8 +2898,9 @@ bool Sema::InitializeVarWithConstructor(VarDecl *VD, CXXConstructorDecl *Constructor, QualType DeclInitType, Expr **Exprs, unsigned NumExprs) { - OwningExprResult TempResult = BuildCXXConstructExpr(DeclInitType, Constructor, - Exprs, NumExprs); + OwningExprResult TempResult = + BuildCXXConstructExpr(/*FIXME: ConstructLoc*/ SourceLocation(), + DeclInitType, Constructor, Exprs, NumExprs); if (TempResult.isInvalid()) return true; diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 99d80944baa9..1963f2ad7cca 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -941,7 +941,8 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, // FIXME. Do we need to check for isLValueReferenceType? DefaultFunctionArrayConversion(From); OwningExprResult InitResult = - BuildCXXConstructExpr(ToType.getNonReferenceType(), + BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), + ToType.getNonReferenceType(), CD, &From, 1); // Take ownership of this expression. From = InitResult.takeAs(); @@ -986,7 +987,8 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType, assert(!ToType->isReferenceType()); OwningExprResult FromResult = - BuildCXXConstructExpr(ToType, SCS.CopyConstructor, &From, 1); + BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), + ToType, SCS.CopyConstructor, &From, 1); if (FromResult.isInvalid()) return true; diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index fb75ff3cd6cc..936d996ea49c 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -181,7 +181,8 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType, return true; OwningExprResult InitResult = - BuildCXXConstructExpr(DeclType, Constructor, &Init, 1); + BuildCXXConstructExpr(/*FIXME:ConstructLoc*/SourceLocation(), + DeclType, Constructor, &Init, 1); if (InitResult.isInvalid()) return true; diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index b49ed5487bb9..a0642f92cb7b 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1450,7 +1450,9 @@ public: MultiExprArg Args) { unsigned NumArgs = Args.size(); Expr **ArgsExprs = (Expr **)Args.release(); - return getSema().BuildCXXConstructExpr(T, Constructor, IsElidable, + return getSema().BuildCXXConstructExpr(/*FIXME:ConstructLoc*/ + SourceLocation(), + T, Constructor, IsElidable, ArgsExprs, NumArgs); }