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/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index dc8d3fc..6c79b8a 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -1316,6 +1316,10 @@
ExternalDefinitions.swap(Record);
break;
+ case pch::SPECIAL_TYPES:
+ SpecialTypes.swap(Record);
+ break;
+
case pch::STATISTICS:
TotalNumStatements = Record[0];
break;
@@ -1399,6 +1403,10 @@
// Load the translation unit declaration
ReadDeclRecord(DeclOffsets[0], 0);
+ // Load the special types.
+ Context.setBuiltinVaListType(
+ GetType(SpecialTypes[pch::SPECIAL_TYPE_BUILTIN_VA_LIST]));
+
return Success;
}