[cfe-commits] r102159 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Thu Apr 22 19:00:02 PDT 2010
Author: andersca
Date: Thu Apr 22 21:00:02 2010
New Revision: 102159
URL: http://llvm.org/viewvc/llvm-project?rev=102159&view=rev
Log:
Remove calls to isDependentContext, since we handle that case earlier in the code. Make BuildImplicitBaseInitializer return a boolean instead.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=102159&r1=102158&r2=102159&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Apr 22 21:00:02 2010
@@ -1431,11 +1431,12 @@
RParenLoc);
}
-static CXXBaseOrMemberInitializer *
+static bool
BuildImplicitBaseInitializer(Sema &SemaRef,
const CXXConstructorDecl *Constructor,
CXXBaseSpecifier *BaseSpec,
- bool IsInheritedVirtualBase) {
+ bool IsInheritedVirtualBase,
+ CXXBaseOrMemberInitializer *&CXXBaseInit) {
InitializedEntity InitEntity
= InitializedEntity::InitializeBase(SemaRef.Context, BaseSpec,
IsInheritedVirtualBase);
@@ -1450,9 +1451,9 @@
BaseInit = SemaRef.MaybeCreateCXXExprWithTemporaries(move(BaseInit));
if (BaseInit.isInvalid())
- return 0;
+ return true;
- CXXBaseOrMemberInitializer *CXXBaseInit =
+ CXXBaseInit =
new (SemaRef.Context) CXXBaseOrMemberInitializer(SemaRef.Context,
SemaRef.Context.getTrivialTypeSourceInfo(BaseSpec->getType(),
SourceLocation()),
@@ -1461,7 +1462,7 @@
BaseInit.takeAs<Expr>(),
SourceLocation());
- return CXXBaseInit;
+ return false;
}
bool
@@ -1520,11 +1521,9 @@
AllToInit.push_back(Value);
} else if (!AnyErrors) {
bool IsInheritedVirtualBase = !DirectVBases.count(VBase);
- CXXBaseOrMemberInitializer *CXXBaseInit =
- BuildImplicitBaseInitializer(*this, Constructor, VBase,
- IsInheritedVirtualBase);
-
- if (!CXXBaseInit) {
+ CXXBaseOrMemberInitializer *CXXBaseInit;
+ if (BuildImplicitBaseInitializer(*this, Constructor, VBase,
+ IsInheritedVirtualBase, CXXBaseInit)) {
HadError = true;
continue;
}
@@ -1543,11 +1542,10 @@
= AllBaseFields.lookup(Base->getType()->getAs<RecordType>())) {
AllToInit.push_back(Value);
} else if (!AnyErrors) {
- CXXBaseOrMemberInitializer *CXXBaseInit =
- BuildImplicitBaseInitializer(*this, Constructor, Base,
- /*IsInheritedVirtualBase=*/false);
-
- if (!CXXBaseInit) {
+ CXXBaseOrMemberInitializer *CXXBaseInit;
+ if (BuildImplicitBaseInitializer(*this, Constructor, Base,
+ /*IsInheritedVirtualBase=*/false,
+ CXXBaseInit)) {
HadError = true;
continue;
}
@@ -1584,7 +1582,7 @@
continue;
}
- if ((*Field)->getType()->isDependentType() || AnyErrors)
+ if (AnyErrors)
continue;
QualType FT = Context.getBaseElementType((*Field)->getType());
@@ -1602,13 +1600,7 @@
HadError = true;
continue;
}
-
- // Don't attach synthesized member initializers in a dependent
- // context; they'll be regenerated a template instantiation
- // time.
- if (CurContext->isDependentContext())
- continue;
-
+
CXXBaseOrMemberInitializer *Member =
new (Context) CXXBaseOrMemberInitializer(Context,
*Field, SourceLocation(),
More information about the cfe-commits
mailing list