diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-09-03 23:42:17 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-09-03 23:42:17 +0100 |
commit | 7b11baa68c36fdf5e441c76061fec3a38bc5dbbb (patch) | |
tree | 18411e954ca515f2830a60d7db166f121a4592e6 /compiler/parser | |
parent | af4f98719e48cbb891bfb6e1c04c577649f32760 (diff) | |
download | haskell-7b11baa68c36fdf5e441c76061fec3a38bc5dbbb.tar.gz |
Make -fhpc a dynamic flag
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Lexer.x | 7 | ||||
-rw-r--r-- | compiler/parser/Parser.y.pp | 8 |
2 files changed, 10 insertions, 5 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index b872a7d953..91f00ecf2f 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -57,7 +57,7 @@ module Lexer ( extension, bangPatEnabled, datatypeContextsEnabled, traditionalRecordSyntaxEnabled, typeLiteralsEnabled, - explicitNamespacesEnabled, sccProfilingOn, + explicitNamespacesEnabled, sccProfilingOn, hpcEnabled, addWarning, lexTokenStream ) where @@ -1851,6 +1851,8 @@ rawTokenStreamBit :: Int rawTokenStreamBit = 20 -- producing a token stream with all comments included sccProfilingOnBit :: Int sccProfilingOnBit = 21 +hpcBit :: Int +hpcBit = 22 alternativeLayoutRuleBit :: Int alternativeLayoutRuleBit = 23 relaxedLayoutBit :: Int @@ -1907,6 +1909,8 @@ rawTokenStreamEnabled :: Int -> Bool rawTokenStreamEnabled flags = testBit flags rawTokenStreamBit alternativeLayoutRule :: Int -> Bool alternativeLayoutRule flags = testBit flags alternativeLayoutRuleBit +hpcEnabled :: Int -> Bool +hpcEnabled flags = testBit flags hpcBit relaxedLayout :: Int -> Bool relaxedLayout flags = testBit flags relaxedLayoutBit nondecreasingIndentation :: Int -> Bool @@ -1977,6 +1981,7 @@ mkPState flags buf loc = .|. transformComprehensionsBit `setBitIf` xopt Opt_TransformListComp flags .|. transformComprehensionsBit `setBitIf` xopt Opt_MonadComprehensions flags .|. rawTokenStreamBit `setBitIf` dopt Opt_KeepRawTokenStream flags + .|. hpcBit `setBitIf` dopt Opt_Hpc flags .|. alternativeLayoutRuleBit `setBitIf` xopt Opt_AlternativeLayoutRule flags .|. relaxedLayoutBit `setBitIf` xopt Opt_RelaxedLayout flags .|. sccProfilingOnBit `setBitIf` dopt Opt_SccProfilingOn flags diff --git a/compiler/parser/Parser.y.pp b/compiler/parser/Parser.y.pp index ac6a73784b..718adcabfd 100644 --- a/compiler/parser/Parser.y.pp +++ b/compiler/parser/Parser.y.pp @@ -53,7 +53,6 @@ import OccName ( varName, dataName, tcClsName, tvName ) import DataCon ( DataCon, dataConName ) import SrcLoc import Module -import StaticFlags ( opt_Hpc ) import Kind ( Kind, liftedTypeKind, unliftedTypeKind, mkArrowKind ) import Class ( FunDep ) import BasicTypes @@ -1416,9 +1415,10 @@ exp10 :: { LHsExpr RdrName } ; return $ LL $ if on then HsSCC (unLoc $1) $2 else HsPar $2 } } - | hpc_annot exp { LL $ if opt_Hpc - then HsTickPragma (unLoc $1) $2 - else HsPar $2 } + | hpc_annot exp {% do { on <- extension hpcEnabled + ; return $ LL $ if on + then HsTickPragma (unLoc $1) $2 + else HsPar $2 } } | 'proc' aexp '->' exp {% checkPattern $2 >>= \ p -> |