[all-commits] [llvm/llvm-project] 074fce: [clang][deps] Canonicalize module map path

Ben Langmuir via All-commits all-commits at lists.llvm.org
Wed Oct 5 15:47:06 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 074fcec1eabfc992c46c95df215b1caf5cf58970
      https://github.com/llvm/llvm-project/commit/074fcec1eabfc992c46c95df215b1caf5cf58970
  Author: Ben Langmuir <blangmuir at apple.com>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M clang/include/clang/Lex/ModuleMap.h
    M clang/lib/Lex/HeaderSearch.cpp
    M clang/lib/Lex/ModuleMap.cpp
    M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
    A clang/test/ClangScanDeps/modules-symlink-dir.c

  Log Message:
  -----------
  [clang][deps] Canonicalize module map path

When dep-scanning, canonicalize the module map path as much as we can.
This avoids unnecessarily needing to build multiple versions of a module
due to symlinks or case-insensitive file paths.

Despite the name `tryGetRealPathName`, the previous implementation did
not actually return the realpath most of the time, and indeed it would
be incorrect to do so since the realpath could be outside the module
directory, which would have broken finding headers relative to the
module.

Instead, use a canonicalization that is specific to the needs of
modulemap files (canonicalize the directory separately from the
filename).

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




More information about the All-commits mailing list