Several fixes/simplifications surrounding how we stream top-level decl AST's.

The following code...

typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;

struct Y { int A; };

struct X { int A; } D; 

struct X E, F;

...now produces the following output...

> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'

...which is much more accurate than the previous -ast-print output...

typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44421 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index 1b232df..cbb94bc 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -69,11 +69,9 @@
   /// the method decl for the method being parsed.
   ObjcMethodDecl *CurMethodDecl;
   
-  /// LastInGroupList - This vector is populated when there are multiple
-  /// declarators in a single decl group (e.g. "int A, B, C").  In this case,
-  /// all but the last decl will be entered into this.  This is used by the
-  /// ASTStreamer.
-  std::vector<Decl*> &LastInGroupList;
+  /// TopLevelDeclList - This vector is populated with all declarators from
+  /// a top-level declaration. This is used by the ASTStreamer.
+  std::vector<Decl*> &TopLevelDeclList;
   
   /// LabelMap - This is a mapping from label identifiers to the LabelStmt for
   /// it (which acts like the label decl in some ways).  Forward referenced
@@ -231,7 +229,7 @@
   VarDecl *MergeVarDecl(VarDecl *New, ScopedDecl *Old);
   /// AddTopLevelDecl - called after the decl has been fully processed.
   /// Allows for bookkeeping and post-processing of each declaration.
-  void AddTopLevelDecl(Decl *current, Decl *last);
+  void AddTopLevelDecl(Decl *current);
 
   /// More parsing and symbol table subroutines...
   ParmVarDecl *ActOnParamDeclarator(struct DeclaratorChunk::ParamInfo &PI,