[PATCH] D154130: [lit] Avoid os.path.realpath on Windows due to MAX_PATH limitations

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 14:47:41 PDT 2023


tahonermann added a comment.

>> In D154130#4486898 <https://reviews.llvm.org/D154130#4486898>, @tahonermann wrote:
>>
>>> 95% of the %>t are around clang modulemap files, because that code resolves real paths in C++ by design, so I can't avoid it.
>>
>> Can you link to evidence that this behavior is by design? It isn't obvious to me why modulemap files would demand different behavior; especially since that would exacerbate MAX_PATH problems.
>
> I agree with you. The original rationale seems to be here:
> https://github.com/llvm/llvm-project/blob/926f3759ec62a8f170e76a60316cc0bdd9dd2ec9/clang/lib/Lex/HeaderSearch.cpp#L257

Thank you for finding that. I took a look at the code and it looks to me like it would be safe to change ModuleMap::canonicalizeModuleMapPath() <https://github.com/llvm/llvm-project/blob/main/clang/lib/Lex/ModuleMap.cpp#L1310> to  use a drive preserving canonicalization. I think the worst case impact would be that a module cache lookup would fail thereby leading to a cache miss and rebuild of the target module. That could impose a significant performance and drive space penalty in the event that substitute drive paths are changed, but I would expect such changes to be rare.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154130/new/

https://reviews.llvm.org/D154130



More information about the cfe-commits mailing list