[cfe-commits] r86559 - in /cfe/trunk/lib/Sema: SemaTemplateInstantiateDecl.cpp TreeTransform.h
Douglas Gregor
dgregor at apple.com
Mon Nov 9 09:16:50 PST 2009
Author: dgregor
Date: Mon Nov 9 11:16:50 2009
New Revision: 86559
URL: http://llvm.org/viewvc/llvm-project?rev=86559&view=rev
Log:
When transforming an InitListExpr, if we already computed a non-dependent type for the InitListExpr, keep it
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/TreeTransform.h
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=86559&r1=86558&r2=86559&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Nov 9 11:16:50 2009
@@ -188,13 +188,11 @@
Var->setInvalidDecl();
else if (!D->getType()->isDependentType() &&
!D->getInit()->isTypeDependent() &&
- !D->getInit()->isValueDependent() &&
- !isa<InitListExpr>(D->getInit())) {
+ !D->getInit()->isValueDependent()) {
// If neither the declaration's type nor its initializer are dependent,
// we don't want to redo all the checking, especially since the
// initializer might have been wrapped by a CXXConstructExpr since we did
// it the first time.
- // FIXME: The InitListExpr handling here is a hack!
Var->setInit(SemaRef.Context, Init.takeAs<Expr>());
}
else if (ParenListExpr *PLE = dyn_cast<ParenListExpr>((Expr *)Init.get())) {
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=86559&r1=86558&r2=86559&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Nov 9 11:16:50 2009
@@ -1063,8 +1063,18 @@
/// Subclasses may override this routine to provide different behavior.
OwningExprResult RebuildInitList(SourceLocation LBraceLoc,
MultiExprArg Inits,
- SourceLocation RBraceLoc) {
- return SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
+ SourceLocation RBraceLoc,
+ QualType ResultTy) {
+ OwningExprResult Result
+ = SemaRef.ActOnInitList(LBraceLoc, move(Inits), RBraceLoc);
+ if (Result.isInvalid() || ResultTy->isDependentType())
+ return move(Result);
+
+ // Patch in the result type we were given, which may have been computed
+ // when the initial InitListExpr was built.
+ InitListExpr *ILE = cast<InitListExpr>((Expr *)Result.get());
+ ILE->setType(ResultTy);
+ return move(Result);
}
/// \brief Build a new designated initializer expression.
@@ -3893,7 +3903,7 @@
return SemaRef.Owned(E->Retain());
return getDerived().RebuildInitList(E->getLBraceLoc(), move_arg(Inits),
- E->getRBraceLoc());
+ E->getRBraceLoc(), E->getType());
}
template<typename Derived>
More information about the cfe-commits
mailing list