Support tentative definitions in precompiled headers. This isn't likely
to happen (ever), but at least we'll do the right thing when it does.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69829 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index b081a28..097ced2 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -2024,6 +2024,15 @@
       getIdentifierRef(&Table.get(BuiltinNames[I]));
   }
 
+  // Build a record containing all of the tentative definitions in
+  // this header file. Generally, this record will be empty.
+  RecordData TentativeDefinitions;
+  for (llvm::DenseMap<DeclarationName, VarDecl *>::iterator 
+         TD = SemaRef.TentativeDefinitions.begin(),
+         TDEnd = SemaRef.TentativeDefinitions.end();
+       TD != TDEnd; ++TD)
+    AddDeclRef(TD->second, TentativeDefinitions);
+
   // Write the remaining PCH contents.
   RecordData Record;
   Stream.EnterSubblock(pch::PCH_BLOCK_ID, 3);
@@ -2042,8 +2051,13 @@
   AddTypeRef(Context.getBuiltinVaListType(), Record);
   Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
 
+  // Write the record containing external, unnamed definitions.
   if (!ExternalDefinitions.empty())
     Stream.EmitRecord(pch::EXTERNAL_DEFINITIONS, ExternalDefinitions);
+
+  // Write the record containing tentative definitions.
+  if (!TentativeDefinitions.empty())
+    Stream.EmitRecord(pch::TENTATIVE_DEFINITIONS, TentativeDefinitions);
   
   // Some simple statistics
   Record.clear();