Author: dgregor
Date: Mon Sep 20 11:48:21 2010
New Revision: 114329
URL: http://llvm.org/viewvc/llvm-project?rev=114329&view=rev
Log:
Give implicitly-defined default constructors and destructors empty
bodies, from Martin Vejnar!
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=114329&r1=114328&r2=114329&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Sep 20 11:48:21 2010
@@ -4458,10 +4458,14 @@
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 @@
return;
}
+ SourceLocation Loc = Destructor->getLocation();
+ Destructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
+
Destructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits