[all-commits] [llvm/llvm-project] 20fa87: [clang][modules][deps] Preserve module map load order

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Sep 22 12:55:08 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 20fa87c7e87fcb2fca403c7a73f8acc7e4dd5fa1
      https://github.com/llvm/llvm-project/commit/20fa87c7e87fcb2fca403c7a73f8acc7e4dd5fa1
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

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

  Log Message:
  -----------
  [clang][modules][deps] Preserve module map load order

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.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D134248




More information about the All-commits mailing list