Commit Graph

36 Commits

Author SHA1 Message Date
Manuel Klimek d2e8b04d61 Add -fno-implicit-modules.
If this flag is set, we error out when a module build is required. This is
useful in environments where all required modules are passed via -fmodule-file.

llvm-svn: 230006
2015-02-20 11:44:41 +00:00
Daniel Jasper 21a0f55755 Add flag -f(no-)modules-implicit-maps.
This suppresses the implicit search for files called 'module.modulemap' and
similar.

llvm-svn: 222745
2014-11-25 09:45:48 +00:00
Richard Smith 202210b369 [modules] Support combining 'textual' with 'private'.
llvm-svn: 220589
2014-10-24 20:23:01 +00:00
Richard Smith 306d892076 [modules] Add support for 'textual header' directives.
This allows a module to specify that it logically contains a file, but that
said file is non-modular and intended for textual inclusion. This allows
layering checks to work properly in the presence of such files.

llvm-svn: 220448
2014-10-22 23:50:56 +00:00
Richard Smith 25d50758f3 [modules] Add support for #include_next.
#include_next interacts poorly with modules: it depends on where in the list of
include paths the current file was found. Files covered by module maps are not
found in include search paths when building the module (and are not found in
include search paths when @importing the module either), so this isn't really
meaningful. Instead, we fake up the result that #include_next *should* have
given: find the first path that would have resulted in the given file being
picked, and search from there onwards.

llvm-svn: 220177
2014-10-20 00:15:49 +00:00
Richard Smith ffb650856d Enable both C and C++ modules with -fmodules, by switching -fcxx-modules to
being on by default. -fno-cxx-modules can still be used to enable C modules but
not C++ modules, but C++ modules is not significantly less stable than C
modules any more.

Also remove some of the scare words from the modules documentation. We're
certainly not going to remove modules support (though we might change the
interface), and it works well enough to bootstrap and build lots of
non-trivial code.

Note that this does not represent a commitment to the current interface nor
implementation, and we still intend to follow whatever direction the C and C++
committees take regarding modules support.

llvm-svn: 218717
2014-09-30 23:10:19 +00:00
Richard Smith bf65300f3f Update modules documentation now that C++ support is working pretty well.
llvm-svn: 218614
2014-09-29 17:46:41 +00:00
Richard Smith f89e492349 [modules] Slightly expand module semantics documentation.
llvm-svn: 213838
2014-07-24 03:42:38 +00:00
John Thompson 2255f2ce90 Initial implementation of -modules-earch-all option, for searching for symbols in non-imported modules.
llvm-svn: 206977
2014-04-23 12:57:01 +00:00
Reid Kleckner 230f662d12 Fix sphinx-build warnings in clang docs.
llvm-svn: 206661
2014-04-18 21:55:49 +00:00
Ben Langmuir 47d1ca4838 Rename lib/Headers/module.map to module.modulemap
Don't install a file using the legacy spelling.

llvm-svn: 206431
2014-04-17 00:52:48 +00:00
Dmitri Gribenko 3be06ffcd8 Documentation: remove a spurious '1' and wrap to 80 columns
llvm-svn: 205035
2014-03-28 19:25:09 +00:00
Douglas Gregor b5ecb908af Document module.private.modulemap and module_private.map.
Requested in <rdar://problem/16188740>.

llvm-svn: 205030
2014-03-28 19:05:18 +00:00
Ben Langmuir 984e1df77a Add a new spelling for module map files 'module.modulemap'
This name, while more verbose, plays more nicely with tools that use
file extensions to determine file types. The existing spelling
'module.map' will continue to work, but the new spelling will take
precedence.

In frameworks, this new filename will only go in a new 'Modules'
sub-directory.

Similarly, add a module.private.modulemap corresponding to
module_private.map.

llvm-svn: 204261
2014-03-19 20:23:34 +00:00
Richard Smith 7794486846 Add [extern_c] attribute for modules, allowing a C module to be imported within an extern "C" block in C++ code.
llvm-svn: 202615
2014-03-02 05:58:18 +00:00
Richard Smith 49f906a36f If a module A exports a macro M, and a module B imports that macro and #undef's
it, importers of B should not see the macro. This is complicated by the fact
that A's macro could also be visible through a different path. The rules (as
hashed out on cfe-commits) are included as a documentation update in this
change.

With this, the number of regressions in libc++'s testsuite when modules are
enabled drops from 47 to 7. Those remaining 7 are also macro-related, and are
due to remaining bugs in this change (in particular, the handling of submodules
is imperfect).

llvm-svn: 202560
2014-03-01 00:08:04 +00:00
David Majnemer 27d8b20ee5 Modules: Fix malformed reStructuredText
llvm-svn: 202117
2014-02-25 06:22:25 +00:00
Richard Smith a3feee2ad6 Allow a new syntax in a module requires-declaration:
requires ! feature

The purpose of this is to allow (for instance) the module map for /usr/include
to exclude <tgmath.h> and <complex.h> when building in C++ (these headers are
instead provided by the C++ standard library in this case, and the glibc C
<tgmath.h> header would otherwise try to include <complex.h>, resulting in a
module cycle).

