diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2012-08-16 22:38:41 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-08-16 22:38:41 +0000 |
| commit | 78f565b0a0f2578c1f79ad850506669f8f54ec49 (patch) | |
| tree | 3000c8a9f8cfca70494504ea718b97465d87b6bb /clang/lib | |
| parent | 50cf25c72df4039ac0e0316f5ee786eb3e72735d (diff) | |
| download | bcm5719-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.cpp | 10 |
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, |

