Give implicitly-defined default constructors and destructors empty

bodies, from Martin Vejnar!

llvm-svn: 114329
This commit is contained in:
Douglas Gregor 2010-09-20 16:48:21 +00:00
parent ea9fc18163
commit 7319327007
1 changed files with 10 additions and 3 deletions

View File

@ -4458,10 +4458,14 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
Diag(CurrentLocation, diag::note_member_synthesized_at)
<< CXXConstructor << Context.getTagDeclType(ClassDecl);
Constructor->setInvalidDecl();
} else {
Constructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
return;
}
SourceLocation Loc = Constructor->getLocation();
Constructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
Constructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
}
CXXDestructorDecl *Sema::DeclareImplicitDestructor(CXXRecordDecl *ClassDecl) {
@ -4569,6 +4573,9 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
return;
}
SourceLocation Loc = Destructor->getLocation();
Destructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
Destructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
}