My previous fix was incorrect for non-chained PCH reuse. Fix again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114922 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index 61ba5ab..3f537d2 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -1334,7 +1334,7 @@
// If the preprocessor has a preprocessing record, emit it.
unsigned NumPreprocessingRecords = 0;
if (PPRec) {
- unsigned IndexBase = PPRec->getNumPreallocatedEntities();
+ unsigned IndexBase = Chain ? PPRec->getNumPreallocatedEntities() : 0;
for (PreprocessingRecord::iterator E = PPRec->begin(Chain),
EEnd = PPRec->end(Chain);
E != EEnd; ++E) {