Keep track of the right paren ')' source location in a function declarator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79489 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 9958bdf..d3d2cf0 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -2451,7 +2451,8 @@
       delete AttrList;
     }
 
-    SourceLocation Loc = ConsumeParen();  // Eat the closing ')'.
+    SourceLocation RParenLoc = ConsumeParen();  // Eat the closing ')'.
+    SourceLocation EndLoc = RParenLoc;
 
     // cv-qualifier-seq[opt].
     DeclSpec DS;
@@ -2463,13 +2464,13 @@
     if (getLang().CPlusPlus) {
       ParseTypeQualifierListOpt(DS, false /*no attributes*/);
       if (!DS.getSourceRange().getEnd().isInvalid())
-        Loc = DS.getSourceRange().getEnd();
+        EndLoc = DS.getSourceRange().getEnd();
 
       // Parse exception-specification[opt].
       if (Tok.is(tok::kw_throw)) {
         hasExceptionSpec = true;
         ThrowLoc = Tok.getLocation();
-        ParseExceptionSpecification(Loc, Exceptions, ExceptionRanges,
+        ParseExceptionSpecification(EndLoc, Exceptions, ExceptionRanges,
                                     hasAnyExceptionSpec);
         assert(Exceptions.size() == ExceptionRanges.size() &&
                "Produced different number of exception types and ranges.");
@@ -2488,8 +2489,8 @@
                                                Exceptions.data(),
                                                ExceptionRanges.data(),
                                                Exceptions.size(),
-                                               LParenLoc, D),
-                  Loc);
+                                               LParenLoc, RParenLoc, D),
+                  EndLoc);
     return;
   }
 
@@ -2629,7 +2630,8 @@
   PrototypeScope.Exit();
   
   // If we have the closing ')', eat it.
-  SourceLocation Loc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
+  SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc);
+  SourceLocation EndLoc = RParenLoc;
 
   DeclSpec DS;
   bool hasExceptionSpec = false;
@@ -2641,13 +2643,13 @@
     // Parse cv-qualifier-seq[opt].
     ParseTypeQualifierListOpt(DS, false /*no attributes*/);
       if (!DS.getSourceRange().getEnd().isInvalid())
-        Loc = DS.getSourceRange().getEnd();
+        EndLoc = DS.getSourceRange().getEnd();
 
     // Parse exception-specification[opt].
     if (Tok.is(tok::kw_throw)) {
       hasExceptionSpec = true;
       ThrowLoc = Tok.getLocation();
-      ParseExceptionSpecification(Loc, Exceptions, ExceptionRanges,
+      ParseExceptionSpecification(EndLoc, Exceptions, ExceptionRanges,
                                   hasAnyExceptionSpec);
       assert(Exceptions.size() == ExceptionRanges.size() &&
              "Produced different number of exception types and ranges.");
@@ -2663,8 +2665,9 @@
                                              hasAnyExceptionSpec,
                                              Exceptions.data(),
                                              ExceptionRanges.data(),
-                                             Exceptions.size(), LParenLoc, D),
-                Loc);
+                                             Exceptions.size(),
+                                             LParenLoc, RParenLoc, D),
+                EndLoc);
 }
 
 /// ParseFunctionDeclaratorIdentifierList - While parsing a function declarator
@@ -2740,7 +2743,7 @@
                                              /*TypeQuals*/0,
                                              /*exception*/false,
                                              SourceLocation(), false, 0, 0, 0,
-                                             LParenLoc, D),
+                                             LParenLoc, RLoc, D),
                 RLoc);
 }