Removing trailing directory separator, to make stat work

llvm-svn: 91684
This commit is contained in:
John Thompson 2009-12-18 14:18:21 +00:00
parent d4d4d6931c
commit 551446b31b
1 changed files with 5 additions and 0 deletions

View File

@ -219,6 +219,11 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
///
const DirectoryEntry *FileManager::getDirectory(const char *NameStart,
const char *NameEnd) {
// stat doesn't like trailing separators (at least on Windows).
if (((NameEnd - NameStart) > 1) &&
((*(NameEnd - 1) == '/') || (*(NameEnd - 1) == '\\')))
NameEnd--;
++NumDirLookups;
llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
DirEntries.GetOrCreateValue(NameStart, NameEnd);