Implement C++ copy-initialization for declarations. There is now some
duplication in the handling of copy-initialization by constructor,
which occurs both for initialization of a declaration and for
overloading. The initialization code is due for some refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58756 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 72b56de..d14c5ff 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -708,11 +708,20 @@
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
+ /// InitializationKind - Represents which kind of C++ initialization
+ /// [dcl.init] a routine is to perform.
+ enum InitializationKind {
+ IK_Direct, ///< Direct initialization
+ IK_Copy, ///< Copy initialization
+ IK_Default ///< Default initialization
+ };
+
CXXConstructorDecl *
- PerformDirectInitForClassType(QualType ClassType,
- Expr **Args, unsigned NumArgs,
- SourceLocation Loc, SourceRange Range,
- std::string InitEntity, bool HasInitializer);
+ PerformInitializationByConstructor(QualType ClassType,
+ Expr **Args, unsigned NumArgs,
+ SourceLocation Loc, SourceRange Range,
+ std::string InitEntity,
+ InitializationKind Kind);
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
virtual ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
@@ -1146,7 +1155,8 @@
/// type checking declaration initializers (C99 6.7.8)
friend class InitListChecker;
- bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType);
+ bool CheckInitializerTypes(Expr *&simpleInit_or_initList, QualType &declType,
+ SourceLocation InitLoc, std::string InitEntity);
bool CheckSingleInitializer(Expr *&simpleInit, QualType declType);
bool CheckForConstantInitializer(Expr *e, QualType t);
bool CheckArithmeticConstantExpression(const Expr* e);