[all-commits] [llvm/llvm-project] dcd3a0: [clang][modules][deps] Create more efficient API f...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Wed Aug 9 10:19:52 PDT 2023


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

  Changed paths:
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/include/clang/Serialization/ASTReader.h
    M clang/include/clang/Serialization/ModuleFile.h
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

  Log Message:
  -----------
  [clang][modules][deps] Create more efficient API for visitation of `ModuleFile` inputs

The current `ASTReader::visitInputFiles()` function calls into `FileManager` to create `FileEntryRef` objects. This ends up being fairly costly in `clang-scan-deps`, where we mostly only care about file paths.

This patch introduces new `ASTReader` API that gives clients access to just the serialized paths. Since the scanner needs both the as-requested path and the on-disk one (and doesn't want to transform the former into the latter via `FileManager`), this patch starts serializing both of them into the PCM file if they differ.

This increases the size of scanning PCMs by 0.1% and speeds up scanning by 5%.

Reviewed By: benlangmuir, vsapsai

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




More information about the All-commits mailing list