aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-11-13Fix auto-link for text-based dynamic library SDKs.Juergen Ributzka1-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 llvm-svn: 253060
2015-11-05Allow use of private headers in different sub-modules.Manuel Klimek1-10/+3
llvm-svn: 252170
2015-08-24[modules] Remove unnecessary deserialization of fully-external ↵Richard Smith1-2/+7
HeaderFileInfos for all files we've seen in this compilation. llvm-svn: 245881
2015-08-18[modules] Fix HeaderFileInfo serialization to store all the known owning ↵Richard Smith1-14/+31
modules for a header, not just the current favourite. llvm-svn: 245390
2015-08-17[modules] PR20507: Avoid silent textual inclusion.Sean Silva1-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 llvm-svn: 245228
2015-08-13Attempt to fix build after r244912Ben Langmuir1-4/+7
Some compilers were less happy about converting a lambda to a comparator function for array_pod_sort. llvm-svn: 244917
2015-08-13[Modules] Add Darwin-specific compatibility module map parsing hacksBen Langmuir1-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. llvm-svn: 244912
2015-08-09[modules] When building a dependency file, include module maps parsed in theRichard Smith1-0/+5
current compilation, not just those from imported modules. llvm-svn: 244413
2015-07-14[modules] When diagnosing errors in module map files found by 'extern ↵Richard Smith1-4/+5
module' declarations, show how we got to that module map file. llvm-svn: 242105
2015-07-10[modules] Fix "prefer own module over others" rule when selecting a module ↵Richard Smith1-1/+1
for a header to work in the presence of module hierarchy. llvm-svn: 241936
2015-07-02[Modules] Be consistent about finding a module for framework headersBen Langmuir1-26/+18
We use findModuleForHeader() in several places, but in header search we were not calling it when a framework module didn't show up with the expected name, which would then lead to unexpected non-modular includes. Now we will find the module unconditionally for frameworks. For regular frameworks, we use the spelling of the module name from the module map file, and for inferred ones we use the canonical directory name. In the future we might want to lock down framework modules sufficiently that these name mismatches cannot happen. rdar://problem/20465870 llvm-svn: 241258
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-2/+2
llvm-svn: 240353
2015-06-22[modules] When building a module, if there are multiple matches for a headerRichard Smith1-0/+3
file in the loaded module maps and one of them is from the current module, that's the right match. llvm-svn: 240350
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-2/+2
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-16[modules] Simplify -cc1 interface for enabling implicit module maps.Richard Smith1-1/+5
We used to have a flag to enable module maps, and two more flags to enable implicit module maps. This is all redundant; we don't need any flag for enabling module maps in the abstract, and we don't usually have -fno- flags for -cc1. We now have just a single flag, -fimplicit-module-maps, that enables implicitly searching the file system for module map files and loading them. The driver interface is unchanged for now. We should probably rename -fmodule-maps to -fimplicit-module-maps at some point. llvm-svn: 239789
2015-06-10[cleanup] Remove unused default argument and tidy up.Sean Silva1-24/+6
The RequestingModule argument was unused and always its default value of nullptr. Also move a declaration closer to its use, and range-for'ify. llvm-svn: 239453
2015-06-04Remove unused defaulted argument `IncludeTextualHeaders`.Sean Silva1-3/+2
llvm-svn: 239123
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