summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-05 23:03:49 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-05 23:03:49 +0000
commit89c038e518f0ea092e4aac66df1eb47470b6dca5 (patch)
tree118772e0c0ef0a3e0e07bd9ed0e553bb425f1fb9 /clang/lib
parent4ed44eb7d96a91c462ad1bb7cd47118dbda78c4d (diff)
downloadbcm5719-llvm-89c038e518f0ea092e4aac66df1eb47470b6dca5.tar.gz
bcm5719-llvm-89c038e518f0ea092e4aac66df1eb47470b6dca5.zip
Fix for PR5693: shift some code into SetClassDeclAttributesFromBase so that
it gets called during template instantiation. llvm-svn: 90682
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 992bb80189a..652b92db5ed 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -484,10 +484,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
assert(BaseDecl && "Base type is not incomplete, but has no definition");
CXXRecordDecl * CXXBaseDecl = cast<CXXRecordDecl>(BaseDecl);
assert(CXXBaseDecl && "Base type is not a C++ type");
- if (!CXXBaseDecl->isEmpty())
- Class->setEmpty(false);
- if (CXXBaseDecl->isPolymorphic())
- Class->setPolymorphic(true);
+
// C++0x CWG Issue #817 indicates that [[final]] classes shouldn't be bases.
if (CXXBaseDecl->hasAttr<FinalAttr>()) {
Diag(BaseLoc, diag::err_final_base) << BaseType.getAsString();
@@ -496,7 +493,7 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
return 0;
}
- SetClassDeclAttributesFromBase(Class, cast<CXXRecordDecl>(BaseDecl), Virtual);
+ SetClassDeclAttributesFromBase(Class, CXXBaseDecl, Virtual);
// Create the base specifier.
// FIXME: Allocate via ASTContext?
@@ -508,10 +505,23 @@ Sema::CheckBaseSpecifier(CXXRecordDecl *Class,
void Sema::SetClassDeclAttributesFromBase(CXXRecordDecl *Class,
const CXXRecordDecl *BaseClass,
bool BaseIsVirtual) {
+ // A class with a non-empty base class is not empty.
+ // FIXME: Standard ref?
+ if (!BaseClass->isEmpty())
+ Class->setEmpty(false);
+
+ // C++ [class.virtual]p1:
+ // A class that [...] inherits a virtual function is called a polymorphic
+ // class.
+ if (BaseClass->isPolymorphic())
+ Class->setPolymorphic(true);
// C++ [dcl.init.aggr]p1:
// An aggregate is [...] a class with [...] no base classes [...].
Class->setAggregate(false);
+
+ // C++ [class]p4:
+ // A POD-struct is an aggregate class...
Class->setPOD(false);
if (BaseIsVirtual) {
OpenPOWER on IntegriCloud