if (auto *AdditionalModMaps =
Map.getAdditionalModuleMapFiles(WritingModule)) {
Record.push_back(AdditionalModMaps->size());
- for (const FileEntry *F : *AdditionalModMaps)
+ SmallVector<const FileEntry *, 1> ModMaps(AdditionalModMaps->begin(),
+ AdditionalModMaps->end());
+ llvm::sort(ModMaps, [](const FileEntry *A, const FileEntry *B) {
+ return A->getName() < B->getName();
+ });
+ for (const FileEntry *F : ModMaps)
AddPath(F->getName(), Record);
} else {
Record.push_back(0);