diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-12-22 02:35:53 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-12-22 02:35:53 +0000 |
commit | a553d4ac951b338cbea75e2e5b7162a3b17c41c7 (patch) | |
tree | c4f5db945f0266f6454db2e791be1e511a654754 /clang/lib/Sema | |
parent | 463e523ad82b465164000fc5e6582191a67408e7 (diff) | |
download | bcm5719-llvm-a553d4ac951b338cbea75e2e5b7162a3b17c41c7.tar.gz bcm5719-llvm-a553d4ac951b338cbea75e2e5b7162a3b17c41c7.zip |
Switch compound literals over to InitializationSequence.
llvm-svn: 91882
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 11 | ||||
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index d45179e94c8..181d6d1c8f8 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -3478,15 +3478,22 @@ Sema::ActOnCompoundLiteral(SourceLocation LParenLoc, TypeTy *Ty, InitializationKind Kind = InitializationKind::CreateCast(SourceRange(LParenLoc, RParenLoc), /*IsCStyleCast=*/true); - if (CheckInitializerTypes(literalExpr, literalType, Entity, Kind)) + InitializationSequence InitSeq(*this, Entity, Kind, &literalExpr, 1); + OwningExprResult Result = InitSeq.Perform(*this, Entity, Kind, + MultiExprArg(*this, (void**)&literalExpr, 1), + &literalType); + if (Result.isInvalid()) return ExprError(); + InitExpr.release(); + literalExpr = static_cast<Expr*>(Result.get()); bool isFileScope = getCurFunctionOrMethodDecl() == 0; if (isFileScope) { // 6.5.2.5p3 if (CheckForConstantInitializer(literalExpr, literalType)) return ExprError(); } - InitExpr.release(); + + Result.release(); // FIXME: Store the TInfo to preserve type information better. return Owned(new (Context) CompoundLiteralExpr(LParenLoc, literalType, diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index c7a2769c448..cc22e7458a4 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -3186,7 +3186,7 @@ InitializationSequence::Perform(Sema &S, } } - if (Kind.getKind() == InitializationKind::IK_Copy) + if (Kind.getKind() == InitializationKind::IK_Copy || Kind.isExplicitCast()) return Sema::OwningExprResult(S, Args.release()[0]); unsigned NumArgs = Args.size(); |