summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-22 01:52:17 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-22 01:52:17 +0000
commit7cbd8fb6b0c1bba7fdcf7a8f86c1b15f2837e322 (patch)
tree0f9bffe574ebe2d8dc6a8e4c0e4bc8980864cc4e /clang/lib/Sema/SemaDecl.cpp
parente09ad90882f5bb2777f9446447105f58888f7416 (diff)
downloadbcm5719-llvm-7cbd8fb6b0c1bba7fdcf7a8f86c1b15f2837e322.tar.gz
bcm5719-llvm-7cbd8fb6b0c1bba7fdcf7a8f86c1b15f2837e322.zip
Keep track of whether a class is abstract or not. This is currently only used for the __is_abstract type trait.
llvm-svn: 67461
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7c80fa553e1..7b45d5232fb 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2224,9 +2224,12 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprArg init, bool DirectInit) {
Expr *Init = static_cast<Expr *>(init.get());
if ((IL = dyn_cast<IntegerLiteral>(Init)) && IL->getValue() == 0 &&
Context.getCanonicalType(IL->getType()) == Context.IntTy) {
- if (Method->isVirtual())
+ if (Method->isVirtual()) {
Method->setPure();
- else {
+
+ // A class is abstract if at least one function is pure virtual.
+ cast<CXXRecordDecl>(CurContext)->setAbstract(true);
+ } else {
Diag(Method->getLocation(), diag::err_non_virtual_pure)
<< Method->getDeclName() << Init->getSourceRange();
Method->setInvalidDecl();
OpenPOWER on IntegriCloud