Fixed source range for all DeclaratorDecl's.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127225 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 24ca4e6..d34b000 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1797,10 +1797,14 @@
       }
     }
 
+    SourceLocation StartLoc = DI
+      ? DI->getTypeLoc().getBeginLoc()
+      : ArgInfo[i].NameLoc;
+
     ParmVarDecl* Param
-      = ParmVarDecl::Create(Context, ObjCMethod, ArgInfo[i].NameLoc,
-                            ArgInfo[i].Name, ArgType, DI,
-                            SC_None, SC_None, 0);
+      = ParmVarDecl::Create(Context, ObjCMethod,
+                            StartLoc, ArgInfo[i].NameLoc, ArgInfo[i].Name,
+                            ArgType, DI, SC_None, SC_None, 0);
 
     if (ArgType->isObjCObjectType()) {
       Diag(ArgInfo[i].NameLoc,
@@ -1928,7 +1932,9 @@
   for (unsigned i = 0; i < Ivars.size(); i++) {
     FieldDecl* ID = cast<FieldDecl>(Ivars[i]);
     RecordDecl *Record = dyn_cast<RecordDecl>(TagD);
-    Decl *FD = ObjCAtDefsFieldDecl::Create(Context, Record, ID->getLocation(),
+    Decl *FD = ObjCAtDefsFieldDecl::Create(Context, Record,
+                                           /*FIXME: StartL=*/ID->getLocation(),
+                                           ID->getLocation(),
                                            ID->getIdentifier(), ID->getType(),
                                            ID->getBitWidth());
     Decls.push_back(FD);
@@ -1946,17 +1952,17 @@
 }
 
 /// \brief Build a type-check a new Objective-C exception variable declaration.
-VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, 
-                                      QualType T,
-                                      IdentifierInfo *Name, 
-                                      SourceLocation NameLoc,
+VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T,
+                                      SourceLocation StartLoc,
+                                      SourceLocation IdLoc,
+                                      IdentifierInfo *Id,
                                       bool Invalid) {
   // ISO/IEC TR 18037 S6.7.3: "The type of an object with automatic storage 
   // duration shall not be qualified by an address-space qualifier."
   // Since all parameters have automatic store duration, they can not have
   // an address space.
   if (T.getAddressSpace() != 0) {
-    Diag(NameLoc, diag::err_arg_with_address_space);
+    Diag(IdLoc, diag::err_arg_with_address_space);
     Invalid = true;
   }
   
@@ -1968,14 +1974,14 @@
     // Okay: we don't know what this type will instantiate to.
   } else if (!T->isObjCObjectPointerType()) {
     Invalid = true;
-    Diag(NameLoc ,diag::err_catch_param_not_objc_type);
+    Diag(IdLoc ,diag::err_catch_param_not_objc_type);
   } else if (T->isObjCQualifiedIdType()) {
     Invalid = true;
-    Diag(NameLoc, diag::err_illegal_qualifiers_on_catch_parm);
+    Diag(IdLoc, diag::err_illegal_qualifiers_on_catch_parm);
   }
   
-  VarDecl *New = VarDecl::Create(Context, CurContext, NameLoc, Name, T, TInfo,
-                                 SC_None, SC_None);
+  VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id,
+                                 T, TInfo, SC_None, SC_None);
   New->setExceptionVariable(true);
   
   if (Invalid)
@@ -2016,8 +2022,10 @@
       << Context.getTypeDeclType(OwnedDecl);
   }
 
-  VarDecl *New = BuildObjCExceptionDecl(TInfo, ExceptionType, D.getIdentifier(), 
-                                        D.getIdentifierLoc(), 
+  VarDecl *New = BuildObjCExceptionDecl(TInfo, ExceptionType,
+                                        D.getSourceRange().getBegin(),
+                                        D.getIdentifierLoc(),
+                                        D.getIdentifier(),
                                         D.isInvalidType());
   
   // Parameter declarators cannot be qualified (C++ [dcl.meaning]p1).