This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Add -ivfsoverlay-lib option to load VFS from shared library
AbandonedPublic

Authored by asavonic on May 22 2018, 2:44 AM.

Details

Summary

This patch allows clang to use a VirtualFileSystem represented by a
shared library. This VFS will be used on top of the real file system.

Library specified -ivfsoverlay-lib by must export
`clang::vfs::FileSystem *__clang_create_vfs()' function.

Unlike -ivfsoverlay option, which allows to map one real file to
another, -ivfsoverlay-lib allows to use files from memory, or do any
kind of files preprocessing.

Diff Detail

Event Timeline

asavonic created this revision.May 22 2018, 2:44 AM
asavonic updated this revision to Diff 147974.May 22 2018, 2:55 AM

Add license header.

asavonic retitled this revision from [Driver] Add -ivfsoverlay-lib option to load VFS from shared to [Driver] Add -ivfsoverlay-lib option to load VFS from shared library.May 22 2018, 7:53 AM
asavonic updated this revision to Diff 148225.May 23 2018, 8:31 AM

Fixed warning about void* to function pointer cast.

I don't know much about the VFS so I only did a superficial review.

include/clang/Lex/HeaderSearchOptions.h
176

We now have autobrief enabled so you can omit the \brief.

lib/Frontend/CompilerInvocation.cpp
3218

Would it be useful to print the contents of the error?

unittests/Frontend/VfsTestLib.cpp
25

The llvm coding standard says no braces for single line statements.

asavonic updated this revision to Diff 149763.Jun 4 2018, 7:48 AM

Addressed CR comments, added a diagnostic if shared library was not loaded.

asavonic marked 3 inline comments as done.Jun 4 2018, 7:50 AM
asavonic abandoned this revision.Nov 9 2021, 2:20 AM