summaryrefslogtreecommitdiffstats
path: root/docs/Modules.rst
Commit message (Collapse)AuthorAgeFilesLines
* Support lazy stat'ing of files referenced by module maps.Richard Smith2017-06-021-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for a `header` declaration in a module map to specify certain `stat` information (currently, size and mtime) about that header file. This has two purposes: - It removes the need to eagerly `stat` every file referenced by a module map. Instead, we track a list of unresolved header files with each size / mtime (actually, for simplicity, we track submodules with such headers), and when attempting to look up a header file based on a `FileEntry`, we check if there are any unresolved header directives with that `FileEntry`'s size / mtime and perform deferred `stat`s if so. - It permits a preprocessed module to be compiled without the original files being present on disk. The only reason we used to need those files was to get the `stat` information in order to do header -> module lookups when using the module. If we're provided with the `stat` information in the preprocessed module, we can avoid requiring the files to exist. Unlike most `header` directives, if a `header` directive with `stat` information has no corresponding on-disk file the enclosing module is *not* marked unavailable (so that behavior is consistent regardless of whether we've resolved a header directive, and so that preprocessed modules don't get marked unavailable). We could actually do this for all `header` directives: the only reason we mark the module unavailable if headers are missing is to give a diagnostic slightly earlier (rather than waiting until we actually try to build the module / load and validate its .pcm file). Differential Revision: https://reviews.llvm.org/D33703 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304515 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Minor documentation clarification for behavior of ↵Richard Smith2017-05-301-1/+1
| | | | | | requires-declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304253 91177308-0d34-0410-b5e6-96231b3b80d8
* [coroutines] Support "coroutines" feature in module map requires clauseEric Fiselier2017-05-281-0/+3
| | | | | | | | | | | | | | Summary: In order for libc++ to add `<experimental/coroutine>` to its module map, there has to be a feature that can be used to detect if coroutines support is enabled in Clang. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33538 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304107 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[coroutines] Support "coroutines" feature in module map requires clause"Eric Fiselier2017-05-271-3/+0
| | | | | | This reverts commit r304054. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304057 91177308-0d34-0410-b5e6-96231b3b80d8
* [coroutines] Support "coroutines" feature in module map requires clauseEric Fiselier2017-05-271-0/+3
| | | | | | | | | | | | | | Summary: In order for libc++ to add `<experimental/coroutine>` to its module map, there has to be a feature that can be used to detect if coroutines support is enabled in Clang. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33538 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304054 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add documentation on private frameworksBruno Cardoso Lopes2017-03-161-0/+11
| | | | | | | | | Expand a bit on private modules with some guidance on how to write them in the context of frameworks. rdar://problem/24758771 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298012 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add a command line option for loading the clang builtins modulemap.Elad Cohen2016-10-311-0/+3
| | | | | | | | | | | -fbuiltin-module-map loads the clang builtins modulemap file. (This is equivalent to -fmodule-map-file=<resource dir>/include/module.modulemap) Differential Revision: https://reviews.llvm.org/D25767 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285548 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add 'no_undeclared_includes' module map attributeBruno Cardoso Lopes2016-10-211-0/+2
| | | | | | | | | | | | | The 'no_undeclared_includes' attribute should be used in a module to tell that only non-modular headers and headers from used modules are accepted. The main motivation behind this is to prevent dep cycles between system libraries (such as darwin) and libc++. Patch by Richard Smith! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284797 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.Elad Cohen2016-09-041-0/+3
| | | | | | | | | | | This adds support for modules that require (non-)freestanding environment, such as the compiler builtin mm_malloc submodule. Differential Revision: https://reviews.llvm.org/D23871 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280613 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.Bruno Cardoso Lopes2016-08-301-0/+3
| | | | | | | | | | | | | This adds support for modules that require (no-)gnu-inline-asm environment, such as the compiler builtin cpuid submodule. This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871 Differential Revision: https://reviews.llvm.org/D23905 rdar://problem/26931199 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@280159 91177308-0d34-0410-b5e6-96231b3b80d8
* Module: add -fprebuilt-module-path to support loading prebuilt modules.Manman Ren2016-08-181-0/+3
| | | | | | | | | | | | | | In this mode, there is no need to load any module map and the programmer can simply use "@import" syntax to load the module directly from a prebuilt module path. When loading from prebuilt module path, we don't support rebuilding of the module files and we ignore compatible configuration mismatches. rdar://27290316 Differential Revision: http://reviews.llvm.org/D23125 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279096 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a typo.Adrian Prantl2015-09-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247895 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix "the the" in comments/documentation/etc.Eric Christopher2015-06-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240110 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise forRichard Smith2015-06-161-3/+3
| | | | | | | -fno-module-maps). The old names are preserved for compatibility. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239792 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Remove non-functional driver options -f[no-]modules-implicit-maps.Richard Smith2015-06-151-4/+1
| | | | | | | | These driver options never did anything (they weren't forwarded to the frontend). Also update the documentation to not mention them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239787 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Restrict the module use-declaration to only appear in top-levelRichard Smith2015-03-261-8/+17
| | | | | | | | modules, and allow sub-modules of a module with a use-declaration to make use of the nominated modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233323 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -fno-implicit-modules.Manuel Klimek2015-02-201-0/+6
| | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230006 91177308-0d34-0410-b5e6-96231b3b80d8
* Add flag -f(no-)modules-implicit-maps.Daniel Jasper2014-11-251-0/+3
| | | | | | | This suppresses the implicit search for files called 'module.modulemap' and similar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222745 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Support combining 'textual' with 'private'.Richard Smith2014-10-241-6/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220589 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Add support for 'textual header' directives.Richard Smith2014-10-221-5/+14
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220448 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Add support for #include_next.Richard Smith2014-10-201-0/+13
| | | | | | | | | | | | | #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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220177 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable both C and C++ modules with -fmodules, by switching -fcxx-modules toRichard Smith2014-09-301-13/+8
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218717 91177308-0d34-0410-b5e6-96231b3b80d8
* Update modules documentation now that C++ support is working pretty well.Richard Smith2014-09-291-6/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218614 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Slightly expand module semantics documentation.Richard Smith2014-07-241-1/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213838 91177308-0d34-0410-b5e6-96231b3b80d8
* Initial implementation of -modules-earch-all option, for searching for ↵John Thompson2014-04-231-0/+3
| | | | | | symbols in non-imported modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206977 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix sphinx-build warnings in clang docs.Reid Kleckner2014-04-181-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206661 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename lib/Headers/module.map to module.modulemapBen Langmuir2014-04-171-1/+1
| | | | | | Don't install a file using the legacy spelling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206431 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation: remove a spurious '1' and wrap to 80 columnsDmitri Gribenko2014-03-281-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205035 91177308-0d34-0410-b5e6-96231b3b80d8
* Document module.private.modulemap and module_private.map.Douglas Gregor2014-03-281-1/+58
| | | | | | | Requested in <rdar://problem/16188740>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205030 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new spelling for module map files 'module.modulemap'Ben Langmuir2014-03-191-4/+7
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204261 91177308-0d34-0410-b5e6-96231b3b80d8
* Add [extern_c] attribute for modules, allowing a C module to be imported ↵Richard Smith2014-03-021-2/+4
| | | | | | within an extern "C" block in C++ code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202615 91177308-0d34-0410-b5e6-96231b3b80d8
* If a module A exports a macro M, and a module B imports that macro and #undef'sRichard Smith2014-03-011-0/+34
| | | | | | | | | | | | | | | 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202560 91177308-0d34-0410-b5e6-96231b3b80d8
* Modules: Fix malformed reStructuredTextDavid Majnemer2014-02-251-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202117 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow a new syntax in a module requires-declaration:Richard Smith2013-10-281-2/+5
| | | | | | | | | | | | | 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193549 91177308-0d34-0410-b5e6-96231b3b80d8
* Note that modules are supported for C/Objective-C, and have syntax in ObjC.Douglas Gregor2013-09-271-13/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191562 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -fmodule-map-file option.Daniel Jasper2013-09-241-0/+3
| | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191284 91177308-0d34-0410-b5e6-96231b3b80d8
* Module use declarations (II)Daniel Jasper2013-09-241-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191283 91177308-0d34-0410-b5e6-96231b3b80d8
* Support for modular module-map-filesDaniel Jasper2013-09-111-0/+4
| | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190497 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Prominently note modules are experimental.Sean Silva2013-09-091-6/+6
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190340 91177308-0d34-0410-b5e6-96231b3b80d8
* Add option to disable module loading.Daniel Jasper2013-08-051-0/+5
| | | | | | | This patch was created by Lawrence Crowl and reviewed in: http://llvm-reviews.chandlerc.com/D963 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187738 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch adds new private headers to the module map. PrivateLawrence Crowl2013-06-201-2/+5
| | | | | | | | | headers may be included from within the module, but not from outside the module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184471 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Convert module specific -fno-modules-autolink into -fno-autolink.Daniel Dunbar2013-04-161-2/+2
| | | | | | | | | - 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). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179612 91177308-0d34-0410-b5e6-96231b3b80d8
* <rdar://problem/13509689> Introduce -module-file-info option that provides ↵Douglas Gregor2013-03-271-0/+3
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178148 91177308-0d34-0410-b5e6-96231b3b80d8
* <rdar://problem/13434605> Periodically prune the module cache so that it ↵Douglas Gregor2013-03-251-0/+6
| | | | | | does not grow forever. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177918 91177308-0d34-0410-b5e6-96231b3b80d8
* Documentation: fix a typo and formattingDmitri Gribenko2013-03-221-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177722 91177308-0d34-0410-b5e6-96231b3b80d8
* Add future directions for modulesDouglas Gregor2013-03-221-0/+16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177707 91177308-0d34-0410-b5e6-96231b3b80d8
* More modules documentation, including the straw-man import declaration ↵Douglas Gregor2013-03-221-28/+90
| | | | | | syntax and "how to modularize a platform". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177706 91177308-0d34-0410-b5e6-96231b3b80d8
* More documentation on the module map language.Douglas Gregor2013-03-221-5/+464
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177704 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Point inquisitive users to existing module.map files.Sean Silva2013-03-201-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177552 91177308-0d34-0410-b5e6-96231b3b80d8
* [docs] Prominently note that modules are expemental.Sean Silva2013-03-201-0/+4
| | | | | | And ask for people to try it out and send us bug reports! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177551 91177308-0d34-0410-b5e6-96231b3b80d8