Running lit tests on Windows can fail because its use of os.path.realpath expands substitute drives, which are used to keep paths short and avoid hitting MAX_PATH limitations.
Changes lit logic to:
- Use os.path.abspath on Windows, where MAX_PATH is a concern that we can work around using substitute drives, which os.path.realpath would resolve.
- Use os.path.realpath on Unix, where the current directory always has symlinks resolved, so it is impossible to preserve symlinks in the presence of relative paths, and so we must make sure that all code paths use real paths.
Also updates clang's FileManager::getCanonicalName and ExtractAPI code to avoid resolving substitute drives (ie resolving to a path under a different root).
How tested: built with -DLLVM_ENABLE_PROJECTS=clang and built check-all on both Windows
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.