[cfe-commits] r86065 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
John McCall
rjmccall at apple.com
Wed Nov 4 15:13:52 PST 2009
Author: rjmccall
Date: Wed Nov 4 17:13:52 2009
New Revision: 86065
URL: http://llvm.org/viewvc/llvm-project?rev=86065&view=rev
Log:
Comments, formatting. Based on patch by Brandon Pearcy!
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=86065&r1=86064&r2=86065&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Nov 4 17:13:52 2009
@@ -1021,6 +1021,7 @@
// Diagnose value-uses of fields to initialize themselves, e.g.
// foo(foo)
// where foo is not also a parameter to the constructor.
+ // TODO: implement -Wuninitialized and fold this into that framework.
for (unsigned i = 0; i < NumArgs; ++i) {
SourceLocation L;
if (InitExprContainsUninitializedFields(Args[i], Member, &L)) {
@@ -1044,7 +1045,9 @@
FieldType = Array->getElementType();
if (FieldType->isDependentType()) {
// Can't check init for dependent type.
- } else if (FieldType->getAs<RecordType>()) {
+ } else if (FieldType->isRecordType()) {
+ // Member is a record (struct/union/class), so pass the initializer
+ // arguments down to the record's constructor.
if (!HasDependentArg) {
ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(*this);
@@ -1064,6 +1067,8 @@
}
}
} else if (NumArgs != 1 && NumArgs != 0) {
+ // The member type is not a record type (or an array of record
+ // types), so it can be only be default- or copy-initialized.
return Diag(IdLoc, diag::err_mem_initializer_mismatch)
<< Member->getDeclName() << SourceRange(IdLoc, RParenLoc);
} else if (!HasDependentArg) {
@@ -1217,7 +1222,7 @@
// On seeing one dependent type, we should essentially exit this routine
// while preserving user-declared initializer list. When this routine is
// called during instantiatiation process, this routine will rebuild the
- // oderdered initializer list correctly.
+ // ordered initializer list correctly.
// If we have a dependent base initialization, we can't determine the
// association between initializers and bases; just dump the known
@@ -1473,6 +1478,7 @@
return GetKeyForBase(QualType(Member->getBaseClass(), 0));
}
+/// ActOnMemInitializers - Handle the member initializers for a constructor.
void Sema::ActOnMemInitializers(DeclPtrTy ConstructorDecl,
SourceLocation ColonLoc,
MemInitTy **MemInits, unsigned NumMemInits) {
More information about the cfe-commits
mailing list