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

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 17:37:29 PDT 2023


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

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%.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158136

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158136.550942.patch
Type: text/x-patch
Size: 21257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230817/f042b61a/attachment-0001.bin>


More information about the cfe-commits mailing list