Skip to content

Commit 46b1645

Browse files
committed
SourceManager: Unify FileEntry/FileEntryRef versions of createFileID
Change `SourceManager::createFileID(const FileEntry*)` to defer to `SourceManager::createFileID(FileEntryRef)`. This fixes an unexercised bug where the latter gained support for named pipes and the former didn't, but since we're trying to remove all calls to the former it doesn't really make sense to test this explicitly now that the implementation is hollowed out. This is a belated follow-up to 245218b, which sunk named pipe support into FileManager and SourceManager. The original version of that patch was based on top of https://reviews.llvm.org/D92984, which removed the `FileEntry` overload of `createFileID()`, and I missed the subtle difference when it was rebased.
1 parent cda4d3d commit 46b1645

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

clang/lib/Basic/SourceManager.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,8 @@ FileID SourceManager::createFileID(const FileEntry *SourceFile,
534534
SourceLocation IncludePos,
535535
SrcMgr::CharacteristicKind FileCharacter,
536536
int LoadedID, unsigned LoadedOffset) {
537-
assert(SourceFile && "Null source file!");
538-
SrcMgr::ContentCache &IR =
539-
getOrCreateContentCache(SourceFile, isSystem(FileCharacter));
540-
return createFileIDImpl(IR, SourceFile->getName(), IncludePos, FileCharacter,
541-
LoadedID, LoadedOffset);
537+
return createFileID(SourceFile->getLastRef(), IncludePos, FileCharacter,
538+
LoadedID, LoadedOffset);
542539
}
543540

544541
FileID SourceManager::createFileID(FileEntryRef SourceFile,

0 commit comments

Comments
 (0)