Skip to content

Commit 3d9d9e7

Browse files
committed
[clang] Fix buggy FileManager setter
1 parent c2250e3 commit 3d9d9e7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,13 @@ bool CompilerInstance::createTarget() {
173173
}
174174

175175
void CompilerInstance::setFileManager(FileManager *Value) {
176-
if (!hasVirtualFileSystem())
177-
setVirtualFileSystem(Value->getVirtualFileSystemPtr());
178-
assert(Value == nullptr ||
179-
getVirtualFileSystemPtr() == Value->getVirtualFileSystemPtr());
176+
if (Value == nullptr) {
177+
FileMgr = nullptr;
178+
return;
179+
}
180+
if (VFS == nullptr)
181+
VFS = Value->getVirtualFileSystemPtr();
182+
assert(VFS == Value->getVirtualFileSystemPtr());
180183
FileMgr = Value;
181184
}
182185

0 commit comments

Comments
 (0)