r249831 - [VFS] Wire up driver VFS through tooling.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 9 08:13:56 PDT 2015


On Fri, Oct 9, 2015 at 3:05 PM Benjamin Kramer via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: d0k
> Date: Fri Oct  9 08:03:25 2015
> New Revision: 249831
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249831&view=rev
> Log:
> [VFS] Wire up driver VFS through tooling.
>
> Sadly I don't currently have a way to tests this as the driver is always
> initialized with the default triple and finding system headers is system
> specific.
>

 If necessary, we might be able to put in a target triple via command line
flags (hopefully)


>
> Modified:
>     cfe/trunk/lib/Tooling/Tooling.cpp
>
> Modified: cfe/trunk/lib/Tooling/Tooling.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=249831&r1=249830&r2=249831&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Tooling/Tooling.cpp (original)
> +++ cfe/trunk/lib/Tooling/Tooling.cpp Fri Oct  9 08:03:25 2015
> @@ -46,10 +46,11 @@ FrontendActionFactory::~FrontendActionFa
>  // it to be based on the same framework.
>
>  /// \brief Builds a clang driver initialized for running clang tools.
> -static clang::driver::Driver *newDriver(clang::DiagnosticsEngine
> *Diagnostics,
> -                                        const char *BinaryName) {
> +static clang::driver::Driver *newDriver(
> +    clang::DiagnosticsEngine *Diagnostics, const char *BinaryName,
> +    IntrusiveRefCntPtr<vfs::FileSystem> VFS) {
>    clang::driver::Driver *CompilerDriver = new clang::driver::Driver(
> -      BinaryName, llvm::sys::getDefaultTargetTriple(), *Diagnostics);
> +      BinaryName, llvm::sys::getDefaultTargetTriple(), *Diagnostics, VFS);
>    CompilerDriver->setTitle("clang_based_tool");
>    return CompilerDriver;
>  }
> @@ -238,7 +239,7 @@ bool ToolInvocation::run() {
>        DiagConsumer ? DiagConsumer : &DiagnosticPrinter, false);
>
>    const std::unique_ptr<clang::driver::Driver> Driver(
> -      newDriver(&Diagnostics, BinaryName));
> +      newDriver(&Diagnostics, BinaryName, Files->getVirtualFileSystem()));
>    // Since the input might only be virtual, don't check whether it exists.
>    Driver->setCheckInputsExist(false);
>    const std::unique_ptr<clang::driver::Compilation> Compilation(
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151009/28343f10/attachment.html>


More information about the cfe-commits mailing list