Added PushOnScopeChains method to Sema, that adds a decl to both the IdResolver and the Scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49567 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index 9285872..c6a862b 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -48,31 +48,26 @@
   
   // Add the built-in ObjC types.
   t = cast<TypedefType>(Context.getObjCIdType().getTypePtr());
-  IdResolver.AddDecl(t->getDecl(), S);
-  TUScope->AddDecl(t->getDecl());
+  PushOnScopeChains(t->getDecl(), TUScope);
   t = cast<TypedefType>(Context.getObjCClassType().getTypePtr());
-  IdResolver.AddDecl(t->getDecl(), S);
-  TUScope->AddDecl(t->getDecl());
+  PushOnScopeChains(t->getDecl(), TUScope);
   ObjCInterfaceType *it = cast<ObjCInterfaceType>(Context.getObjCProtoType());
   ObjCInterfaceDecl *IDecl = it->getDecl();
-  IdResolver.AddDecl(IDecl, S);
-  TUScope->AddDecl(IDecl);
+  PushOnScopeChains(IDecl, TUScope);
   
   // Synthesize "typedef struct objc_selector *SEL;"
   RecordDecl *SelTag = RecordDecl::Create(Context, Decl::Struct, CurContext,
                                           SourceLocation(), 
                                           &Context.Idents.get("objc_selector"),
                                           0);
-  IdResolver.AddDecl(SelTag, S);
-  TUScope->AddDecl(SelTag);
+  PushOnScopeChains(SelTag, TUScope);
   
   QualType SelT = Context.getPointerType(Context.getTagDeclType(SelTag));
   TypedefDecl *SelTypedef = TypedefDecl::Create(Context, CurContext,
                                                 SourceLocation(),
                                                 &Context.Idents.get("SEL"),
                                                 SelT, 0);
-  IdResolver.AddDecl(SelTypedef, S);
-  TUScope->AddDecl(SelTypedef);
+  PushOnScopeChains(SelTypedef, TUScope);
   Context.setObjCSelType(SelTypedef);
 }