Keep track of whether a class is abstract or not. This is currently only used for the __is_abstract type trait.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67461 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7c80fa5..7b45d52 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2224,9 +2224,12 @@
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();