diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-20 16:48:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-20 16:48:21 +0000 |
commit | 7319327007ec5521cf2c245b08eb006ce4b420a5 (patch) | |
tree | 8a5b52a948c15716cda56c5c4e86ec937583adce /clang/lib/Sema | |
parent | ea9fc18163568dde4561c1d02261eb21f5aca0a7 (diff) | |
download | bcm5719-llvm-7319327007ec5521cf2c245b08eb006ce4b420a5.tar.gz bcm5719-llvm-7319327007ec5521cf2c245b08eb006ce4b420a5.zip |
Give implicitly-defined default constructors and destructors empty
bodies, from Martin Vejnar!
llvm-svn: 114329
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 4816d22013f..4efb62a9d40 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -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); } |