/// at those bit offsets.
ContinuousRangeMap<uint64_t, Module*, 4> GlobalBitOffsetsMap;
- /// \brief SLocEntries that we're going to preload.
- SmallVector<int, 64> PreloadSLocEntries;
-
/// \brief A map of negated SLocEntryIDs to the modules containing them.
ContinuousRangeMap<unsigned, Module*, 64> GlobalSLocEntryMap;
/// AST file.
const uint32_t *SLocEntryOffsets;
+ /// \brief SLocEntries that we're going to preload.
+ SmallVector<uint64_t, 4> PreloadSLocEntries;
+
/// \brief The number of source location file entries in this AST file.
unsigned LocalNumSLocFileEntries;
case SOURCE_LOCATION_PRELOADS: {
// Need to transform from the local view (1-based IDs) to the global view,
// which is based off F.SLocEntryBaseID.
- PreloadSLocEntries.reserve(PreloadSLocEntries.size() + Record.size());
- for (unsigned I = 0, N = Record.size(); I != N; ++I)
- PreloadSLocEntries.push_back(int(Record[I] - 1) + F.SLocEntryBaseID);
+ if (!F.PreloadSLocEntries.empty()) {
+ Error("Multiple SOURCE_LOCATION_PRELOADS records in AST file");
+ return Failure;
+ }
+
+ F.PreloadSLocEntries.swap(Record);
break;
}
}
// Here comes stuff that we only do once the entire chain is loaded.
-
- // Preload SLocEntries.
- for (unsigned I = 0, N = PreloadSLocEntries.size(); I != N; ++I) {
- ASTReadResult Result = ReadSLocEntryRecord(PreloadSLocEntries[I]);
- if (Result != Success)
- return Failure;
- }
- PreloadSLocEntries.clear();
// Check the predefines buffers.
if (!DisableValidation && Type != MK_Module && CheckPredefinesBuffers())
case Success: break;
}
}
+
+ // Preload SLocEntries.
+ for (unsigned I = 0, N = M->PreloadSLocEntries.size(); I != N; ++I) {
+ int Index = int(M->PreloadSLocEntries[I] - 1) + F.SLocEntryBaseID;
+ ASTReadResult Result = ReadSLocEntryRecord(Index);
+ if (Result != Success)
+ return Failure;
+ }
+
return Success;
}