[PATCH] D134923: [clang][deps] Canonicalize module map path

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 29 16:35:30 PDT 2022


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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134923

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134923.464090.patch
Type: text/x-patch
Size: 9300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220929/c528e653/attachment-0001.bin>


More information about the cfe-commits mailing list