Store the type ID for __builtin_va_list in the PCH file, so that the
AST context's __builtin_va_list type will be set when the PCH file is
loaded. This fixes the crash when CodeGen'ing a va_arg expression
pulled in from a PCH file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69421 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index d7f0cd3..db9a1ce 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -1739,6 +1739,7 @@
   DeclsToEmit.push(Context.getTranslationUnitDecl());
 
   // Write the remaining PCH contents.
+  RecordData Record;
   Stream.EnterSubblock(pch::PCH_BLOCK_ID, 3);
   WriteTargetTriple(Context.Target);
   WriteLanguageOptions(Context.getLangOptions());
@@ -1749,11 +1750,17 @@
   WriteIdentifierTable();
   Stream.EmitRecord(pch::TYPE_OFFSET, TypeOffsets);
   Stream.EmitRecord(pch::DECL_OFFSET, DeclOffsets);
+
+  // Write the record of special types.
+  Record.clear();
+  AddTypeRef(Context.getBuiltinVaListType(), Record);
+  Stream.EmitRecord(pch::SPECIAL_TYPES, Record);
+
   if (!ExternalDefinitions.empty())
     Stream.EmitRecord(pch::EXTERNAL_DEFINITIONS, ExternalDefinitions);
   
   // Some simple statistics
-  RecordData Record;
+  Record.clear();
   Record.push_back(NumStatements);
   Stream.EmitRecord(pch::STATISTICS, Record);
   Stream.ExitBlock();