llvm-svn: 193549
2013-10-28 22:18:19 +00:00
Douglas Gregor 30e9b6c47d Note that modules are supported for C/Objective-C, and have syntax in ObjC.
llvm-svn: 191562
2013-09-27 21:23:28 +00:00
Daniel Jasper ca9f73812c Add -fmodule-map-file option.
With this option, arbitrarily named module map files can be specified
to be loaded as required for headers in the respective (sub)directories.

This, together with the extern module declaration allows for specifying
module maps in a modular fashion without the need for files called
"module.map".

Among other things, this allows a directory to contain two modules that
are completely independent of one another.

Review: http://llvm-reviews.chandlerc.com/D1697.
llvm-svn: 191284
2013-09-24 09:27:13 +00:00
Daniel Jasper ba7f2f7110 Module use declarations (II)
Review: http://llvm-reviews.chandlerc.com/D1546.

I have picked up this patch form Lawrence
(http://llvm-reviews.chandlerc.com/D1063) and did a few changes.

From the original change description (updated as appropriate):
This patch adds a check that ensures that modules only use modules they
have so declared. To this end, it adds a statement on intended module
use to the module.map grammar:

  use module-id

A module can then only use headers from other modules if it 'uses' them.
This enforcement is off by default, but may be turned on with the new
option -fmodules-decluse.

When enforcing the module semantics, we also need to consider a source
file part of a module. This is achieved with a compiler option

-fmodule-name=<module-id>.

The compiler at present only applies restrictions to the module directly
being built.

llvm-svn: 191283
2013-09-24 09:14:14 +00:00
Daniel Jasper 97292843d0 Support for modular module-map-files
This patch is the first step to make module-map-files modular (instead
of requiring a single "module.map"-file per include directory). This
step adds a new "extern module" declaration that enables
module-map-files to reference one another along with a very basic
implementation.

The next steps are:

* Combine this with the use-declaration (from
  http://llvm-reviews.chandlerc.com/D1546) in order to only load module
  map files required for a specific compilation.
* Add an additional flag to start with a specific module-map-file (instead
  of requiring there to be at least one "module.map").

Review: http://llvm-reviews.chandlerc.com/D1637
llvm-svn: 190497
2013-09-11 07:20:44 +00:00
Sean Silva 98c64d4dca [docs] Prominently note modules are experimental.
It was really hard to tell that modules are experimental. This makes it
really clear by

* Noting the experimental status in the title.
* Moving the "warning" above the table of contents.

llvm-svn: 190340
2013-09-09 19:57:49 +00:00
Daniel Jasper 07e6c407bc Add option to disable module loading.
This patch was created by Lawrence Crowl and reviewed in:
http://llvm-reviews.chandlerc.com/D963

llvm-svn: 187738
2013-08-05 20:26:17 +00:00
Lawrence Crowl b53e5483b0 This patch adds new private headers to the module map. Private
headers may be included from within the module, but not from outside
the module.

llvm-svn: 184471
2013-06-20 21:14:14 +00:00
Daniel Dunbar e246fbe40b [Modules] Convert module specific -fno-modules-autolink into -fno-autolink.
- There is no reason to have a modules specific flag for disabling
   autolinking. Instead, convert the existing flag into -fno-autolink (which
   should cover other autolinking code generation paths like #pragmas if and
   when we support them).

llvm-svn: 179612
2013-04-16 18:21:19 +00:00
Douglas Gregor bf7fc9c542 <rdar://problem/13509689> Introduce -module-file-info option that provides information about a particular module file.
This option can be useful for end users who want to know why they
ended up with a ton of different variants of the "std" module in their
module cache. This problem should go away over time, as we reduce the
need for module variants, but it will never go away entirely.

llvm-svn: 178148
2013-03-27 16:47:18 +00:00
Douglas Gregor 527b1c95df <rdar://problem/13434605> Periodically prune the module cache so that it does not grow forever.
llvm-svn: 177918
2013-03-25 21:19:16 +00:00
Dmitri Gribenko 22ee0c17a6 Documentation: fix a typo and formatting
llvm-svn: 177722
2013-03-22 10:25:15 +00:00
Douglas Gregor aeb2a3c3a2 Add future directions for modules
llvm-svn: 177707
2013-03-22 07:08:56 +00:00
Douglas Gregor 485996c696 More modules documentation, including the straw-man import declaration syntax and "how to modularize a platform".
llvm-svn: 177706
2013-03-22 07:05:07 +00:00
Douglas Gregor de0beaa8f8 More documentation on the module map language.
llvm-svn: 177704
2013-03-22 06:21:35 +00:00
Sean Silva 99c9d9810b [docs] Point inquisitive users to existing module.map files.
llvm-svn: 177552
2013-03-20 18:37:47 +00:00
Sean Silva 28e0def9f3 [docs] Prominently note that modules are expemental.
And ask for people to try it out and send us bug reports!

llvm-svn: 177551
2013-03-20 18:37:42 +00:00
Douglas Gregor bb1c7e358c Fix typo and grammaro in modules documentation
llvm-svn: 177544
2013-03-20 17:11:13 +00:00
Douglas Gregor e703f2dc30 Work-in-progress documentation on the experimental modules feature.
llvm-svn: 177491
2013-03-20 06:25:14 +00:00