diff options
author | dim <dim@FreeBSD.org> | 2014-05-11 18:26:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2014-05-11 18:26:10 +0000 |
commit | 88f7a7d5251a2d813460274c92decc143a11569b (patch) | |
tree | c89fa0adefb99f464eba263b447f84c2ceb663ce /lib/AST/ExprConstant.cpp | |
parent | fcddf668e724f57e5d75dc641bba534c6a21cd0d (diff) | |
download | FreeBSD-src-88f7a7d5251a2d813460274c92decc143a11569b.zip FreeBSD-src-88f7a7d5251a2d813460274c92decc143a11569b.tar.gz |
Vendor import of clang RELEASE_34/dot1-final tag r208032 (effectively, 3.4.1 release):
https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_34/dot1-final@208032
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 390cfe9..4cac4fa 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -5089,16 +5089,15 @@ bool RecordExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E) { if (!Result.isUninit()) return true; - if (ZeroInit) - return ZeroInitialization(E); - - const CXXRecordDecl *RD = FD->getParent(); - if (RD->isUnion()) - Result = APValue((FieldDecl*)0); - else - Result = APValue(APValue::UninitStruct(), RD->getNumBases(), - std::distance(RD->field_begin(), RD->field_end())); - return true; + // We can get here in two different ways: + // 1) We're performing value-initialization, and should zero-initialize + // the object, or + // 2) We're performing default-initialization of an object with a trivial + // constexpr default constructor, in which case we should start the + // lifetimes of all the base subobjects (there can be no data member + // subobjects in this case) per [basic.life]p1. + // Either way, ZeroInitialization is appropriate. + return ZeroInitialization(E); } const FunctionDecl *Definition = 0; @@ -5578,19 +5577,9 @@ bool ArrayExprEvaluator::VisitCXXConstructExpr(const CXXConstructExpr *E, if (HadZeroInit) return true; - if (ZeroInit) { - ImplicitValueInitExpr VIE(Type); - return EvaluateInPlace(*Value, Info, Subobject, &VIE); - } - - const CXXRecordDecl *RD = FD->getParent(); - if (RD->isUnion()) - *Value = APValue((FieldDecl*)0); - else - *Value = - APValue(APValue::UninitStruct(), RD->getNumBases(), - std::distance(RD->field_begin(), RD->field_end())); - return true; + // See RecordExprEvaluator::VisitCXXConstructExpr for explanation. + ImplicitValueInitExpr VIE(Type); + return EvaluateInPlace(*Value, Info, Subobject, &VIE); } const FunctionDecl *Definition = 0; |