SourceLocation Loc = SourceLocation());
ObjCProtocolDecl *LookupProtocol(IdentifierInfo *II);
- ObjCImplementationDecl *LookupObjCImplementation(IdentifierInfo *II);
ObjCCategoryImplDecl *LookupObjCCategoryImpl(IdentifierInfo *II);
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S,
return DeclPtrTy::make(IMPDecl);
// Check that there is no duplicate implementation of this class.
- if (LookupObjCImplementation(ClassName))
+ if (IDecl->getImplementation()) {
// FIXME: Don't leak everything!
Diag(ClassLoc, diag::err_dup_implementation_class) << ClassName;
- else { // add it to the list.
+ Diag(IDecl->getImplementation()->getLocation(),
+ diag::note_previous_definition);
+ } else { // add it to the list.
IDecl->setImplementation(IMPDecl);
PushOnScopeChains(IMPDecl, TUScope);
}
}
}
// Lastly, look through the implementation (if one is in scope).
- if (ObjCImplementationDecl *ImpDecl
- = LookupObjCImplementation(IDecl->getIdentifier()))
+ if (ObjCImplementationDecl *ImpDecl = IDecl->getImplementation())
if (ImpDecl->getInstanceMethod(PDecl->getSetterName()))
return false;
// If all fails, look at the super class.
const ObjCInterfaceDecl *IFace,
const Selector &Sel) {
ObjCMethodDecl *Method = 0;
- if (ObjCImplementationDecl *ImpDecl
- = LookupObjCImplementation(IFace->getIdentifier()))
+ if (ObjCImplementationDecl *ImpDecl = IFace->getImplementation())
Method = ImpDecl->getInstanceMethod(Sel);
if (!Method && IFace->getSuperClass())
ObjCMethodDecl *Method = 0;
// lookup in class and all superclasses
while (ClassDecl && !Method) {
- if (ObjCImplementationDecl *ImpDecl
- = LookupObjCImplementation(ClassDecl->getIdentifier()))
+ if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
Method = ImpDecl->getClassMethod(Sel);
// Look through local category implementations associated with the class.
ObjCMethodDecl *Method = 0;
while (ClassDecl && !Method) {
// If we have implementations in scope, check "private" methods.
- if (ObjCImplementationDecl *ImpDecl
- = LookupObjCImplementation(ClassDecl->getIdentifier()))
+ if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
Method = ImpDecl->getInstanceMethod(Sel);
// Look through local category implementations associated with the class.
if (!Getter)
if (ObjCMethodDecl *CurMeth = getCurMethodDecl())
if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface())
- if (ObjCImplementationDecl *ImpDecl
- = LookupObjCImplementation(ClassDecl->getIdentifier()))
+ if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
Getter = ImpDecl->getClassMethod(Sel);
if (Getter) {
// methods.
if (ObjCMethodDecl *CurMeth = getCurMethodDecl())
if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface())
- if (ObjCImplementationDecl *ImpDecl
- = LookupObjCImplementation(ClassDecl->getIdentifier()))
+ if (ObjCImplementationDecl *ImpDecl = ClassDecl->getImplementation())
Setter = ImpDecl->getClassMethod(SetterSel);
}
// Look through local category implementations associated with the class.
return cast_or_null<ObjCProtocolDecl>(D);
}
-/// \brief Find the Objective-C implementation with the given name, if
-/// any.
-ObjCImplementationDecl *Sema::LookupObjCImplementation(IdentifierInfo *II) {
- Decl *D = LookupName(TUScope, II, LookupObjCImplementationName).getAsDecl();
- return cast_or_null<ObjCImplementationDecl>(D);
-}
-
/// \brief Find the Objective-C category implementation with the given
/// name, if any.
ObjCCategoryImplDecl *Sema::LookupObjCCategoryImpl(IdentifierInfo *II) {
@interface INTF : OBJECT
@end
-@implementation INTF @end
+@implementation INTF @end // expected-note {{previous definition is here}}
@implementation INTF // expected-error {{reimplementation of class 'INTF'}}
@end