[cfe-commits] r114918 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Mon Sep 27 15:48:58 PDT 2010
Author: dgregor
Date: Mon Sep 27 17:48:58 2010
New Revision: 114918
URL: http://llvm.org/viewvc/llvm-project?rev=114918&view=rev
Log:
Centralize the handling of CXXRecordDecl::DefinitionData's
DeclaredDestructor and UserDeclaredDestructor bits in CXXRecordDecl
itself. Another step on the road to <rdar://problem/8459981>.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=114918&r1=114917&r2=114918&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Mon Sep 27 17:48:58 2010
@@ -631,26 +631,12 @@
return data().UserDeclaredDestructor;
}
- /// setUserDeclaredDestructor - Set whether this class has a
- /// user-declared destructor. If not set by the time the class is
- /// fully defined, a destructor will be implicitly declared.
- void setUserDeclaredDestructor(bool UCD) {
- data().UserDeclaredDestructor = UCD;
- if (UCD)
- data().DeclaredDestructor = true;
- }
-
/// \brief Determine whether this class has had its destructor declared,
/// either via the user or via an implicit declaration.
///
/// This value is used for lazy creation of destructors.
bool hasDeclaredDestructor() const { return data().DeclaredDestructor; }
- /// \brief Note whether this class has already had its destructor declared.
- void setDeclaredDestructor(bool DD) {
- data().DeclaredDestructor = DD;
- }
-
/// getConversions - Retrieve the overload set containing all of the
/// conversion functions in this class.
UnresolvedSetImpl *getConversionFunctions() {
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=114918&r1=114917&r2=114918&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Mon Sep 27 17:48:58 2010
@@ -278,9 +278,9 @@
// declared it.
else if (Constructor->isCopyConstructor())
data().DeclaredCopyConstructor = true;
- }
- // FIXME: Destructors
- else if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
+ } else if (isa<CXXDestructorDecl>(D)) {
+ data().DeclaredDestructor = true;
+ } else if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
// If this is the implicit copy constructor, note that we have now
// declared it.
// FIXME: Move constructors
@@ -330,8 +330,14 @@
return;
}
- // FIXME: Destructors.
+ // Handle (user-declared) destructors.
+ if (isa<CXXDestructorDecl>(D)) {
+ data().DeclaredDestructor = true;
+ data().UserDeclaredDestructor = true;
+ return;
+ }
+ // Handle (user-declared) member functions.
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(D)) {
if (Method->getOverloadedOperator() == OO_Equal) {
// We're interested specifically in copy assignment operators.
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=114918&r1=114917&r2=114918&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Sep 27 17:48:58 2010
@@ -3931,7 +3931,6 @@
}
}
- Record->setUserDeclaredDestructor(true);
// C++ [class]p4: A POD-struct is an aggregate class that has [...] no
// user-defined destructor.
Record->setPOD(false);
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=114918&r1=114917&r2=114918&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Sep 27 17:48:58 2010
@@ -4534,7 +4534,6 @@
Destructor->setTrivial(ClassDecl->hasTrivialDestructor());
// Note that we have declared this destructor.
- ClassDecl->setDeclaredDestructor(true);
++ASTContext::NumImplicitDestructorsDeclared;
// Introduce this destructor into its scope.
More information about the cfe-commits
mailing list