[PATCH] D134248: [clang][modules][deps] Preserve module map load order

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 18:09:37 PDT 2022


jansvoboda11 created this revision.
jansvoboda11 added reviewers: benlangmuir, Bigcheese.
Herald added subscribers: ributzka, arphaman.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

In `ASTWriter`, input files are sorted based on whether they are system or user. The current implementation used single `std::queue` with `push_back` and `push_front`. This resulted in the user files being reversed.

This patch fixes that by keeping the system/user distinction, but otherwise serializing files in the order they were loaded by the `SourceManager`. This is then used in the dependency scanner to report module map dependencies in the correct order.

Depends on D134224 <https://reviews.llvm.org/D134224>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134248

Files:
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/lib/Serialization/ASTWriter.cpp
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/modules-module-map-order.m
  clang/test/Index/Core/index-with-module.m
  clang/test/Modules/module-file-home-is-cwd.m
  clang/test/Modules/module_file_info.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134248.461433.patch
Type: text/x-patch
Size: 11023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220920/a8464a9a/attachment.bin>


More information about the cfe-commits mailing list