Eliminate Sema::ObjCImplementations, relying instead on name lookup. What's good for uniformity is good for PCH (or is it the other way around?).
As part of this, make ObjCImplDecl inherit from NamedDecl (since
ObjCImplementationDecls now need to have names so that they can be
found). This brings ObjCImplDecl very, very close to
ObjCContainerDecl; we may be able to merge them soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69941 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 7badaa3..e0cbdce 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -677,18 +677,15 @@
ObjCImplementationDecl::Create(Context, CurContext, AtClassImplLoc,
IDecl, SDecl);
- // FIXME: PushOnScopeChains?
- CurContext->addDecl(Context, IMPDecl);
-
if (CheckObjCDeclScope(IMPDecl))
return DeclPtrTy::make(IMPDecl);
// Check that there is no duplicate implementation of this class.
- if (ObjCImplementations[ClassName])
+ if (LookupObjCImplementation(ClassName))
// FIXME: Don't leak everything!
Diag(ClassLoc, diag::err_dup_implementation_class) << ClassName;
else // add it to the list.
- ObjCImplementations[ClassName] = IMPDecl;
+ PushOnScopeChains(IMPDecl, TUScope);
return DeclPtrTy::make(IMPDecl);
}
@@ -832,8 +829,8 @@
}
}
// Lastly, look through the implementation (if one is in scope).
- if (ObjCImplementationDecl *ImpDecl =
- ObjCImplementations[IDecl->getIdentifier()])
+ if (ObjCImplementationDecl *ImpDecl
+ = LookupObjCImplementation(IDecl->getIdentifier()))
if (ImpDecl->getInstanceMethod(Context, PDecl->getSetterName()))
return false;
// If all fails, look at the super class.