]> granicus.if.org Git - clang/commit
Teach SourceManager::getLocation() how to cope with a source file
authorDouglas Gregor <dgregor@apple.com>
Thu, 3 Feb 2011 17:17:35 +0000 (17:17 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 3 Feb 2011 17:17:35 +0000 (17:17 +0000)
commit86a4d0dd6a630639aab7715323ed068940e650af
treef1669398f5a3889b5aece6d98e84c7feb39ce003
parent3b5b02345b88ff5214e756f57201fe7679af0c34
Teach SourceManager::getLocation() how to cope with a source file
whose inode has changed since the file was first created and that is
being seen through a different path name (e.g., due to symlinks or
relative path elements), such that its FileEntry pointer doesn't match
a known FileEntry pointer. Since this requires a system call (to
stat()), we only perform this deeper checking if we can't find the
file by comparing FileEntry pointers.

Also, add a micro-optimization where we don't bother to compute line
numbers when given the location (1, 1). This improves the
efficiency of clang_getLocationForOffset().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124800 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/SourceManager.h
lib/Basic/SourceManager.cpp
tools/libclang/CIndex.cpp