summaryrefslogtreecommitdiff
path: root/ghc/compiler/main
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2005-06-15 12:03:19 by simonmar]simonmar2005-06-153-74/+274
| | | | | | | | | | | | | | | | | | | | | | | | Re-implement GHCi's :info and :browse commands in terms of TyThings rather than IfaceSyn. The GHC API now exposes its internal types for Haskell entities: TyCons, Classes, DataCons, Ids and Instances (collectively known as TyThings), so we can inspect these directly to pretty-print information about an entity. Previously the internal representations were converted to IfaceSyn for passing to InteractiveUI, but we can now remove that code. Some of the new code comes via Visual Haskell, but I've changed it around a lot to fix various dark corners and properly print things like GADTs. The pretty-printing interfaces for TyThings are exposed by a new module PprTyThing, which is implemented purely in terms of the GHC API (and is probably a good source of sample code). Visual Haskell should be able to use the functions exported by this module directly. Lots of new goodies are exported by the GHC module, mainly for inspecting TyThings.
* [project @ 2005-06-13 13:46:39 by simonmar]simonmar2005-06-131-1/+0
| | | | unused imports
* [project @ 2005-06-13 13:44:48 by simonmar]simonmar2005-06-131-27/+9
| | | | | - Eliminate some warnings, remove dead code - export PrintUnqualified, alwaysQualify
* [project @ 2005-06-07 09:55:03 by simonmar]simonmar2005-06-071-1/+1
| | | | -ddump-hi-diffs shouldn't turn off recompilation checking
* [project @ 2005-06-06 13:19:41 by simonmar]simonmar2005-06-061-1/+1
| | | | Hopefully fix more compilation problems with various versions of GHC
* [project @ 2005-06-06 09:10:41 by simonmar]simonmar2005-06-061-0/+5
| | | | Make this build with GHC < 6.03 again
* [project @ 2005-06-03 09:56:38 by simonmar]simonmar2005-06-031-14/+7
| | | | | Profiling doesn't require -fvia-C any more. Also, I optimistically removed -fvia-C from all the other ways except unreg.
* [project @ 2005-06-02 08:51:17 by simonmar]simonmar2005-06-021-6/+7
| | | | | Make GHC.depanal store the module graph in the session again. Fixes ghc -M.
* [project @ 2005-05-31 14:14:26 by simonmar]simonmar2005-05-311-9/+7
| | | | Make more error messages from the downsweep into ErrMsg exceptions.
* [project @ 2005-05-31 13:10:39 by simonmar]simonmar2005-05-311-4/+5
| | | | oops, fix updating the module graph
* [project @ 2005-05-31 12:45:03 by simonmar]simonmar2005-05-313-50/+79
| | | | | | | | | | | | | | Fix some reporting of errors in the GHC API: errors during the downsweep were thrown as exceptions; now they're reported via the (Messages->IO ()) callback in the same way as other errors. getModuleInfo no longer prints anything on stdout. It does ignore error messages and return Nothing, however - we should fix this and return the error messages at some point. The ErrMsg type can now be thrown as an exception. This can be a convenient alternative if collecting multiple error messages isn't required. We do this in the downsweep now.
* [project @ 2005-05-24 14:52:08 by simonmar]simonmar2005-05-241-1/+6
| | | | isObjectLinkable: don't return True for an empty linkable
* [project @ 2005-05-24 14:19:09 by simonmar]simonmar2005-05-241-0/+3
| | | | If hsc_lang is HscNothing, produce an empty linkable.
* [project @ 2005-05-23 09:56:03 by simonpj]simonpj2005-05-231-6/+5
| | | | Track new semantics of splitLongestPrefix; fixes -main-is bug
* [project @ 2005-05-19 11:17:20 by simonmar]simonmar2005-05-191-1/+3
| | | | SMP: omit the -pthread flag on Windows
* [project @ 2005-05-19 11:15:40 by simonpj]simonpj2005-05-193-20/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Tune up the reporting of unused imports Merge to STABLE (I think the earlier change made it across) (PS: the commit also does some trimming of redundant imports. If they don't merge, just discard them.) My earlier fixes to the reporting of unused imports still missed some obscure cases, some of which are now fixed by this commit. I had to make the import-provenance data type yet richer, but in fact it has more sharing now, so it may be cheaper on space. There's still one infelicity. Consider import M( x ) imoprt N( x ) where the same underlying 'x' is involved in both cases. Currently we don't report a redundant import, because dropping either import would change the qualified names in scope (M.x, N.x). But if the qualified names aren't used, the import is indeed redundant. Sadly we don't know that, because we only know what Names are used. Left for the future! There's a comment in RnNames.warnDuplicateImports This commit also trims quite a few redundant imports disovered by the new setup.
* [project @ 2005-05-17 12:00:04 by simonmar]simonmar2005-05-175-53/+49
| | | | | | | | | | Improve source locations on error messages from the downsweep. We now keep track of SrcSpans from import declarations, so we can report a proper source location for unknown imports (this improves on the previous hacky solution of keeping track of the filename that contained the original import declaration). ModSummary now contains (Located Module) for each import instead of Module.
* [project @ 2005-05-17 11:01:59 by simonmar]simonmar2005-05-172-11/+11
| | | | Further tweaks to the filename handling.
* [project @ 2005-05-17 10:51:04 by simonmar]simonmar2005-05-173-22/+14
| | | | | | Rationalise the filename handling in a few places, taking some bits from the defunct System.FilePath library. Also fixes a bug I recently introduced in replaceFilenameDirectory.
* [project @ 2005-05-17 09:40:51 by simonmar]simonmar2005-05-171-13/+32
| | | | Add modInfoInstances
* [project @ 2005-05-17 09:21:53 by simonmar]simonmar2005-05-171-0/+7
| | | | More commentary
* [project @ 2005-05-17 08:48:28 by simonmar]simonmar2005-05-171-3/+10
| | | | expand comment
* [project @ 2005-05-17 07:49:47 by simonmar]simonmar2005-05-171-1/+2
| | | | | | Bugfix to previous commit: filenames without an extension are assumed to be a haskell source filenames with the extension removed (eg. ghc --make hello should compile hello.hs).
* [project @ 2005-05-17 07:48:20 by simonmar]simonmar2005-05-171-2/+2
| | | | small cleanup: use joinFileExt
* [project @ 2005-05-16 13:47:57 by simonmar]simonmar2005-05-167-98/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | Implement -x <suffix> flag to override the suffix of a filename for the purposes of determinig how it should be compiled. The usage is similar to gcc, except that we just use a suffix rather than a name for the language. eg. ghc -c -x hs hello.blah will pretend hello.blah is a .hs file. Another possible use is -x hspp, which skips preprocessing. This works for one-shot compilation, --make, GHCi, and ghc -e. The original idea was to make it possible to use runghc on a file that doesn't end in .hs, so changes to runghc will follow. Also, I made it possible to specify .c files and other kinds of files on the --make command line; these will be compiled to objects as normal and linked into the final executable. GHC API change: I had to extend the Target type to include an optional start phase, and also GHC.guessTarget now takes a (Maybe Phase) argument. I thought this would be half an hour, in fact it took half a day, and I still haven't documented it. Sigh.
* [project @ 2005-05-16 13:21:11 by krasimir]krasimir2005-05-161-1/+14
| | | | added modInfoIsExportedName & modInfoLookupName functions
* [project @ 2005-05-13 15:06:13 by krasimir]krasimir2005-05-131-1/+1
| | | | replace emptyNodeMap with old_summary_map.
* [project @ 2005-05-13 10:18:35 by simonmar]simonmar2005-05-131-2/+2
| | | | Export nameModule
* [project @ 2005-05-13 09:39:00 by simonmar]simonmar2005-05-131-14/+48
| | | | | summariseFile: use a cached summary if one is available. Previously we always preprocessed modules named by filename on each reload.
* [project @ 2005-05-05 09:40:37 by simonmar]simonmar2005-05-051-12/+39
| | | | | | Make GHC.modInfoPrintUnqualified work for package modules too. Also refactor a bit: move mkExportEnv from TcRnDriver up to GHC which is the only use of it.
* [project @ 2005-05-05 07:43:28 by simonpj]simonpj2005-05-051-0/+5
| | | | | | | | | | | | | | | | Make it so that you can deprecate a data constructor. Previously {-# DEPRECATED T "no" #-} referred only to the type or class T. Now it refers to the data constructor T as well, just like in fixity declarations. There's no way to deprecate the data constructor T without also deprecating the type T, alas. Same problem in fixity decls. Main problem is coming up with a suitable concrete syntax to do so. We could consider merging this to the STABLE branch. NB: Sven, the manual fixes are not XML-valideated! I'm at home.
* [project @ 2005-05-04 16:20:27 by simonmar]simonmar2005-05-041-8/+31
| | | | getModuleInfo now does something reasonable for package modules.
* [project @ 2005-05-04 15:44:59 by simonmar]simonmar2005-05-041-34/+35
| | | | Add lookupGlobalName
* [project @ 2005-04-29 23:39:12 by simonpj]simonpj2005-04-291-6/+1
| | | | Wibbles to new hs-boot instance story
* [project @ 2005-04-29 08:19:49 by simonpj]simonpj2005-04-291-4/+11
| | | | Strip wired-in names from interface files
* [project @ 2005-04-28 23:00:52 by simonpj]simonpj2005-04-282-161/+162
| | | | Further wibbles to the new tidying plumbing
* [project @ 2005-04-28 16:05:54 by simonpj]simonpj2005-04-284-93/+149
| | | | | | | | | Re-plumb the connections between TidyPgm and the various code generators. There's a new type, CgGuts, to mediate this, which has the happy effect that ModGuts can die earlier. The non-O route still isn't quite right, because default methods are being lost. I'm working on it.
* [project @ 2005-04-28 10:09:41 by simonpj]simonpj2005-04-285-305/+363
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This big commit does several things at once (aeroplane hacking) which change the format of interface files. So you'll need to recompile your libraries! 1. The "stupid theta" of a newtype declaration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Retain the "stupid theta" in a newtype declaration. For some reason this was being discarded, and putting it back in meant changing TyCon and IfaceSyn slightly. 2. Overlap flags travel with the instance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Arrange that the ability to support overlap and incoherence is a property of the *instance declaration* rather than the module that imports the instance decl. This allows a library writer to define overlapping instance decls without the library client having to know. The implementation is that in an Instance we store the overlap flag, and preseve that across interface files 3. Nuke the "instnce pool" and "rule pool" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A major tidy-up and simplification of the way that instances and rules are sucked in from interface files. Up till now an instance decl has been held in a "pool" until its "gates" (a set of Names) are in play, when the instance is typechecked and added to the InstEnv in the ExternalPackageState. This is complicated and error-prone; it's easy to suck in too few (and miss an instance) or too many (and thereby be forced to suck in its type constructors, etc). Now, as we load an instance from an interface files, we put it straight in the InstEnv... but the Instance we put in the InstEnv has some Names (the "rough-match" names) that can be used on lookup to say "this Instance can't match". The detailed dfun is only read lazily, and the rough-match thing meansn it is'nt poked on until it has a chance of being needed. This simply continues the successful idea for Ids, whereby they are loaded straightaway into the TypeEnv, but their TyThing is a lazy thunk, not poked on until the thing is looked up. Just the same idea applies to Rules. On the way, I made CoreRule and Instance into full-blown records with lots of info, with the same kind of key status as TyCon or DataCon or Class. And got rid of IdCoreRule altogether. It's all much more solid and uniform, but it meant touching a *lot* of modules. 4. Allow instance decls in hs-boot files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Allowing instance decls in hs-boot files is jolly useful, becuase in a big mutually-recursive bunch of data types, you want to give the instances with the data type declarations. To achieve this * The hs-boot file makes a provisional name for the dict-fun, something like $fx9. * When checking the "mother module", we check that the instance declarations line up (by type) and generate bindings for the boot dfuns, such as $fx9 = $f2 where $f2 is the dfun generated by the mother module * In doing this I decided that it's cleaner to have DFunIds get their final External Name at birth. To do that they need a stable OccName, so I have an integer-valued dfun-name-supply in the TcM monad. That keeps it simple. This feature is hardly tested yet. 5. Tidy up tidying, and Iface file generation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main/TidyPgm now has two entry points: simpleTidyPgm is for hi-boot files, when typechecking only (not yet implemented), and potentially when compiling without -O. It ignores the bindings, and generates a nice small TypeEnv. optTidyPgm is the normal case: compiling with -O. It generates a TypeEnv rich in IdInfo MkIface.mkIface now only generates a ModIface. A separate procedure, MkIface.writeIfaceFile, writes the file out to disk.
* [project @ 2005-04-27 11:15:15 by simonmar]simonmar2005-04-272-21/+30
| | | | Support for returning the renamed syntax from checkModule (untested).
* [project @ 2005-04-27 08:25:46 by simonmar]simonmar2005-04-271-4/+4
| | | | | | | | | | | | newTempName: instead of bumping the processId until we find a name that isn't used, add an integer suffix to the processId. This should prevent temp-file conflicts that appear to have been affecting our nightly builds and occasionally make -j. The right way to allocate a temporary file is to create it straight away, but I'm not sure of the implications of passing existing temporary files to the various sub-processes that GHC executes, hence this fix instead.
* [project @ 2005-04-26 15:08:16 by simonmar]simonmar2005-04-261-49/+85
| | | | | | | | | | | | | | | | When chasing explicit imports, we now look for the module in both the home package and external packages, and complain if it is found in both: Chasing modules from: Overlap Cannot import `List': it was found in both overlap/List.hs and package haskell98-1.0. Possible fix: -ignore-package haskell98-1.0 (imported from overlap/Overlap.hs) Previously the home module would have been ignored in favour of the package module. It means we're doing a bit more searching, but the behaviour is less obscure.
* [project @ 2005-04-26 14:43:31 by simonmar]simonmar2005-04-261-1/+1
| | | | | | | | | | Back out previous revision. It appears that passing -g to the assembly phase of C compilation results in an object file with broken debug info, that gdb can't read. This is probably a bug in gcc and/or binutils, but this change means that I can't avoid it (unless we were to hack the pipeline to do .c->.s->.o in one stage instead of two).
* [project @ 2005-04-26 00:08:17 by sof]sof2005-04-261-15/+34
| | | | | | | runSomething: 'rawSystem' might raise an exception to indicate that 'pgm' couldn't be executed, so catch this here & report. Merge to STABLE.
* [project @ 2005-04-25 13:02:31 by simonmar]simonmar2005-04-251-1/+1
| | | | | | | | | | | | | Requested by Duncan Coutts: -optc flags get passed to the assembler phase too. It's not obvious, when using GHC to compile a .c file, that options need to be passed both with -optc and -opta - gcc doesn't need this, for example. This is an experimental change - if it breaks anything we can back it out. If anyone needs to pass flags to the .c->.s phase *only*, then we will need to add another flag for that purpose. It seems unlikely, though (there aren't many flags that affect the assembler only, and those that do don't conflict with flags for the C phase).
* [project @ 2005-04-22 21:54:37 by simonmar]simonmar2005-04-221-0/+1
| | | | enable splitting on x86_64
* [project @ 2005-04-20 13:50:04 by krasimir]krasimir2005-04-201-0/+6
| | | | | modInfoExports, TypecheckedSource and ParsedSource are exported. Added modInfoPrintUnqualified function.
* [project @ 2005-04-19 15:28:35 by simonmar]simonmar2005-04-192-14/+50
| | | | | | | | - DriverPipeline.compile: report errors in GHC_OPTIONS pragmas using the Message callback, and give them a proper line number. - GHC.checkModule: read the GHC_OPTIONS pragma, and report errors appropriately.
* [project @ 2005-04-16 22:47:23 by simonpj]simonpj2005-04-161-2/+3
| | | | | | | | | | | | | | | Significant clean-up of the handling of hi-boot files. Previously, when compling A.hs, we loaded A.hi-boot, and it went into the External Package Table. It was strange but it worked. This tidy up stops it going anywhere; it's just read in, and typechecked into a ModDetails. All this was on the way to improving the handling of instances in hs-boot files, something Chris Ryder wanted. I think they work quite sensibly now. If I've got all this right (have not had a chance to fully test it) we can merge it into STABLE.
* [project @ 2005-04-14 14:06:25 by wolfgang]wolfgang2005-04-141-4/+4
| | | | Fix previous commit
* [project @ 2005-04-13 21:42:17 by wolfgang]wolfgang2005-04-133-13/+48
| | | | | | | Make the status messages from ghc --make display the number of modules to be compiled, as in: [3 of 9] Compiling Foo.hs ( Foo.hs, Foo.o )