summaryrefslogtreecommitdiffstats
path: root/lib/Lex/ModuleMap.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Modules] Change private modules rules and warningsBruno Cardoso Lopes2017-12-221-35/+63
| | | | | | | | | | | | | | | | We used to advertise private modules to be declared as submodules (Foo.Private). This has proven to not scale well since private headers might carry several dependencies, introducing unwanted content into the main module and often causing dep cycles. Change the canonical way to name it to Foo_Private, forcing private modules as top level ones, and provide warnings under -Wprivate-module to suggest fixes for other private naming. Update documentation to reflect that. rdar://problem/31173501 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321337 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lex] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-12-061-29/+54
| | | | | | minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319986 91177308-0d34-0410-b5e6-96231b3b80d8
* [Module map] Introduce a private module re-export directive.Douglas Gregor2017-09-141-0/+44
| | | | | | | | | | | | | Introduce a new "export_as" directive for top-level modules, which indicates that the current module is a "private" module whose symbols will eventually be exported through the named "public" module. This is in support of a common pattern in the Darwin ecosystem where a single public framework is constructed of several private frameworks, with (currently) header duplication and some support from the linker. Addresses rdar://problem/34438420. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313316 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix memory leak after r312467. The ModuleMap is the owner of the global ↵Richard Smith2017-09-051-6/+10
| | | | | | module object until it's reparented under a real module. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312580 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement Itanium name mangling support for C++ Modules TS.Richard Smith2017-09-041-1/+12
| | | | | | | | | | | | | This follows the scheme agreed with Nathan Sidwell, which can be found here: https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile This will be proposed to the itanium-cxx-abi list once we have some experience with how well it works; the ABI for this TS should be considered unstable until it is part of the Itanium C++ ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312467 91177308-0d34-0410-b5e6-96231b3b80d8
* Track the set of module maps read while building a .pcm file and reload ↵Richard Smith2017-06-291-1/+2
| | | | | | those when preprocessing from that .pcm file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306628 91177308-0d34-0410-b5e6-96231b3b80d8
* Support lazy stat'ing of files referenced by module maps.Richard Smith2017-06-021-84/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Factor resolving of header directives -> files out of module map parser.Richard Smith2017-05-261-97/+104
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303945 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove last (unnecessary) use of mapping from SourceLocation to Module andRichard Smith2017-05-191-33/+0
| | | | | | | | | | remove the mechanism for doing so. This mechanism was incorrect in the presence of preprocessed modules (and #pragma clang module begin/end). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303469 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Allow umbrella frameworks to define private submodules for ↵Bruno Cardoso Lopes2017-05-091-2/+4
| | | | | | | | | | | | subframeworks In r298391 we fixed the umbrella framework model to work when submodules named "Private" are used. This complements the work by allowing the umbrella framework model to work in general. rdar://problem/31790067 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302491 91177308-0d34-0410-b5e6-96231b3b80d8
* If we are building a module, and we read a second description of the sameRichard Smith2017-05-081-1/+13
| | | | | | | | | module from a different module map, ignore it. This happens during builds of preprocessed modules (where it is harmless). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302463 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for building modules from preprocessed source.Richard Smith2017-05-051-9/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support this, an optional marker "#pragma clang module contents" is recognized in module map files, and the rest of the module map file from that point onwards is treated as the source of the module. Preprocessing a module map produces the input module followed by the marker and then the preprocessed contents of the module. Ignoring line markers, a preprocessed module might look like this: module A { header "a.h" } #pragma clang module contents #pragma clang module begin A // ... a.h ... #pragma clang module end The preprocessed output generates line markers, which are not accepted by the module map parser, so -x c++-module-map-cpp-output should be used to compile such outputs. A couple of major parts do not work yet: 1) The files that are listed in the module map must exist on disk, in order to build the on-disk header -> module lookup table in the PCM file. To fix this, we need the preprocessed output to track the file size and other stat information we might use to build the lookup table. 2) Declaration ownership semantics don't work properly yet, since mapping from a source location to a module relies on mapping from FileIDs to modules, which we can't do if module transitions can occur in the middle of a file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302309 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules ts] Diagnose 'export' declarations outside of a module interface.Richard Smith2017-04-241-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301271 91177308-0d34-0410-b5e6-96231b3b80d8
* PR30508: Downgrade error to warning if the umbrella folder doesn't exist.Vassil Vassilev2017-04-181-2/+1
| | | | | | | Patch by Yuka Takahashi (D32119)! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300594 91177308-0d34-0410-b5e6-96231b3b80d8
* Modular Codegen: Separate flags for function and debug info supportDavid Blaikie2017-04-121-1/+0
| | | | | | | | | | This allows using and testing these two features separately. (noteably, debug info is, so far as I know, always a win (basically). But function modular codegen is currently a loss for highly optimized code - where most of the linkonce_odr definitions are optimized away, so providing weak_odr definitions is only overhead) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300104 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Find PrivateHeaders when looking into subframeworksBruno Cardoso Lopes2017-03-211-7/+13
| | | | | | | | | Fix the current parsing of subframeworks in modulemaps to lookup for headers based on whether they are frameworks. rdar://problem/30563982 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298391 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix modules codegen to be compatible with modules-tsDavid Blaikie2017-01-311-1/+0
| | | | | | | | | | | | | | | | | The Module::WithCodegen flag was only being set when the module was parsed from a ModuleMap. Instead set it late, in the ASTWriter to match the layer where the MODULAR_CODEGEN_DECLs list is determined (the WithCodegen flag essentially means "are this module's decls in MODULAR_CODEGEN_DECLs"). When simultaneous emission of AST file and modular object is implemented this may need to change - the Module::WithCodegen flag will need to be set earlier, and ideally the MODULAR_CODEGEN_DECLs gathering will consult this flag (that's not possible right now since Decls destined for an AST File don't have a Module - only if they're /read/ from a Module is that true - I expect that would need to change as well). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293692 91177308-0d34-0410-b5e6-96231b3b80d8
* Prototype of modules codegenDavid Blaikie2017-01-301-5/+8
| | | | | | | | | | | | | | | | | | | | | First pass at generating weak definitions of inline functions from module files (& skipping (-O0) or emitting available_externally (optimizations) definitions where those modules are used). External functions defined in modules are emitted into the modular object file as well (this may turn an existing ODR violation (if that module were imported into multiple translations) into valid/linkable code). Internal symbols (static functions, for example) are not correctly supported yet. The symbol will be produced, internal, in the modular object - unreferenceable from the users. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D28845 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@293456 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Fix misleading warning about missing textual header in umbrella headerBruno Cardoso Lopes2017-01-121-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | When a textual header is present inside a umbrella dir but not in the header, we get the misleading warning: warning: umbrella header for module 'FooFramework' does not include header 'Baz_Private.h' The module map in question: framework module FooFramework { umbrella header "FooUmbrella.h" export * module * { export * } module Private { textual header "Baz_Private.h" } } Fix this by taking textual headers into account. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291794 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Support #import when entering files with modulesBruno Cardoso Lopes2017-01-111-3/+3
| | | | | | | | | | | | Textual headers and builtins that are #import'd from different modules should get re-entered when these modules are independent from each other. Differential Revision: https://reviews.llvm.org/D26267 rdar://problem/25881934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291644 91177308-0d34-0410-b5e6-96231b3b80d8
* Use after move bug fixesPiotr Padlewski2016-12-231-1/+1
| | | | | | | | | | | | Summary: Bunch of fixed bugs in Clang after running misc-use-after-move in clang-tidy. Reviewers: rsmith, mboehme Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D27752 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290424 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Handle modules with nonstandard names in module.private.modulemapsGraydon Hoare2016-12-211-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The module system supports accompanying a primary module (say Foo) with an auxiliary "private" module (defined in an adjacent module.private.modulemap file) that augments the primary module when associated private headers are available. The feature is intended to be used to augment the primary module with a submodule (say Foo.Private), however some users in the wild are choosing to augment the primary module with an additional top-level module with a "similar" name (in all cases so far: FooPrivate). This "works" when a user of the module initially imports a private header, such as '#import "Foo/something_private.h"' since the Foo import winds up importing FooPrivate in passing. But if the import is subsequently recorded in a PCH file, reloading the PCH will fail to validate because of a cross-check that attempts to find the module.modulemap (or module.private.modulemap) using HeaderSearch algorithm, applied to the "FooPrivate" name. Since it's stored in Foo.framework/Modules, not FooPrivate.framework/Modules, the check fails and the PCH is rejected. This patch adds a compensatory workaround in the HeaderSearch algorithm when searching (and failing to find) a module of the form FooPrivate: the name used to derive filesystem paths is decoupled from the module name being searched for, and if the initial search fails and the module is named "FooPrivate", the filesystem search name is altered to remove the "Private" suffix, and the algorithm is run a second time (still looking for a module named FooPrivate, but looking in directories derived from Foo). Accompanying this change is a new warning that triggers when a user loads a module.private.modulemap that defines a top-level module with a different name from the top-level module defined in its adjacent module.modulemap. Reviewers: doug.gregor, manmanren, bruno Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D27852 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290219 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Replace arrays with init lists.Benjamin Kramer2016-11-151-9/+5
| | | | | | | Thi way the compiler can pick the optimal storage duration. It's also more readable. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287005 91177308-0d34-0410-b5e6-96231b3b80d8
* Treat module headers wrapped by our builtin headers as implicitly being textualRichard Smith2016-10-261-5/+9
| | | | | | | | | | | headers. We previously got this check backwards and treated the wrapper header as being textual. This is important because our wrapper headers sometimes inject macros into the system headers that they #include_next, and sometimes replace them entirely. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285152 91177308-0d34-0410-b5e6-96231b3b80d8
* Module: improve the diagnostic message for include of non-modular header.Manman Ren2016-10-211-1/+2
| | | | | | | | | Emit the actual path to the non-modular include. rdar://28897010 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284897 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add 'no_undeclared_includes' module map attributeBruno Cardoso Lopes2016-10-211-14/+23
| | | | | | | | | | | | | 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
* Don't diagnose non-modular includes when we are not compiling a module.Manman Ren2016-08-261-1/+3
| | | | | | | | | | | | | | | This is triggered when we are compiling an implementation of a module, it has relative includes to a VFS-mapped module with umbrella headers. Currently we will find the real path to headers under the umbrella directory, but the umbrella directories are using virtual path. rdar://27951255 Thanks Ben and Richard for reviewing the patch! Differential Revision: http://reviews.llvm.org/D23858 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279838 91177308-0d34-0410-b5e6-96231b3b80d8
* C++ Modules TS: add frontend support for building pcm files from moduleRichard Smith2016-08-261-1/+20
| | | | | | | | interface files. At the moment, all declarations (and no macros) are exported, and 'export' declarations are not supported yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279794 91177308-0d34-0410-b5e6-96231b3b80d8
* [Lex] inferModuleFromLocation should do no work if there are no modulesDavid Majnemer2016-05-161-0/+3
| | | | | | | | | | | | getModuleContainingLocation ends up on the hot-path for typical C code which can lead to calls to getFileIDSlow. To speed this up, short circuit inferModuleFromLocation when there aren't any modules, implicit or otherwise. This shaves 4-5% build time when building the linux kernel. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269687 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Use vfs for (recursive) directory iterationBruno Cardoso Lopes2016-05-161-7/+11
| | | | | | | | | | | | | | | | Clang performs directory walk while searching headers inside modules by using the ::sys::fs instead of ::vfs. This prevents any code that uses the VFS (e.g, reproducer scripts) to actually find such headers, since the VFS will never be searched for those. Change these places to use vfs::recursive_directory_iterator and vfs::directory_iterator instead. Differential Revision: http://reviews.llvm.org/D20266 rdar://problem/25880368 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269661 91177308-0d34-0410-b5e6-96231b3b80d8
* [ModuleMap][CrashReproducer] Collect headers from inner frameworksBruno Cardoso Lopes2016-05-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) Collect headers under inner frameworks (frameworks inside other other frameworks). (2) Make sure we also collect the right header files inside them. More info on (2): Consider a dummy framework module B, with header Frameworks/B/B.h. Now consider that another framework A, with header Frameworks/A/A.h, has a layout with a inner framework Frameworks/A/Frameworks/B/B.h, where the "B/B.h" part is a symlink for Frameworks/B/B.h. Also assume that Frameworks/A/A.h includes <B/B.h>. When parsing header Frameworks/A/A.h, framework module lookup is performed in search for B, and it happens that "Frameworks/A/Frameworks/B/B.h" path is registered in the module instead of real "Frameworks/B/B.h". This occurs because "Frameworks/A/Frameworks/B/B.h" is scanned first by the FileManager, when looking for inner framework modules under Frameworks/A/Frameworks. This makes Frameworks/A/Frameworks/B/B.h the default cached named inside the FileManager for the B.h file UID. This leads to modules being built without consistent paths to underlying header files. This is usually not a problem in regular compilation flow, but it's an issue when running the crash reproducer. The issue is that clangs collect "Frameworks/A/Frameworks/B/B.h" but not "Frameworks/B/B.h" into the VFS, leading to err_mmap_umbrella_clash. So make sure we also collect the original header. Differential Revision: http://reviews.llvm.org/D20194 rdar://problem/25880368 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@269502 91177308-0d34-0410-b5e6-96231b3b80d8
* [CrashReproducer] Change module map callback signature. NFCBruno Cardoso Lopes2016-05-061-1/+1
| | | | | | | | Use a StringRef instead of a FileEntry in the moduleMapAddHeader callback to allow more flexibility on what to collect on further patches. This changes the interface I introduced in r264971. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268819 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] When diagnosing a missing module import, suggest adding a #include ifRichard Smith2016-04-271-12/+7
| | | | | | | | the current language doesn't have an import syntax and we can figure out a suitable file to include. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267802 91177308-0d34-0410-b5e6-96231b3b80d8
* [CrashReproducer] Add a module map callback for added headersBruno Cardoso Lopes2016-03-301-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current ModuleDependencyCollector has a AST listener to collect header files present in loaded modules, but this isn't enough to collect all headers needed in the crash reproducer. One of the reasons is that the AST writer doesn't write symbolic link header paths in the pcm modules, this makes the listeners on the reader only able to collect the real files. Since the module maps could contain submodules that use headers which are symbolic links, not collecting those forbid the reproducer scripts to regen the modules. For instance: usr/include/module.map: ... module pthread { header "pthread.h" export * module impl { header "pthread_impl.h" export * } } ... usr/include/pthread/pthread_impl.h usr/include/pthread_impl.h -> pthread/pthread_impl.h The AST dump for the module above: <SUBMODULE_HEADER abbrevid=6/> blob data = 'pthread_impl.h' <SUBMODULE_TOPHEADER abbrevid=7/> blob data = '/<path_to_sdk>/usr/include/pthread/pthread_impl.h' Note that we don't have "usr/include/pthread_impl.h" which is requested by the module.map in case we want to reconstruct the module in the reproducer. The reason the original symbolic link path isn't used is because the headers are kept by name and requested through the FileManager, which unique files and returns the real path only. To fix that, add a callback to be invoked everytime a header is added while parsing module maps and hook that up to the module dependecy collector. This callback is only registered when generating the reproducer. Differential Revision: http://reviews.llvm.org/D18585 rdar://problem/24499339 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264971 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Don't diagnose non-modular includes from modular files that areRichard Smith2016-03-141-1/+2
| | | | | | | implementation units of modules rather than interface units. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263449 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add stdatomic to the list of builtin headersBen Langmuir2016-03-091-0/+1
| | | | | | | | | | | | | Since it's provided by the compiler. This allows a system module map file to declare a module for it. No test change for cstd.m, since stdatomic.h doesn't function without a relatively complete stdint.h and stddef.h, which tests using this module don't provide. rdar://problem/24931246 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@263076 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Modernize, use range-based loops.Davide Italiano2016-03-081-5/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262969 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Don't swallow errors when parsing optional attributes.Davide Italiano2016-03-061-3/+8
| | | | | | | Differential Revision: http://reviews.llvm.org/D17787 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262789 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a singleRichard Smith2016-02-191-18/+11
| | | | | | | | | | | | | option. Previously these options could both be used to specify that you were compiling the implementation file of a module, with a different set of minor bugs in each case. This change removes -fmodule-implementation-of, and instead tracks a flag to determine whether we're currently building a module. -fmodule-name now behaves the same way that -fmodule-implementation-of previously did. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261372 91177308-0d34-0410-b5e6-96231b3b80d8
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-1/+1
| | | | | | r259192 post commit comment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259232 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix auto-link for text-based dynamic library SDKs.Juergen Ributzka2015-11-131-3/+12
| | | | | | | | | | When linking against text-based dynamic library SDKs the library name of a framework has now more than one possible filename extensions. This fix tests for both possible extensions (none, and .tbd). This fixes rdar://problem/20609975 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253060 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow use of private headers in different sub-modules.Manuel Klimek2015-11-051-10/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@252170 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Remove unnecessary deserialization of fully-external ↵Richard Smith2015-08-241-2/+7
| | | | | | HeaderFileInfos for all files we've seen in this compilation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245881 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Fix HeaderFileInfo serialization to store all the known owning ↵Richard Smith2015-08-181-14/+31
| | | | | | modules for a header, not just the current favourite. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245390 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] PR20507: Avoid silent textual inclusion.Sean Silva2015-08-171-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If a module was unavailable (either a missing requirement on the module being imported, or a missing file anywhere in the top-level module (and not dominated by an unsatisfied `requires`)), we would silently treat inclusions as textual. This would cause all manner of crazy and confusing errors (and would also silently "work" sometimes, making the problem difficult to track down). I'm really not a fan of the `M->isAvailable(getLangOpts(), getTargetInfo(), Requirement, MissingHeader)` function; it seems to do too many things at once, but for now I've done things in a sort of awkward way. The changes to test/Modules/Inputs/declare-use/module.map were necessitated because the thing that was meant to be tested there (introduced in r197805) was predicated on silently falling back to textual inclusion, which we no longer do. The changes to test/Modules/Inputs/macro-reexport/module.modulemap are just an overlooked missing header that seems to have been missing since this code was committed (r213922), which is now caught. Reviewers: rsmith, benlangmuir, djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10423 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245228 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to fix build after r244912Ben Langmuir2015-08-131-4/+7
| | | | | | | Some compilers were less happy about converting a lambda to a comparator function for array_pod_sort. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244917 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Add Darwin-specific compatibility module map parsing hacksBen Langmuir2015-08-131-7/+91
| | | | | | | | | | | | | | | | This preserves backwards compatibility for two hacks in the Darwin system module map files: 1. The use of 'requires excluded' to make headers non-modular, which should really be mapped to 'textual' now that we have this feature. 2. Silently removes a bogus cplusplus requirement from IOKit.avc. Once we start diagnosing missing requirements and headers on auto-imports these would have broken compatibility with existing Darwin SDKs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244912 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] When building a dependency file, include module maps parsed in theRichard Smith2015-08-091-0/+5
| | | | | | | current compilation, not just those from imported modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244413 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] When diagnosing errors in module map files found by 'extern ↵Richard Smith2015-07-141-4/+5
| | | | | | module' declarations, show how we got to that module map file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242105 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Fix "prefer own module over others" rule when selecting a module ↵Richard Smith2015-07-101-1/+1
| | | | | | for a header to work in the presence of module hierarchy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241936 91177308-0d34-0410-b5e6-96231b3b80d8