Implement Declarator::getSourceRange().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64151 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index eb84a4a..f28767a 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -522,6 +522,7 @@
     D.getMutableDeclSpec().SetTypeSpecType(DeclSpec::TST_int,
                                            D.getIdentifierLoc(),
                                            PrevSpec);
+    D.SetRangeBegin(D.getDeclSpec().getSourceRange().getBegin());
   }
 
   // If this declaration was formed with a K&R-style identifier list for the
@@ -702,7 +703,7 @@
 /// [GNU] simple-asm-expr:
 ///         'asm' '(' asm-string-literal ')'
 ///
-Parser::OwningExprResult Parser::ParseSimpleAsm() {
+Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
   assert(Tok.is(tok::kw_asm) && "Not an asm!");
   SourceLocation Loc = ConsumeToken();
 
@@ -711,14 +712,20 @@
     return ExprError();
   }
 
-  ConsumeParen();
+  Loc = ConsumeParen();
 
   OwningExprResult Result(ParseAsmStringLiteral());
 
-  if (Result.isInvalid())
-    SkipUntil(tok::r_paren);
-  else
-    MatchRHSPunctuation(tok::r_paren, Loc);
+  if (Result.isInvalid()) {
+    SkipUntil(tok::r_paren, true, true);
+    if (EndLoc)
+      *EndLoc = Tok.getLocation();
+    ConsumeAnyToken();
+  } else {
+    Loc = MatchRHSPunctuation(tok::r_paren, Loc);
+    if (EndLoc)
+      *EndLoc = Loc;
+  }
 
   return move(Result);
 }