forked from OSchip/llvm-project
Removing trailing directory separator, to make stat work
llvm-svn: 91684
This commit is contained in:
parent
d4d4d6931c
commit
551446b31b
|
@ -219,6 +219,11 @@ static const DirectoryEntry *getDirectoryFromFile(FileManager &FileMgr,
|
||||||
///
|
///
|
||||||
const DirectoryEntry *FileManager::getDirectory(const char *NameStart,
|
const DirectoryEntry *FileManager::getDirectory(const char *NameStart,
|
||||||
const char *NameEnd) {
|
const char *NameEnd) {
|
||||||
|
// stat doesn't like trailing separators (at least on Windows).
|
||||||
|
if (((NameEnd - NameStart) > 1) &&
|
||||||
|
((*(NameEnd - 1) == '/') || (*(NameEnd - 1) == '\\')))
|
||||||
|
NameEnd--;
|
||||||
|
|
||||||
++NumDirLookups;
|
++NumDirLookups;
|
||||||
llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
|
llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt =
|
||||||
DirEntries.GetOrCreateValue(NameStart, NameEnd);
|
DirEntries.GetOrCreateValue(NameStart, NameEnd);
|
||||||
|
|
Loading…
Reference in New Issue