[all-commits] [llvm/llvm-project] 0ea3d8: [Modules] Add a flag to control builtin headers be...

Ian Anderson via All-commits all-commits at lists.llvm.org
Thu Sep 28 11:30:26 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0ea3d88bdb16aa6e9a0043cc3ed93dcb88a89dea
      https://github.com/llvm/llvm-project/commit/0ea3d88bdb16aa6e9a0043cc3ed93dcb88a89dea
  Author: Ian Anderson <iana at apple.com>
  Date:   2023-09-28 (Thu, 28 Sep 2023)

  Changed paths:
    M clang/include/clang/Basic/Features.def
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Lex/ModuleMap.h
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/lib/Lex/ModuleMap.cpp
    A clang/test/Driver/Inputs/MacOSX99.0.sdk/SDKSettings.json
    A clang/test/Driver/darwin-builtin-modules.c
    M clang/test/Modules/Werror-Wsystem-headers.m
    M clang/test/Modules/context-hash.c
    M clang/test/Modules/crash-vfs-include-pch.m
    M clang/test/Modules/cstd.m
    M clang/test/Modules/pch-used.m
    M clang/test/Modules/shadowed-submodule.m
    M clang/test/Modules/stddef.c
    M clang/test/Modules/stddef.m

  Log Message:
  -----------
  [Modules] Add a flag to control builtin headers being in system modules

Including select builtin headers in system modules is a workaround for module cycles, primarily in Apple's Darwin module that includes all of its C standard library headers. The workaround is problematic because it doesn't include all of the builtin headers (inttypes.h is notably absent), and it also doesn't include C++ headers. The straightforward for for this is to make top level modules for all of the C standard library headers and unwind.h in C++, clang, and the OS.

However, doing so in clang before the OS modules are ready re-introduces the module cycles. Add a -fbuiltin-headers-in-system-modules option to control if the special builtin headers belong to system modules or builtin modules. Pass the option by default for Apple.

Reviewed By: ChuanqiXu, Bigcheese, benlangmuir

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




More information about the All-commits mailing list