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 | 4ada9d3aa47d66e4074229fb93f24416526a15e8 (patch) | |
tree | a591371cab62ab5f222e6843eb9ec49873fc77c3 /lib/Sema/SemaDeclCXX.cpp | |
parent | 1b2ad2fd9e2d5352144481aa1fd995d333d9adc9 (diff) |
Give implicitly-defined default constructors and destructors empty
bodies, from Martin Vejnar!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 4816d22013..4efb62a9d4 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/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); } |