[all-commits] [llvm/llvm-project] 477c70: [clang][modules] Allow including module maps to be...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Wed May 1 09:38:38 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 477c705cb0d7cc857fad8184faac523f8ef72c84
      https://github.com/llvm/llvm-project/commit/477c705cb0d7cc857fad8184faac523f8ef72c84
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2024-05-01 (Wed, 01 May 2024)

  Changed paths:
    M clang/include/clang/Serialization/ASTWriter.h
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/test/ClangScanDeps/modules-extern-unrelated.m

  Log Message:
  -----------
  [clang][modules] Allow including module maps to be non-affecting (#89992)

The dependency scanner only puts top-level affecting module map files on
the command line for explicitly building a module. This is done because
any affecting child module map files should be referenced by the
top-level one, meaning listing them explicitly does not have any meaning
and only makes the command lines longer.

However, a problem arises whenever the definition of an affecting module
lives in a module map that is not top-level. Considering the rules
explained above, such module map file would not make it to the command
line. That's why 83973cf157f7850eb133a4bbfa0f8b7958bad215 started
marking the parents of an affecting module map file as affecting too.
This way, the top-level file does make it into the command line.

This can be problematic, though. On macOS, for example, the Darwin
module lives in "/usr/include/Darwin.modulemap" one of many module map
files included by "/usr/include/module.modulemap". Reporting the parent
on the command line forces explicit builds to parse all the other module
map files included by it, which is not necessary and can get expensive
in terms of file system traffic.

This patch solves that performance issue by stopping marking parent
module map files as affecting, and marking module map files as top-level
whenever they are top-level among the set of affecting files, not among
the set of all known files. This means that the top-level
"/usr/include/module.modulemap" is now not marked as affecting and
"/usr/include/Darwin.modulemap" is.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list