aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-27 23:39:06 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-27 23:39:06 +0000
commit4a74df5901330c577d0a30d052338d06bbf9e279 (patch)
tree34bc23325bef54da08858f63abaffdce6b69c35f /lib/AST/DeclCXX.cpp
parentcdbfa6c4113411debfed9ffec2a45bd50b13e10f (diff)
Centralize the management of CXXRecordDecl::DefinitionData's
Polymorphic bit in CXXRecordDecl itself. Yes, this is also part of <rdar://problem/8459981>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclCXX.cpp')
-rw-r--r--lib/AST/DeclCXX.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index b4c130428c..151d333afc 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/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);