Change ObjCContainerDecl to contain the entire range for the '@end'
piece of the declaration.  The '@' and the 'end' are separate tokens,
and require two SourceLocations to accurately track.

This change was motivated because ObjCContainerDecl::getSourceRange()
would previously not return the entire range of the declaration (the
'end' would be left off).

llvm-svn: 92891
diff --git a/clang/lib/Sema/Sema.h b/clang/lib/Sema/Sema.h
index 7838bbe..0b6d16c 100644
--- a/clang/lib/Sema/Sema.h
+++ b/clang/lib/Sema/Sema.h
@@ -3344,10 +3344,11 @@
   void MergeOneProtocolPropertiesIntoClass(Decl *CDecl,
                                            ObjCProtocolDecl *PDecl);
 
-  virtual void ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl,
-                      DeclPtrTy *allMethods = 0, unsigned allNum = 0,
-                      DeclPtrTy *allProperties = 0, unsigned pNum = 0,
-                      DeclGroupPtrTy *allTUVars = 0, unsigned tuvNum = 0);
+  virtual void ActOnAtEnd(SourceRange AtEnd,
+                          DeclPtrTy classDecl,
+                          DeclPtrTy *allMethods = 0, unsigned allNum = 0,
+                          DeclPtrTy *allProperties = 0, unsigned pNum = 0,
+                          DeclGroupPtrTy *allTUVars = 0, unsigned tuvNum = 0);
 
   virtual DeclPtrTy ActOnProperty(Scope *S, SourceLocation AtLoc,
                                   FieldDeclarator &FD, ObjCDeclSpec &ODS,
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 179255a..f2fc1f4 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -1612,7 +1612,8 @@
 
 // Note: For class/category implemenations, allMethods/allProperties is
 // always null.
-void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl,
+void Sema::ActOnAtEnd(SourceRange AtEnd,
+                      DeclPtrTy classDecl,
                       DeclPtrTy *allMethods, unsigned allNum,
                       DeclPtrTy *allProperties, unsigned pNum,
                       DeclGroupPtrTy *allTUVars, unsigned tuvNum) {
@@ -1629,9 +1630,13 @@
          || isa<ObjCProtocolDecl>(ClassDecl);
   bool checkIdenticalMethods = isa<ObjCImplementationDecl>(ClassDecl);
 
-  if (!isInterfaceDeclKind && AtEndLoc.isInvalid()) {
-    AtEndLoc = ClassDecl->getLocation();
-    Diag(AtEndLoc, diag::warn_missing_atend);
+  if (!isInterfaceDeclKind && AtEnd.isInvalid()) {
+    // FIXME: This is wrong.  We shouldn't be pretending that there is
+    //  an '@end' in the declaration.
+    SourceLocation L = ClassDecl->getLocation();
+    AtEnd.setBegin(L);
+    AtEnd.setEnd(L);
+    Diag(L, diag::warn_missing_atend);
   }
   
   DeclContext *DC = dyn_cast<DeclContext>(ClassDecl);
@@ -1708,17 +1713,17 @@
                                           E = CDecl->prop_end();
          I != E; ++I)
       ProcessPropertyDecl(*I, CDecl);
-    CDecl->setAtEndLoc(AtEndLoc);
+    CDecl->setAtEndRange(AtEnd);
   }
   if (ObjCImplementationDecl *IC=dyn_cast<ObjCImplementationDecl>(ClassDecl)) {
-    IC->setAtEndLoc(AtEndLoc);
+    IC->setAtEndRange(AtEnd);
     if (ObjCInterfaceDecl* IDecl = IC->getClassInterface()) {
       ImplMethodsVsClassMethods(IC, IDecl);
       AtomicPropertySetterGetterRules(IC, IDecl);
     }
   } else if (ObjCCategoryImplDecl* CatImplClass =
                                    dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
-    CatImplClass->setAtEndLoc(AtEndLoc);
+    CatImplClass->setAtEndRange(AtEnd);
 
     // Find category interface decl and then check that all methods declared
     // in this interface are implemented in the category @implementation.