aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/HeaderSearch.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-04-27Remove unused LangOpts private variable in HeaderSearch.Samuel Antao1-2/+1
Was causing warnings during the build. llvm-svn: 267805
2016-04-27[modules] When diagnosing a missing module import, suggest adding a #include ifRichard Smith1-0/+51
the current language doesn't have an import syntax and we can figure out a suitable file to include. llvm-svn: 267802
2016-02-01Move LocInfoType from Sema to AST.Benjamin Kramer1-1/+0
While transient and only used during parsing, LocInfoTypes are still used from ASTDumper and are part of the AST. llvm-svn: 259376
2016-01-12Module debugging: Make the module format part of the module hash insteadAdrian Prantl1-2/+1
of the file name. This is consistent with how other HeaderSearchOptions are handled. Due to the other inputs of the module hash (revision number) this is not really testable in a meaningful way. llvm-svn: 257520
2015-10-20Add back null check removed accidentally in r250554Reid Kleckner1-0/+2
Fixes PR25262 llvm-svn: 250844
2015-10-20Roll-back r250822.Angel Garcia Gomez1-1/+1
Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
2015-10-20Apply modernize-use-default to clang.Angel Garcia Gomez1-1/+1
Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
2015-10-16Refactor module lookup when looking up a header file, and wire through the ↵Richard Smith1-85/+83
requesting module. No functionality change. llvm-svn: 250554
2015-08-27Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1Adrian Prantl1-1/+1
to enable the use of external type references in the debug info (a.k.a. module debugging). The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs" and passes that to cc1. All this does at the moment is set a flag codegenopts. http://reviews.llvm.org/D11958 llvm-svn: 246192
2015-08-24[modules] Remove unnecessary deserialization of fully-external ↵Richard Smith1-28/+56
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-33/+40
modules for a header, not just the current favourite. llvm-svn: 245390
2015-08-15[modules] Stop dropping 'module.timestamp' files into the current directoryRichard Smith1-2/+2
when building with implicit modules disabled. llvm-svn: 245136
2015-07-21[modules] Produce an error if -cc1 wants to implicitly build a module and noRichard Smith1-2/+3
module cache has been provided, rather than creating one in the current directory. llvm-svn: 242819
2015-07-17Make the clang module container format selectable from the command line.Adrian Prantl1-1/+3
- introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
2015-07-10[modules] When checking the include guard for a header, check whether it'sRichard Smith1-8/+10
visible in the module we're considering entering. Previously we assumed that if we knew the include guard for a modular header, we'd already parsed it, but that need not be the case if a header is present in the current module and one of its dependencies; the result of getting this wrong was that the current module's submodule for the header would end up empty. llvm-svn: 241953
2015-07-02[Modules] Be consistent about finding a module for framework headersBen Langmuir1-10/+12
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-07-01[modules] Before checking whether the controlling macro of a header is defined,Richard Smith1-2/+7
update the identifier in case we've imported a definition of the macro (and thus the contents of the header) from a module. Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer makes sense to keep these separate now that the only user of the former also needs the latter. llvm-svn: 241137
2015-07-01[modules] Make the include guard optimization fire a bit more when consideringRichard Smith1-2/+6
re-entering a modular header. When we do the include guard check, we're in the visibility state for the file with the #include; the include guard may not be visible there, but we don't actually need it to be: if we've already parsed the submodule we're considering entering, it's always safe to skip it. llvm-svn: 241135
2015-06-16[modules] Simplify -cc1 interface for enabling implicit module maps.Richard Smith1-7/+7
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-05-18[modules] If we see a #include that maps to a module, but use of precompiled ↵Richard Smith1-2/+8
modules is disabled, track submodule visibility anyway if -fmodules-local-submodule-visibility is enabled. This, in effect, gives modules semantics but without precompilation. llvm-svn: 237550
2015-05-08Revert "Fix path separator issue on Windows."Nikola Smiljanic1-1/+3
This reverts commit 9242ff16b0460b488691fd70b42a2bf81a531e3a. llvm-svn: 236806
2015-05-08Fix path separator issue on Windows.Nikola Smiljanic1-3/+1
llvm-svn: 236804
2015-04-29[modules] Stop trying to fake up a linear MacroDirective history.Richard Smith1-2/+5
Modules builds fundamentally have a non-linear macro history. In the interest of better source fidelity, represent the macro definition information faithfully: we have a linear macro directive history within each module, and at any point we have a unique "latest" local macro directive and a collection of visible imported directives. This also removes the attendent complexity of attempting to create a correct MacroDirective history (which we got wrong in the general case). No functionality change intended. llvm-svn: 236176
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-12/+12
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-02-24Don't load Framework module.map files when searching subdirectoriesBen Langmuir1-2/+4
This would cause frameworks to have spurious "redefinition" errors if they had both a (legacy) "module.map" and a (new) "module.modulemap" file and we happened to do a sub-directory search in that directory using a non-framework include path (e.g. -Ifoo/ -Ffoo/). For migration purposes it's very handy that the compiler will prefer the new spelling of the filename and not look at the old one if it doesn't need to. llvm-svn: 230308
2015-02-19Revert "Mangle the IsSystem bit into the .pcm file name"Ben Langmuir1-8/+2
While I investigate some possible problems with this patch. This reverts commit r228966 llvm-svn: 229910
2015-02-12Mangle the IsSystem bit into the .pcm file nameBen Langmuir1-2/+8
When mangling the module map path into a .pcm file name, also mangle the IsSystem bit, which can also depend on the header search paths. For example, the user may change from -I to -isystem. This can affect diagnostics in the importing TU. llvm-svn: 228966
2014-12-11[modules] When constructing paths relative to a module, strip out /./ directoryRichard Smith1-9/+17
components. These sometimes get synthetically added, and we don't want -Ifoo and -I./foo to be treated fundamentally differently here. llvm-svn: 224055
2014-12-10Reinstate r223753, reverted in r223759 due to breakage of clang-tools-extra.Richard Smith1-11/+29
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-29/+11
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-11/+29
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-06PR21217: Slightly more eagerly load -fmodule-map-file= files and provideRichard Smith1-12/+0
diagnostics if they don't exist. Based on a patch by John Thompson! llvm-svn: 223561
2014-12-06Additional safety for the root cause of regression in r223443; make the moduleRichard Smith1-0/+1
map path more canonical before hashing it. No functionality change. llvm-svn: 223547
2014-12-02[modules] Track how 'header' directives were written in module map files,Richard Smith1-3/+14
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-11-25Add flag -f(no-)modules-implicit-maps.Daniel Jasper1-44/+58
This suppresses the implicit search for files called 'module.modulemap' and similar. llvm-svn: 222745
2014-11-19clang-format a recent commit I madeDavid Blaikie1-1/+1
llvm-svn: 222317
2014-11-19Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie1-15/+13
llvm-svn: 222306
2014-10-17PR21215: Support -fmodule-map-file being specified multiple times. SupportRichard Smith1-9/+11
loading multiple module map files from the same directory. llvm-svn: 220020
2014-10-17Switch to range-based for loop. No functionality change.Richard Smith1-9/+3
llvm-svn: 220014
2014-08-12Correctly implement -include search logic.Manuel Klimek1-36/+14
According to the gcc docs, -include uses the current working directory for the lookup instead of the main source file. This patch gets rid of NormalizeIncludePath (which relied on an implementation detail of FileManager / FileEntry for the include path logic to work), and instead hands the correct lookup information down to LookupFile. This will allow us to change the FileEntry's behavior regarding its Name caching. llvm-svn: 215433
2014-08-09Refactor the module map file used for uniquing a module name out ofBen Langmuir1-1/+3
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-06-15Hide the concept of diagnostic levels from lex, parse and semaAlp Toker1-3/+1
The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. llvm-svn: 211005
2014-06-12Replace llvm::error_code with std::error_code.Rafael Espindola1-3/+3
llvm-svn: 210780
2014-05-17[C++11] Use 'nullptr'. Lex edition.Craig Topper1-40/+40
llvm-svn: 209083
2014-05-15Use the virtual name of headers when searching for a moduleBen Langmuir1-6/+6
When using the VFS, we want the virtual header location when searching for a framework module, since that will be the one in the correct directory structure for the module. I'll add a regression test once I finish reducing the larger one I have. llvm-svn: 208901
2014-04-14Allow multiple modules with the same name to coexist in the module cacheBen Langmuir1-12/+23
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-03-29[HeaderSearch] Make sure we clear the mapped name from the ↵Argyrios Kyrtzidis1-1/+1
LookupFileCacheInfo when we reset the start point. rdar://16462455 llvm-svn: 205071
2014-03-20Prevent lookup of subframework modules by name without parent frameworkBen Langmuir1-24/+3
We were 'allowing' the following import @import Sub; where Sub is a subframework of Foo and we had a -F path inside Foo.framework/Frameworks and no module map file for Sub. This would later hit assertion failures in debug builds. Now we should correctly diagnose this as a module not found error. llvm-svn: 204368
2014-03-20Silencing an MSVC warning about not all control paths returning a value. No ↵Aaron Ballman1-0/+1
functional change intended. llvm-svn: 204345
2014-03-19Add a new spelling for module map files 'module.modulemap'Ben Langmuir1-63/+91
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