aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-27 16:10:08 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-27 16:10:08 +0000
commit2078bb9c9336da56ea521e98e718556b227541f6 (patch)
tree0ee07f97dff1d6d12aede9f24cb431e3e4f4bef4 /lib/Sema/SemaInit.cpp
parent50c39ea4858265f3f5f42a0c624557ce2281936b (diff)
Create CXXConstructExprs when constructing via copy initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r--lib/Sema/SemaInit.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index d880c236d2..3fae86d19d 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -18,6 +18,7 @@
#include "Sema.h"
#include "clang/Parse/Designator.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include <map>
using namespace clang;
@@ -116,7 +117,7 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, Sema &S) {
bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
SourceLocation InitLoc,
DeclarationName InitEntity,
- bool DirectInit) {
+ bool DirectInit, VarDecl *VD) {
if (DeclType->isDependentType() ||
Init->isTypeDependent() || Init->isValueDependent())
return false;
@@ -160,7 +161,14 @@ bool Sema::CheckInitializerTypes(Expr *&Init, QualType &DeclType,
InitLoc, Init->getSourceRange(),
InitEntity,
DirectInit? IK_Direct : IK_Copy);
- return Constructor == 0;
+ if (!Constructor)
+ return true;
+
+ // FIXME: What do do if VD is null here?
+ assert(VD && "Must have a var decl to construct into!");
+ Init = CXXConstructExpr::Create(Context, VD, DeclType, Constructor,
+ false, &Init, 1);
+ return false;
}
// -- Otherwise (i.e., for the remaining copy-initialization