[PATCH] D154130: [lit][clang] Avoid realpath on Windows due to MAX_PATH limitations
Ben Langmuir via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 26 15:52:29 PDT 2023
benlangmuir added inline comments.
================
Comment at: clang/lib/Basic/FileManager.cpp:655
+ SmallString<4096> AbsPathBuf = Name;
+ SmallString<4096> RealPathBuf;
+ if (!FS->makeAbsolute(AbsPathBuf)) {
----------------
8k is a lot of stack space. The only reason this was 4k in the first place is it was originally using `char[PATH_MAX]` and unix `realpath` directly. I'd suggest just dropping to 128 per path.
================
Comment at: clang/lib/Basic/FileManager.cpp:663
+ } else {
+ llvm::sys::path::remove_dots(AbsPathBuf, /*remove_dot_dot=*/true);
+ CanonicalName = AbsPathBuf.str().copy(CanonicalNameStorage);
----------------
Removing .. can change where the path points in the presence of symlinks; is this needed?
================
Comment at: clang/lib/ExtractAPI/ExtractAPIConsumer.cpp:190
- StringRef FileName = File->tryGetRealPathName().empty()
- ? File->getName()
- : File->tryGetRealPathName();
+ StringRef FileName = SM.getFileManager().getCanonicalName(File);
----------------
Why is this change needed?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154130/new/
https://reviews.llvm.org/D154130
More information about the cfe-commits
mailing list