diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-09-27 23:39:06 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-09-27 23:39:06 +0000 |
| commit | d22553cf2122a5e2de6980cf01a98a926851b77e (patch) | |
| tree | 868f9afd54696d716907eec943a8e6be58ca423b | |
| parent | 01daafc58a7fec37dfc41877f2a386cba0b6c5d3 (diff) | |
| download | bcm5719-llvm-d22553cf2122a5e2de6980cf01a98a926851b77e.tar.gz bcm5719-llvm-d22553cf2122a5e2de6980cf01a98a926851b77e.zip | |
Centralize the management of CXXRecordDecl::DefinitionData's
Polymorphic bit in CXXRecordDecl itself. Yes, this is also part of
<rdar://problem/8459981>.
llvm-svn: 114925
| -rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 4 | ||||
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 6 |
3 files changed, 11 insertions, 11 deletions
diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 26020ba6c45..53bd720c97c 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -708,10 +708,6 @@ public: /// which means that the class contains or inherits a virtual function. bool isPolymorphic() const { return data().Polymorphic; } - /// setPolymorphic - Set whether this class is polymorphic (C++ - /// [class.virtual]). - void setPolymorphic(bool Poly) { data().Polymorphic = Poly; } - /// isAbstract - Whether this class is abstract (C++ [class.abstract]), /// which means that the class contains or inherits a pure virtual function. bool isAbstract() const { return data().Abstract; } diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index b4c130428c5..151d333afcc 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -110,6 +110,12 @@ CXXRecordDecl::setBases(CXXBaseSpecifier const * const *Bases, if (!BaseClassDecl->isEmpty()) data().Empty = false; + // C++ [class.virtual]p1: + // A class that declares or inherits a virtual function is called a + // polymorphic class. + if (BaseClassDecl->isPolymorphic()) + data().Polymorphic = true; + // Now go through all virtual bases of this base and add them. for (CXXRecordDecl::base_class_iterator VBase = BaseClassDecl->vbases_begin(), @@ -298,6 +304,11 @@ CXXRecordDecl::addedMember(Decl *D) { // Virtual functions make the class non-empty. // FIXME: Standard ref? data().Empty = false; + + // C++ [class.virtual]p1: + // A class that declares or inherits a virtual function is called a + // polymorphic class. + data().Polymorphic = true; } } @@ -640,7 +651,6 @@ void CXXRecordDecl::removeConversion(const NamedDecl *ConvDecl) { void CXXRecordDecl::setMethodAsVirtual(FunctionDecl *Method) { Method->setVirtualAsWritten(true); - setPolymorphic(true); setHasTrivialConstructor(false); setHasTrivialCopyConstructor(false); setHasTrivialCopyAssignment(false); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index c9a19dd6258..ebf467fe7aa 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -516,12 +516,6 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class, void Sema::SetClassDeclAttributesFromBase(CXXRecordDecl *Class, const CXXRecordDecl *BaseClass, bool BaseIsVirtual) { - // C++ [class.virtual]p1: - // A class that [...] inherits a virtual function is called a polymorphic - // class. - if (BaseClass->isPolymorphic()) - Class->setPolymorphic(true); - if (BaseIsVirtual) { // C++ [class.ctor]p5: // A constructor is trivial if its class has no virtual base classes. |

