summaryrefslogtreecommitdiff
path: root/compiler/main/DynFlags.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-12-11 13:24:12 -0500
committerBen Gamari <ben@smart-cactus.org>2018-12-11 14:23:22 -0500
commitda05d79d03e5e03e391b381f23c46fc02957abf7 (patch)
tree4506d0f46dc5df4293ae1933d87b1367be0de831 /compiler/main/DynFlags.hs
parent9e763afa9f1f75eacce24291f298f32527591b14 (diff)
downloadhaskell-da05d79d03e5e03e391b381f23c46fc02957abf7.tar.gz
Support registering Plugins through the GHC API
This allows tooling using the GHC API to use plugins internally. Hopefully this will make it possible to decouple the development of useful plugins from (currently) kitchen-sink type tooling projects such as ghc-mod or HIE -- at least to some extent. Test Plan: validate Reviewers: bgamari, mpickering Subscribers: mpickering, alanz, rwbarton, carter GHC Trac Issues: #15826 Differential Revision: https://phabricator.haskell.org/D5278
Diffstat (limited to 'compiler/main/DynFlags.hs')
-rw-r--r--compiler/main/DynFlags.hs19
1 files changed, 13 insertions, 6 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 3fb3874c63..48c7103dd9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -984,12 +984,18 @@ data DynFlags = DynFlags {
frontendPluginOpts :: [String],
-- ^ the @-ffrontend-opt@ flags given on the command line, in *reverse*
-- order that they're specified on the command line.
- plugins :: [LoadedPlugin],
- -- ^ plugins loaded after processing arguments. What will be loaded here
- -- is directed by pluginModNames. Arguments are loaded from
+ cachedPlugins :: [LoadedPlugin],
+ -- ^ plugins dynamically loaded after processing arguments. What will be
+ -- loaded here is directed by pluginModNames. Arguments are loaded from
-- pluginModNameOpts. The purpose of this field is to cache the plugins so
- -- they don't have to be loaded each time they are needed.
- -- See 'DynamicLoading.initializePlugins'.
+ -- they don't have to be loaded each time they are needed. See
+ -- 'DynamicLoading.initializePlugins'.
+ staticPlugins :: [StaticPlugin],
+ -- ^ staic plugins which do not need dynamic loading. These plugins are
+ -- intended to be added by GHC API users directly to this list.
+ --
+ -- To add dynamically loaded plugins through the GHC API see
+ -- 'addPluginModuleName' instead.
-- GHC API hooks
hooks :: Hooks,
@@ -1917,7 +1923,8 @@ defaultDynFlags mySettings (myLlvmTargets, myLlvmPasses) =
pluginModNames = [],
pluginModNameOpts = [],
frontendPluginOpts = [],
- plugins = [],
+ cachedPlugins = [],
+ staticPlugins = [],
hooks = emptyHooks,
outputFile = Nothing,