This commit contains lot's of small tweaks to how we pass around and store SourceLocation's for interfaces/protocols/categories/implementations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43475 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index f553356..dcf024e 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -203,9 +203,10 @@
                                       
   // This is used for both record definitions and ObjC interface declarations.
   virtual void ActOnFields(Scope* S,
-				 SourceLocation RecLoc, DeclTy *TagDecl,
-                                 DeclTy **Fields, unsigned NumFields,
-                                 tok::ObjCKeywordKind *visibility = 0);
+                           SourceLocation RecLoc, DeclTy *TagDecl,
+                           DeclTy **Fields, unsigned NumFields,
+                           SourceLocation LBrac, SourceLocation RBrac,
+                           tok::ObjCKeywordKind *visibility = 0);
   virtual DeclTy *ActOnEnumConstant(Scope *S, DeclTy *EnumDecl,
                                     DeclTy *LastEnumConstant,
                                     SourceLocation IdLoc, IdentifierInfo *Id,
@@ -517,7 +518,8 @@
                                        Protocols);
 
   virtual void ActOnAddMethodsToObjcDecl(Scope* S, DeclTy *ClassDecl, 
-				         DeclTy **allMethods, unsigned allNum);
+				         DeclTy **allMethods, unsigned allNum,
+                                         SourceLocation AtEndLoc);
   
   virtual DeclTy *ActOnMethodDeclaration(
     SourceLocation BeginLoc, // location of the + or -.
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 12efd45..1ec54d5 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1263,7 +1263,7 @@
   /// (legacy objective-c @implementation decl without an @interface decl).
   /// Add implementations's ivar to the synthesize class's ivar list.
   if (IDecl->ImplicitInterfaceDecl()) {
-    IDecl->ObjcAddInstanceVariablesToClass(ivars, numIvars);
+    IDecl->addInstanceVariablesToClass(ivars, numIvars, SourceLocation());
     return;
   }
   
@@ -1631,6 +1631,7 @@
 void Sema::ActOnFields(Scope* S,
                        SourceLocation RecLoc, DeclTy *RecDecl,
                        DeclTy **Fields, unsigned NumFields,
+                       SourceLocation LBrac, SourceLocation RBrac,
                        tok::ObjCKeywordKind *visibility) {
   Decl *EnclosingDecl = static_cast<Decl*>(RecDecl);
   assert(EnclosingDecl && "missing record or interface decl");
@@ -1769,7 +1770,7 @@
                     reinterpret_cast<ObjcIvarDecl**>(&RecFields[0]);
     if (isa<ObjcInterfaceDecl>(static_cast<Decl*>(RecDecl)))
       cast<ObjcInterfaceDecl>(static_cast<Decl*>(RecDecl))->
-        ObjcAddInstanceVariablesToClass(ClsFields, RecFields.size());
+        addInstanceVariablesToClass(ClsFields, RecFields.size(), RBrac);
     else if (isa<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl))) {
       ObjcImplementationDecl* IMPDecl = 
         cast<ObjcImplementationDecl>(static_cast<Decl*>(RecDecl));
@@ -1844,7 +1845,8 @@
 }
 
 void Sema::ActOnAddMethodsToObjcDecl(Scope* S, DeclTy *classDecl,
-                                     DeclTy **allMethods, unsigned allNum) {
+                                     DeclTy **allMethods, unsigned allNum,
+                                     SourceLocation AtEndLoc) {
   Decl *ClassDecl = static_cast<Decl *>(classDecl);
 
   // FIXME: If we don't have a ClassDecl, we have an error. I (snaroff) would
@@ -1906,26 +1908,26 @@
   }
   
   if (ObjcInterfaceDecl *I = dyn_cast<ObjcInterfaceDecl>(ClassDecl)) {
-    I->ObjcAddMethods(&insMethods[0], insMethods.size(),
-                      &clsMethods[0], clsMethods.size());
+    I->addMethods(&insMethods[0], insMethods.size(),
+                  &clsMethods[0], clsMethods.size(), AtEndLoc);
   } else if (ObjcProtocolDecl *P = dyn_cast<ObjcProtocolDecl>(ClassDecl)) {
-    P->ObjcAddProtoMethods(&insMethods[0], insMethods.size(),
-                           &clsMethods[0], clsMethods.size());
+    P->addMethods(&insMethods[0], insMethods.size(),
+                  &clsMethods[0], clsMethods.size(), AtEndLoc);
   }
   else if (ObjcCategoryDecl *C = dyn_cast<ObjcCategoryDecl>(ClassDecl)) {
-    C->ObjcAddCatMethods(&insMethods[0], insMethods.size(),
-                         &clsMethods[0], clsMethods.size());
+    C->addMethods(&insMethods[0], insMethods.size(),
+                  &clsMethods[0], clsMethods.size(), AtEndLoc);
   }
   else if (ObjcImplementationDecl *IC = 
                 dyn_cast<ObjcImplementationDecl>(ClassDecl)) {
-    IC->ObjcAddImplMethods(&insMethods[0], insMethods.size(),
-                           &clsMethods[0], clsMethods.size());
+    IC->addMethods(&insMethods[0], insMethods.size(),
+                   &clsMethods[0], clsMethods.size(), AtEndLoc);
     if (ObjcInterfaceDecl* IDecl = getObjCInterfaceDecl(IC->getIdentifier()))
       ImplMethodsVsClassMethods(IC, IDecl);
   } else {
     ObjcCategoryImplDecl* CatImplClass = cast<ObjcCategoryImplDecl>(ClassDecl);
-    CatImplClass->ObjcAddCatImplMethods(&insMethods[0], insMethods.size(),
-                                        &clsMethods[0], clsMethods.size());
+    CatImplClass->addMethods(&insMethods[0], insMethods.size(),
+                             &clsMethods[0], clsMethods.size(), AtEndLoc);
     ObjcInterfaceDecl* IDecl = CatImplClass->getClassInterface();
     // Find category interface decl and then check that all methods declared
     // in this interface is implemented in the category @implementation.