aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-04-02 08:55:10 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-04-02 08:55:10 +0000
commit11d2b2d2bb706fca0656f2760839721bb7f6cb6f (patch)
treed374cdca417e76f1bf101f139dba2db1d10ee8f7 /lib/Sema/SemaDeclObjC.cpp
parentc0c7bca4e5b8d12699dc93a0da49e9e4bb79671b (diff)
downloadsrc-11d2b2d2bb706fca0656f2760839721bb7f6cb6f.tar.gz
src-11d2b2d2bb706fca0656f2760839721bb7f6cb6f.zip
Update clang to r100181.
Notes
Notes: svn path=/vendor/clang/dist/; revision=206084
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp48
1 files changed, 34 insertions, 14 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index b2f671760ebe..9bc0846901aa 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -559,8 +559,8 @@ Sema::DeclPtrTy Sema::ActOnStartClassImplementation(
<< ClassName << R.getLookupName();
Diag(IDecl->getLocation(), diag::note_previous_decl)
<< R.getLookupName()
- << CodeModificationHint::CreateReplacement(ClassLoc,
- R.getLookupName().getAsString());
+ << FixItHint::CreateReplacement(ClassLoc,
+ R.getLookupName().getAsString());
IDecl = 0;
} else {
Diag(ClassLoc, diag::warn_undef_interface) << ClassName;
@@ -667,8 +667,6 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
Diag(ClsIvar->getLocation(), diag::note_previous_definition);
continue;
}
- if (ImplIvar->getAccessControl() != ObjCIvarDecl::Private)
- Diag(ImplIvar->getLocation(), diag::err_non_private_ivar_declaration);
// Instance ivar to Implementation's DeclContext.
ImplIvar->setLexicalDeclContext(ImpDecl);
IDecl->makeDeclVisibleInContext(ImplIvar, false);
@@ -721,12 +719,13 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
}
void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method,
- bool &IncompleteImpl) {
+ bool &IncompleteImpl, unsigned DiagID) {
if (!IncompleteImpl) {
Diag(ImpLoc, diag::warn_incomplete_impl);
IncompleteImpl = true;
}
- Diag(ImpLoc, diag::warn_undef_method_impl) << method->getDeclName();
+ Diag(method->getLocation(), DiagID)
+ << method->getDeclName();
}
void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl,
@@ -770,7 +769,14 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc,
bool& IncompleteImpl,
const llvm::DenseSet<Selector> &InsMap,
const llvm::DenseSet<Selector> &ClsMap,
- ObjCInterfaceDecl *IDecl) {
+ ObjCContainerDecl *CDecl) {
+ ObjCInterfaceDecl *IDecl;
+ if (ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl))
+ IDecl = C->getClassInterface();
+ else
+ IDecl = dyn_cast<ObjCInterfaceDecl>(CDecl);
+ assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
+
ObjCInterfaceDecl *Super = IDecl->getSuperClass();
ObjCInterfaceDecl *NSIDecl = 0;
if (getLangOptions().NeXTRuntime) {
@@ -808,8 +814,14 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc,
// uses the protocol.
ObjCMethodDecl *MethodInClass =
IDecl->lookupInstanceMethod(method->getSelector());
- if (!MethodInClass || !MethodInClass->isSynthesized())
- WarnUndefinedMethod(ImpLoc, method, IncompleteImpl);
+ if (!MethodInClass || !MethodInClass->isSynthesized()) {
+ unsigned DIAG = diag::warn_unimplemented_protocol_method;
+ if (Diags.getDiagnosticLevel(DIAG) != Diagnostic::Ignored) {
+ WarnUndefinedMethod(ImpLoc, method, IncompleteImpl, DIAG);
+ Diag(CDecl->getLocation(), diag::note_required_for_protocol_at)
+ << PDecl->getDeclName();
+ }
+ }
}
}
// check unimplemented class methods
@@ -819,8 +831,14 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc,
ObjCMethodDecl *method = *I;
if (method->getImplementationControl() != ObjCMethodDecl::Optional &&
!ClsMap.count(method->getSelector()) &&
- (!Super || !Super->lookupClassMethod(method->getSelector())))
- WarnUndefinedMethod(ImpLoc, method, IncompleteImpl);
+ (!Super || !Super->lookupClassMethod(method->getSelector()))) {
+ unsigned DIAG = diag::warn_unimplemented_protocol_method;
+ if (Diags.getDiagnosticLevel(DIAG) != Diagnostic::Ignored) {
+ WarnUndefinedMethod(ImpLoc, method, IncompleteImpl, DIAG);
+ Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) <<
+ PDecl->getDeclName();
+ }
+ }
}
// Check on this protocols's referenced protocols, recursively.
for (ObjCProtocolDecl::protocol_iterator PI = PDecl->protocol_begin(),
@@ -849,7 +867,8 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap,
if (!(*I)->isSynthesized() &&
!InsMap.count((*I)->getSelector())) {
if (ImmediateClass)
- WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
+ WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl,
+ diag::note_undef_method_impl);
continue;
} else {
ObjCMethodDecl *ImpMethodDecl =
@@ -873,7 +892,8 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap,
ClsMapSeen.insert((*I)->getSelector());
if (!ClsMap.count((*I)->getSelector())) {
if (ImmediateClass)
- WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
+ WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl,
+ diag::note_undef_method_impl);
} else {
ObjCMethodDecl *ImpMethodDecl =
IMPDecl->getClassMethod((*I)->getSelector());
@@ -950,7 +970,7 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl,
for (ObjCCategoryDecl::protocol_iterator PI = C->protocol_begin(),
E = C->protocol_end(); PI != E; ++PI)
CheckProtocolMethodDefs(IMPDecl->getLocation(), *PI, IncompleteImpl,
- InsMap, ClsMap, C->getClassInterface());
+ InsMap, ClsMap, CDecl);
// Report unimplemented properties in the category as well.
// When reporting on missing setter/getters, do not report when
// setter/getter is implemented in category's primary class