improve DeclStmt to be able to store SourceRange info correctly.
Set the start of DeclStmt range.  Right now the end is meaningless 
though.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48330 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Parse/ParseStmt.cpp b/Parse/ParseStmt.cpp
index 389d5d4..160701e 100644
--- a/Parse/ParseStmt.cpp
+++ b/Parse/ParseStmt.cpp
@@ -93,7 +93,10 @@
 
   default:
     if (!OnlyStatement && isDeclarationSpecifier()) {
-      return Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext));
+      SourceLocation DeclStart = Tok.getLocation();
+      DeclTy *Res = ParseDeclaration(Declarator::BlockContext);
+      // FIXME: Pass in the right location for the end of the declstmt.
+      return Actions.ActOnDeclStmt(Res, DeclStart, SourceLocation());
     } else if (Tok.is(tok::r_brace)) {
       Diag(Tok, diag::err_expected_statement);
       return true;
@@ -255,7 +258,9 @@
     ParseDeclarator(DeclaratorInfo);
     
     DeclTy *Decl = ParseInitDeclaratorListAfterFirstDeclarator(DeclaratorInfo);
-    return Decl ? Actions.ActOnDeclStmt(Decl) : 0;
+    if (!Decl) return 0;
+    return Actions.ActOnDeclStmt(Decl, DS.getSourceRange().getBegin(),
+                                 DeclaratorInfo.getSourceRange().getEnd());
   }
   
   // Otherwise, this is an expression.  Seed it with II and parse it.
@@ -430,7 +435,10 @@
       if (isDeclarationSpecifier()) {
         // FIXME: Save the __extension__ on the decl as a node somehow.
         // FIXME: disable extwarns.
-        R = Actions.ActOnDeclStmt(ParseDeclaration(Declarator::BlockContext));
+        SourceLocation DeclStart = Tok.getLocation();
+        DeclTy *Res = ParseDeclaration(Declarator::BlockContext);
+        // FIXME: Pass in the right location for the end of the declstmt.
+        R = Actions.ActOnDeclStmt(Res, DeclStart, SourceLocation());
       } else {
         // Otherwise this was a unary __extension__ marker.  Parse the
         // subexpression and add the __extension__ unary op. 
@@ -743,8 +751,12 @@
     // Parse declaration, which eats the ';'.
     if (!getLang().C99)   // Use of C99-style for loops in C90 mode?
       Diag(Tok, diag::ext_c99_variable_decl_in_for_loop);
+    
+    SourceLocation DeclStart = Tok.getLocation();
     DeclTy *aBlockVarDecl = ParseDeclaration(Declarator::ForContext);
-    StmtResult stmtResult = Actions.ActOnDeclStmt(aBlockVarDecl);
+    // FIXME: Pass in the right location for the end of the declstmt.
+    StmtResult stmtResult = Actions.ActOnDeclStmt(aBlockVarDecl, DeclStart,
+                                                  SourceLocation());
     FirstPart = stmtResult.isInvalid ? 0 : stmtResult.Val;
     if ((ForEach = isTokIdentifier_in())) {
       ConsumeToken(); // consume 'in'