Commit db10b799 authored by Douglas Wilson's avatar Douglas Wilson Committed by Ben Gamari
Browse files

Pass -ffrontend-opt arguments to frontend plugin in the correct order

Previously they were passed in the reverse order that they're specified
on the command line.

Add a haddock to frontendPluginOpts in DynFlags.hs.

Modify test frontend01 to cover the case of multiple -ffrontend-opt.

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13632

Differential Revision:
parent a660844c
......@@ -796,6 +796,8 @@ data DynFlags = DynFlags {
pluginModNames :: [ModuleName],
pluginModNameOpts :: [(ModuleName,String)],
frontendPluginOpts :: [String],
-- ^ the @-ffrontend-opt@ flags given on the command line, in *reverse*
-- order that they're specified on the command line.
-- GHC API hooks
hooks :: Hooks,
......@@ -837,7 +837,8 @@ doFrontend modname _ = pluginError [modname]
doFrontend modname srcs = do
hsc_env <- getSession
frontend_plugin <- liftIO $ loadFrontendPlugin hsc_env modname
frontend frontend_plugin (frontendPluginOpts (hsc_dflags hsc_env)) srcs
frontend frontend_plugin
(reverse $ frontendPluginOpts (hsc_dflags hsc_env)) srcs
-- -----------------------------------------------------------------------------
......@@ -34,7 +34,7 @@ T10294a:
$(RM) FrontendPlugin.hi FrontendPlugin.o frontend01 frontend01.hi frontend.o
"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) -Wall -package ghc -c FrontendPlugin.hs
"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --frontend FrontendPlugin -ffrontend-opt foobar frontend01
"$(TEST_HC)" $(TEST_HC_OPTS) $(ghcPluginWayFlags) --frontend FrontendPlugin -ffrontend-opt foo -ffrontend-opt bar frontend01
# -hide-all-plugin-packages + -package (this should not work!)
[1 of 1] Compiling Main ( frontend01.hs, frontend01.o )
Linking frontend01 ...
hello world
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment