summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-08-16 22:38:41 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-08-16 22:38:41 +0000
commit78f565b0a0f2578c1f79ad850506669f8f54ec49 (patch)
tree3000c8a9f8cfca70494504ea718b97465d87b6bb /clang/lib
parent50cf25c72df4039ac0e0316f5ee786eb3e72735d (diff)
downloadbcm5719-llvm-78f565b0a0f2578c1f79ad850506669f8f54ec49.tar.gz
bcm5719-llvm-78f565b0a0f2578c1f79ad850506669f8f54ec49.zip
objective-C++: issue diagnostic when ivar type is
an abstract c++ class. // rdar://12095239 llvm-svn: 162052
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index d37fbf53786..01b2f2c8397 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9913,6 +9913,13 @@ void Sema::ActOnFields(Scope* S,
}
}
}
+ if (isa<ObjCContainerDecl>(EnclosingDecl) &&
+ RequireNonAbstractType(FD->getLocation(), FD->getType(),
+ diag::err_abstract_type_in_decl,
+ AbstractIvarType)) {
+ // Ivars can not have abstract class types
+ FD->setInvalidDecl();
+ }
if (Record && FDTTy->getDecl()->hasObjectMember())
Record->setHasObjectMember(true);
} else if (FDTy->isObjCObjectType()) {
@@ -9921,8 +9928,7 @@ void Sema::ActOnFields(Scope* S,
<< FixItHint::CreateInsertion(FD->getLocation(), "*");
QualType T = Context.getObjCObjectPointerType(FD->getType());
FD->setType(T);
- }
- else if (!getLangOpts().CPlusPlus) {
+ } else if (!getLangOpts().CPlusPlus) {
if (getLangOpts().ObjCAutoRefCount && Record && !ARCErrReported) {
// It's an error in ARC if a field has lifetime.
// We don't want to report this in a system header, though,
OpenPOWER on IntegriCloud