aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-05-16[modules] Retain the name as written for umbrella headers and directories, ↵Richard Smith1-7/+13
rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require. llvm-svn: 237508
2015-05-15[modules] Add local submodule visibility support for declarations.Richard Smith1-30/+30
With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. llvm-svn: 237473
2015-05-01[modules] Start moving the module visibility information off the Module itself.Richard Smith1-3/+4
It has no place there; it's not a property of the Module, and it makes restoring the visibility set when we leave a submodule more difficult. llvm-svn: 236300
2015-03-26[modules] Restrict the module use-declaration to only appear in top-levelRichard Smith1-17/+13
modules, and allow sub-modules of a module with a use-declaration to make use of the nominated modules. llvm-svn: 233323
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-6/+5
Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
2015-03-13When building a module, all headers of submodules can be used.Daniel Jasper1-1/+2
This extends r232159. llvm-svn: 232168
2015-03-13Make a module "use" also count as use of all its submodulesDaniel Jasper1-3/+5
llvm-svn: 232159
2015-03-10[modules] This check is run before we resolve the header, not after, so justRichard Smith1-21/+14
check that private headers are in a list matching the role. (We can't perform the opposite checks for non-private headers because we infer those.) llvm-svn: 231728
2015-03-09[modules] Don't assert if the same header is named as both a public and aRichard Smith1-9/+18
private header within the same module. llvm-svn: 231725
2015-02-19Allow errors on use of a private module header to be disabled, to better ↵Richard Smith1-3/+3
support incremental transition to modules. llvm-svn: 229788
2015-02-14[modules] Accept //-style comments in module maps on purpose rather than byRichard Smith1-1/+3
accident, and accept them even when they begin '//*'. llvm-svn: 229240
2015-02-13[modules] If we have a choice between including a file textually and importingRichard Smith1-2/+17
a prebuilt form from a module, prefer the modular form, all else being equal. llvm-svn: 229188
2015-01-13Inherit attributes when infering a framework moduleBen Langmuir1-24/+23
If a module map contains framework module * [extern_c] {} We will now infer [extern_c] on the inferred framework modules (we already inferred [system] as a special case). llvm-svn: 225803
2015-01-13Remove unused method canInferFrameworkModuleBen Langmuir1-24/+0
llvm-svn: 225801
2014-12-10Reinstate r223753, reverted in r223759 due to breakage of clang-tools-extra.Richard Smith1-15/+11
Original commit message: [modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1. For files named by -fmodule-map-file=, and files found by 'extern module' directives, this flag specifies that we should resolve filenames relative to the current working directory rather than relative to the directory in which the module map file resides. This is aimed at fixing path handling, in particular for relative -I paths, when building modules that represent components of the current project (rather than libraries installed on the current system, which the current project has as dependencies, where we'd typically expect the module map files to be looked up implicitly). llvm-svn: 223913
2014-12-09Revert "[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1."Duncan P. N. Exon Smith1-11/+15
This reverts commit r223753. It broke the Green Dragon build for a few hours: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/ http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/2259/consoleFull#43901905849ba4694-19c4-4d7e-bec5-911270d8a58c I suspect `clang-tools-extra` just needs a follow-up for an API change, but I'm not the right one to look into it. llvm-svn: 223759
2014-12-09[modules] Add experimental -fmodule-map-file-home-is-cwd flag to -cc1.Richard Smith1-15/+11
For files named by -fmodule-map-file=, and files found by 'extern module' directives, this flag specifies that we should resolve filenames relative to the current working directory rather than relative to the directory in which the module map file resides. This is aimed at fixing path handling, in particular for relative -I paths, when building modules that represent components of the current project (rather than libraries installed on the current system, which the current project has as dependencies, where we'd typically expect the module map files to be looked up implicitly). llvm-svn: 223753
2014-12-02Try to fix the MSVC build.Hans Wennborg1-8/+8
llvm-svn: 223105
2014-12-02[modules] Track how 'header' directives were written in module map files,Richard Smith1-46/+63
rather than trying to extract this information from the FileEntry after the fact. This has a number of beneficial effects. For instance, diagnostic messages for failed module builds give a path relative to the "module root" rather than an absolute file path, and the contents of the module includes file is no longer dependent on what files the including TU happened to inspect prior to triggering the module build. llvm-svn: 223095
2014-10-26ModuleMap.cpp: fix Windows build, take 2Hans Wennborg1-2/+3
llvm-svn: 220646
2014-10-26ModuleMap.cpp: fix VS2012 buildHans Wennborg1-2/+3
llvm-svn: 220644
2014-10-26ModuleMap::addHeader(): Appease msc17.NAKAMURA Takumi1-4/+16
llvm-svn: 220639
2014-10-24[modules] Support combining 'textual' with 'private'.Richard Smith1-73/+59
llvm-svn: 220589
2014-10-23Refactor implementation of 'exclude header'.Richard Smith1-16/+16
This was not a real header role, and was never exposed to clients of ModuleMap. Remove the enumeration value for it and track it as marking the header as 'known' rather than creating an extra KnownHeader entry that *every single* client ignores. llvm-svn: 220460
2014-10-23Fix covered-switch warning.Richard Smith1-0/+1
llvm-svn: 220456
2014-10-22[modules] Add support for 'textual header' directives.Richard Smith1-7/+40
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-20[modules] Add support for #include_next.Richard Smith1-4/+6
#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-08-12Verify all the module map files for a pcm are the same on loadBen Langmuir1-3/+13
We already verified the primary module map file (either the one that defines the top-level module, or the one that allows inferring it if it is an inferred framework module). Now we also verify any other module map files that define submodules, such as when there is a module.private.modulemap file. llvm-svn: 215455
2014-08-09Refactor the module map file used for uniquing a module name out ofBen Langmuir1-16/+30
class Module. It's almost always going to be the same as getContainingModule() for top-level modules, so just add a map to cover the remaining cases. This lets us do less bookkeeping to keep the ModuleMap fields up to date. llvm-svn: 215268
2014-07-14Fix case-sensitivity of inferred framework modulesBen Langmuir1-0/+6
Just because we can open a directory named "COcoa.framework" doesn't mean we should provide a "COcoa" module on a case-insensitive filesystem. llvm-svn: 212975
2014-06-26Convert StringLiteralParser constructor to use ArrayRef instead of a pointer ↵Craig Topper1-1/+1
and count. llvm-svn: 211763
2014-06-12Replace llvm::error_code with std::error_code.Rafael Espindola1-1/+1
llvm-svn: 210780
2014-05-17[C++11] Use 'nullptr'. Lex edition.Craig Topper1-40/+39
llvm-svn: 209083
2014-05-17Provide and use a safe Token::getRawIdentifier() accessorAlp Toker1-4/+6
llvm-svn: 209061
2014-05-08Remove -Wnon-modular-includeBen Langmuir1-2/+0
But keep -Wnon-modular-include-in-[framework-]module This warning is too noisy and doesn't really indicate a problem for most people. Even though it would only really affect people using -Weverything, that seems bad so remove it. llvm-svn: 208345
2014-05-05Add -Wnon-modular-include* optionsBen Langmuir1-34/+50
Warn on non-modular includes in various contexts. -Wnon-modular-include -Wnon-modular-include-in-module -Wnon-modular-include-in-framework-module Where each group is a subgroup of those above it. llvm-svn: 208004
2014-04-23Do not print inferred submodules explicitly in __inferred_module.mapBen Langmuir1-0/+2
Otherwise including a header in your source file that is not included by framework's umbrella header will silently add an empty submodule with that name. is automatically translated to @import Foo.NotInModule; which then would have succeeded because the inferred module map contained an empty submodule called NotInModule. llvm-svn: 207024
2014-04-21Allow submodule inferrences with a missing umbrella when the module is ↵Ben Langmuir1-1/+2
unavailable If the module is unavailable because of a missing header, don't diagnose a "module * {}" declaration for having a missing umbrella. llvm-svn: 206776
2014-04-18Don't build modules with (submodules with) missing headersBen Langmuir1-2/+10
Unless they are in submodules that aren't available anyway, due to requirements not being met. Also, mark children as unavailable when the parent is. llvm-svn: 206664
2014-04-18Add more constness to module-related APIsDmitri Gribenko1-2/+3
llvm-svn: 206595
2014-04-16Fixed problem with exclude header. The exclude header argument needs to be ↵John Thompson1-22/+0
relative to the module.map file. llvm-svn: 206342
2014-04-14Allow multiple modules with the same name to coexist in the module cacheBen Langmuir1-15/+30
To differentiate between two modules with the same name, we will consider the path the module map file that they are defined by* part of the ‘key’ for looking up the precompiled module (pcm file). Specifically, this patch renames the precompiled module (pcm) files from cache-path/<module hash>/Foo.pcm to cache-path/<module hash>/Foo-<hash of module map path>.pcm In addition, I’ve taught the ASTReader to re-resolve the names of imported modules during module loading so that if the header search context changes between when a module was originally built and when it is loaded we can rebuild it if necessary. For example, if module A imports module B first time: clang -I /path/to/A -I /path/to/B ... second time: clang -I /path/to/A -I /different/path/to/B ... will now rebuild A as expected. * in the case of inferred modules, we use the module map file that allowed the inference, not the __inferred_module.map file, since the inferred file path is the same for every inferred module. llvm-svn: 206201
2014-04-11Add -fmodules-strict-decluse to check that all headers are in modulesDaniel Jasper1-1/+5
Review: http://reviews.llvm.org/D3335 llvm-svn: 206027
2014-04-10Move search for header in umbrella directories into its own functionBen Langmuir1-75/+83
No functional change intended. llvm-svn: 205942
2014-04-08If a header is explicitly included in module A, and excluded from an umbrellaRichard Smith1-6/+17
directory in module B, don't include it in module B! llvm-svn: 205762
2014-03-19Add a new spelling for module map files 'module.modulemap'Ben Langmuir1-4/+15
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-12Only allow streaming exactly type 'bool' to a DiagnosticBuilder, not anythingRichard Smith1-1/+2
that implicitly converts to 'bool' (such as pointers, and the first operand of ?:). Clean up issues found by this. Patch by Stephan Tolksdorf! llvm-svn: 203735
2014-03-07Add dependencies from imported modules with -MDBen Langmuir1-1/+2
Add module dependencies to the dependency files created by -MD/-MMD/etc. by attaching an ASTReaderListener that will call into the dependency file generator when a module input file is seen in the serialized AST. llvm-svn: 203208
2014-03-06Remove a dead store, add a FIXME for another.Richard Smith1-0/+1
llvm-svn: 203169
2014-03-05If a #include finds a file relative to the current file, don't forget to checkRichard Smith1-0/+2
whether it's part of a module. llvm-svn: 203005