[all-commits] [llvm/llvm-project] 6a1155: [clang][modules] Avoid storing command-line macro ...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Aug 17 11:11:45 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a115578324f273ae2b8caef0f034f4bc05ad0b4
      https://github.com/llvm/llvm-project/commit/6a115578324f273ae2b8caef0f034f4bc05ad0b4
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2023-08-17 (Thu, 17 Aug 2023)

  Changed paths:
    M clang/include/clang/Serialization/ASTReader.h
    M clang/include/clang/Serialization/ASTWriter.h
    M clang/lib/Frontend/ASTUnit.cpp
    M clang/lib/Frontend/FrontendActions.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/GeneratePCH.cpp
    M clang/test/Modules/module_file_info.m

  Log Message:
  -----------
  [clang][modules] Avoid storing command-line macro definitions into implicitly built PCM files

With implicit modules, it's impossible to load a PCM file that was built using different command-line macro definitions. This is guaranteed by the fact that they contribute to the context hash. This means that we don't need to store those macros into PCM files for validation purposes. This patch avoids serializing them in those circumstances, since there's no other use for command-line macro definitions (besides "-module-file-info").

For a typical Apple project, this speeds up the dependency scan by 5.6% and shrinks the cache with scanning PCMs by 26%.

Reviewed By: benlangmuir

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




More information about the All-commits mailing list