This is an archive of the discontinued LLVM Phabricator instance.

[clang][FileManager] Support empty file name in getVirtualFileRef for serialized diagnostics
ClosedPublic

Authored by arphaman on Apr 13 2021, 5:04 PM.

Details

Summary

After https://reviews.llvm.org/D90484 libclang is unable to read a serialized diagnostic file which contains a diagnostic which came from a file with an empty filename. The reason being is that the serialized diagnostic reader is creating a virtual file for the "" filename, which now fails after the changes in https://reviews.llvm.org/D90484. This patch restores the previous behavior in getVirtualFileRef by allowing it to construct a file entry ref with an empty name by pretending its name is "." so that the directory entry can be created.

Diff Detail

Event Timeline

arphaman created this revision.Apr 13 2021, 5:04 PM
arphaman requested review of this revision.Apr 13 2021, 5:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2021, 5:04 PM
dexonsmith accepted this revision.Apr 13 2021, 5:11 PM

Can you add a comment to the code explaining why the filename could be empty? With that, LGTM.

This revision is now accepted and ready to land.Apr 13 2021, 5:11 PM

Thanks, will do.