[cfe-commits] r73897 - in /cfe/trunk/lib/Sema: SemaDeclCXX.cpp SemaExpr.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Jun 22 13:37:23 PDT 2009
Author: fjahanian
Date: Mon Jun 22 15:37:23 2009
New Revision: 73897
URL: http://llvm.org/viewvc/llvm-project?rev=73897&view=rev
Log:
Changes made per Doug's comments.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=73897&r1=73896&r2=73897&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Jun 22 15:37:23 2009
@@ -1842,9 +1842,9 @@
void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
CXXConstructorDecl *Constructor) {
- if (!Constructor->isDefaultConstructor() ||
- !Constructor->isImplicit() || Constructor->isUsed())
- return;
+ assert((Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
+ !Constructor->isUsed()) &&
+ "DefineImplicitDefaultConstructor - call it for implicit default ctor");
CXXRecordDecl *ClassDecl
= cast<CXXRecordDecl>(Constructor->getDeclContext());
@@ -1862,7 +1862,7 @@
if (CXXConstructorDecl *BaseCtor =
BaseClassDecl->getDefaultConstructor(Context)) {
if (BaseCtor->isImplicit())
- BaseCtor->setUsed();
+ MarkDeclarationReferenced(CurrentLocation, BaseCtor);
}
else {
Diag(CurrentLocation, diag::err_defining_default_ctor)
@@ -1887,7 +1887,7 @@
if (CXXConstructorDecl *FieldCtor =
FieldClassDecl->getDefaultConstructor(Context)) {
if (FieldCtor->isImplicit())
- FieldCtor->setUsed();
+ MarkDeclarationReferenced(CurrentLocation, FieldCtor);
}
else {
Diag(CurrentLocation, diag::err_defining_default_ctor)
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=73897&r1=73896&r2=73897&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jun 22 15:37:23 2009
@@ -5462,9 +5462,13 @@
// Note that this declaration has been used.
if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
- DefineImplicitDefaultConstructor(Loc, Constructor);
- // FIXME: set the Used flag if it is determined that ctor is valid.
- Constructor->setUsed(true);
+ if (Constructor->isImplicit() && Constructor->isDefaultConstructor()) {
+ if (!Constructor->isUsed())
+ DefineImplicitDefaultConstructor(Loc, Constructor);
+ }
+ // FIXME: more checking for other implicits go here.
+ else
+ Constructor->setUsed(true);
return;
}
More information about the cfe-commits
mailing list