]> granicus.if.org Git - clang/commit
Check if a path is already absolute before trying to make it so.
authorBob Wilson <bob.wilson@apple.com>
Sat, 26 Mar 2016 18:55:13 +0000 (18:55 +0000)
committerBob Wilson <bob.wilson@apple.com>
Sat, 26 Mar 2016 18:55:13 +0000 (18:55 +0000)
commiteb74e784bea83d80b2f8bf041a9563294bf9bcb5
tree0a3f457bb81e1fdc4a1a4dd9dc47e5e32a1fb354
parenta46d5cd16e126e77646365b8a5c6f3d0db28b5d0
Check if a path is already absolute before trying to make it so.

The FileSystem::makeAbsolute function has been calculating the current
working directory unconditionally, even when it is not needed. This calls
down to llvm::sys::fs::current_path, which is relatively expensive
because it stats two directories, regardless of whether those paths are
already in the stat cache. The net effect is that when using the
VFS, every stat during header search turns into three stats. With this
change, we get back to a single stat for absolute directory paths.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264519 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Basic/VirtualFileSystem.cpp