diff options
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 45 | ||||
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticKinds.def | 1 |
2 files changed, 19 insertions, 27 deletions
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 9e7e0790b7c..d840c68de50 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -260,9 +260,13 @@ class CXXRecordDecl : public RecordDecl { bool UserDeclaredConstructor : 1; /// UserDeclaredCopyConstructor - True when this class has a - /// user-defined copy constructor. + /// user-declared copy constructor. bool UserDeclaredCopyConstructor : 1; + /// UserDeclaredDestructor - True when this class has a + /// user-declared destructor. + bool UserDeclaredDestructor : 1; + /// Aggregate - True when this class is an aggregate. bool Aggregate : 1; @@ -277,14 +281,6 @@ class CXXRecordDecl : public RecordDecl { /// NumBases - The number of base class specifiers in Bases. unsigned NumBases; - /// Constructors - Overload set containing the constructors of this - /// C++ class. Each of the entries in this overload set is a - /// CXXConstructorDecl. - OverloadedFunctionDecl Constructors; - - // Destructor - The destructor of this C++ class. - CXXDestructorDecl *Destructor; - /// Conversions - Overload set containing the conversion functions /// of this C++ class (but not its inherited conversion /// functions). Each of the entries in this overload set is a @@ -321,20 +317,14 @@ public: base_class_iterator bases_end() { return Bases + NumBases; } base_class_const_iterator bases_end() const { return Bases + NumBases; } - /// getConstructors - Retrieve the overload set containing all of - /// the constructors of this class. - OverloadedFunctionDecl *getConstructors() { return &Constructors; } - - /// getConstructors - Retrieve the overload set containing all of - /// the constructors of this class. - const OverloadedFunctionDecl *getConstructors() const { return &Constructors; } - /// hasConstCopyConstructor - Determines whether this class has a /// copy constructor that accepts a const-qualified argument. bool hasConstCopyConstructor(ASTContext &Context) const; - /// addConstructor - Add another constructor to the list of constructors. - void addConstructor(ASTContext &Context, CXXConstructorDecl *ConDecl); + /// addedConstructor - Notify the class that another constructor has + /// been added. This routine helps maintain information about the + /// class based on which constructors have been added. + void addedConstructor(ASTContext &Context, CXXConstructorDecl *ConDecl); /// hasUserDeclaredConstructor - Whether this class has any /// user-declared constructors. When true, a default constructor @@ -348,13 +338,16 @@ public: return UserDeclaredCopyConstructor; } - /// getDestructor - Retrieve the destructor for this class. - CXXDestructorDecl *getDestructor() const { return Destructor; } + /// hasUserDeclaredDestructor - Whether this class has a + /// user-declared destructor. When false, a destructor will be + /// implicitly declared. + bool hasUserDeclaredDestructor() const { return UserDeclaredDestructor; } - /// setDestructor - Set the destructor for this class. - void setDestructor(CXXDestructorDecl *Destructor) { - assert(!this->Destructor && "Already have a destructor!"); - this->Destructor = Destructor; + /// 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 = true) { + UserDeclaredDestructor = UCD; } /// getConversions - Retrieve the overload set containing all of the @@ -402,8 +395,6 @@ public: return static_cast<CXXRecordDecl *>(const_cast<DeclContext*>(DC)); } - virtual void Destroy(ASTContext& C); - protected: /// EmitImpl - Serialize this CXXRecordDecl. Called by Decl::Emit. // FIXME: Implement this. diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def index a70f70eb034..fba04101cf3 100644 --- a/clang/include/clang/Basic/DiagnosticKinds.def +++ b/clang/include/clang/Basic/DiagnosticKinds.def @@ -1169,6 +1169,7 @@ DIAG(err_typecheck_incomplete_tag, ERROR, "incomplete definition of type %0") DIAG(err_typecheck_no_member, ERROR, "no member named %0") +DIAG(err_member_redeclared, ERROR, "class member cannot be redeclared") DIAG(err_typecheck_ivar_variable_size, ERROR, "instance variables must have a constant size") // FIXME: Improve with %select |

