[flang][driver] Add support for Frontend Plugins
authorStuart Ellis <stuart.ellis@arm.com>
Thu, 12 Aug 2021 10:42:08 +0000 (11:42 +0100)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Thu, 12 Aug 2021 10:42:16 +0000 (11:42 +0100)
commitf52fc591fa34a8c85577108358b3b36c42b6d364
tree15b3d78f63b9d1a9137ab96a126613223c230356
parent8f359a80e466f221e3b3d93e65587d74f9ba2fda
[flang][driver] Add support for Frontend Plugins

Introducing a plugin API and a simple HelloWorld Plugin example.
This patch adds the `-load` and `-plugin` flags to frontend driver and
the code around using custom frontend actions from within a plugin
shared library object.

It also adds to the Driver-help test to check the help option with the
updated driver flags.

Additionally, the patch creates a plugin-example test to check the
HelloWorld plugin example runs correctly. As part of this, a new CMake
flag (`FLANG_BUILD_EXAMPLES`) is added to allow the example to be built
and for the test to run.

This Plugin API has only been tested on Linux.

Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D106137
18 files changed:
clang/include/clang/Driver/Options.td
flang/CMakeLists.txt
flang/examples/CMakeLists.txt
flang/examples/HelloWorld/CMakeLists.txt [new file with mode: 0644]
flang/examples/HelloWorld/HelloWorldPlugin.cpp [new file with mode: 0644]
flang/include/flang/Frontend/FrontendActions.h
flang/include/flang/Frontend/FrontendOptions.h
flang/include/flang/Frontend/FrontendPluginRegistry.h [new file with mode: 0644]
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Frontend/FrontendAction.cpp
flang/lib/Frontend/FrontendActions.cpp
flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
flang/test/CMakeLists.txt
flang/test/Driver/driver-help.f90
flang/test/Driver/plugin-example.f90 [new file with mode: 0644]
flang/test/lit.cfg.py
flang/test/lit.site.cfg.py.in
flang/tools/flang-driver/CMakeLists.txt