summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/HeaderSearch.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [HeaderSearch] Fix issue where if a headermap entry maps the filename to a ↵Argyrios Kyrtzidis2014-03-111-10/+28
| | | | | | | | | | framework import (non-absolute path) then we fail to find it if it is re-included later on. rdar://16285490 llvm-svn: 203542
* Fix use-after-free detected by ASan bootstrap.Richard Smith2014-03-061-2/+7
| | | | llvm-svn: 203140
* If a #include finds a file relative to the current file, don't forget to checkRichard Smith2014-03-051-24/+53
| | | | | | whether it's part of a module. llvm-svn: 203005
* Fix false positives in -Wmsvc-include by continuing header searchReid Kleckner2014-02-181-9/+44
| | | | | | | | | | | This makes Clang and LLVM -Wmsvc-include clean. I believe the correct behavior here is to avoid updating the cache when we find the header via MSVC's search rules. Differential Revision: http://llvm-reviews.chandlerc.com/D2733 llvm-svn: 201615
* If the headermap maps the filename to a framework include ("Foo.h" -> ↵Argyrios Kyrtzidis2014-02-141-5/+28
| | | | | | | | | | | | | | "Foo/Foo.h"), continue header lookup using the framework include as filename. This allows us to conveniently treat #import "Foo.h" as an implicit module import if we can resolve "Foo/Foo.h" as such. rdar://16042979 llvm-svn: 201419
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Silence compile warning by removing unused SourceMgr memberWill Wilson2013-12-271-3/+2
| | | | llvm-svn: 198083
* Implement MSVC header search algorithm in MicrosoftMode.Will Wilson2013-12-271-59/+63
| | | | | | Follows algorithm described here: http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx llvm-svn: 198082
* Fix comment typo.Will Wilson2013-12-191-1/+1
| | | | llvm-svn: 197695
* Modules: Don't warn upon missing headers while reading the module map.Daniel Jasper2013-12-171-1/+1
| | | | | | | | | | | | | | | Instead, mark the module as unavailable so that clang errors as soon as someone tries to build this module. This works towards the long-term goal of not stat'ing the header files at all while reading the module map and instead read them only when the module is being built (there is a corresponding FIXME in parseHeaderDecl()). However, it seems non-trivial to get there and this unblock us and moves us into the right direction. Also changed the implementation to reuse the same DiagnosticsEngine. llvm-svn: 197485
* Revert "Modules: Make missing headers in a module.map a warning not an error."Daniel Jasper2013-12-161-1/+1
| | | | | | This was committed accidentally. llvm-svn: 197389
* Modules: Make missing headers in a module.map a warning not an error.Daniel Jasper2013-12-161-1/+1
| | | | | | | | | | | | | | | | Instead, mark the module as unavailable so that clang errors as soon as someone tries to build this module. A better long-term strategy might be to not stat the header files at all while reading the module map and instead read them only when the module is being built (there is a corresponding FIXME in parseHeaderDecl()). However, it seems non-trivial to get there and this would be a temporary solution to unblock us. Also changed the implementation to reuse the same DiagnosticsEngine as otherwise warnings can't be enabled or disabled with command-line flags. llvm-svn: 197388
* [Modules] Don't parse any module map if modules are disabled.Argyrios Kyrtzidis2013-12-121-0/+5
| | | | | | Fixes rdar://15644663. llvm-svn: 197165
* Revert r196859, "Use llvm::sys::path::append to concatenate paths", to ↵NAKAMURA Takumi2013-12-101-2/+5
| | | | | | appease FileManager. llvm-svn: 196865
* Use llvm::sys::path::append to concatenate pathsDmitri Gribenko2013-12-101-5/+2
| | | | llvm-svn: 196859
* Preload module maps in normal user directories, too.Douglas Gregor2013-11-011-3/+2
| | | | | | ... in case someone decides to -I/usr/include <rdar://problem/15235948>. llvm-svn: 193893
* Use the same SourceManager for ModuleMaps and compilations.Manuel Klimek2013-10-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows using virtual file mappings on the original SourceManager to map in virtual module.map files. Without this patch, the ModuleMap search will find a module.map file (as the FileEntry exists in the FileManager), but will be unable to get the content from the SourceManager (as ModuleMap previously created its own SourceManager). Two problems needed to be fixed which this patch exposed: 1. Storing the inferred module map When writing out a module, the ASTWriter stores the names of the files in the main source manager; when loading the AST again, the ASTReader errs out if such a file is found missing, unless it is overridden. Previously CompilerInstance's compileModule method would store the inferred module map to a temporary file; the problem with this approach is that now that the module map is handled by the main source manager, the ASTWriter stores the name of the temporary module map as source to the compilation; later, when the module is loaded, the temporary file has already been deleted, which leads to a compilation error. This patch changes the inferred module map to instead inject a virtual file into the source manager. This both saves some disk IO, and works with how the ASTWriter/ASTReader handle overridden source files. 2. Changing test input in test/Modules/Inputs/* Now that the module map file is handled by the main source manager, the VerifyDiagnosticConsumer will not ignore diagnostics created while parsing the module map file. The module test test/Modules/renamed.m uses -I test/Modules/Inputs and triggers recursive loading of all module maps in test/Modules/Inputs, some of which had conflicting names, thus leading errors while parsing the module maps. Those diagnostics already occur on trunk, but before this patch they would not break the test, as they were ignored by the VerifyDiagnosticConsumer. This patch thus changes the module maps that have been recently introduced which broke the invariant of compatible modules maps in test/Modules/Inputs. llvm-svn: 193314
* Allow a header to be part of multiple modules.Daniel Jasper2013-10-221-32/+29
| | | | | | | | | | | | | | | | | | | | This patch changes two things: a) Allow a header to be part of multiple modules. The reasoning is that in existing codebases that have a module-like build system, the same headers might be used in several build targets. Simple reasons might be that they defined different classes that are declared in the same header. Supporting a header as a part of multiple modules will make the transistion easier for those cases. A later step in clang can then determine whether the two modules are actually compatible and can be merged and error out appropriately. The later check is similar to what needs to be done for template specializations anyway. b) Allow modules to be stored in a directory tree separate from the headers they describe. Review: http://llvm-reviews.chandlerc.com/D1951 llvm-svn: 193151
* Add -fmodule-map-file option.Daniel Jasper2013-09-241-7/+29
| | | | | | | | | | | | | | | 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. llvm-svn: 191284
* Module use declarations (II)Daniel Jasper2013-09-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 191283
* [Modules] If a module map resides in a system header directory, treat it as ↵Douglas Gregor2013-06-211-19/+24
| | | | | | | | | a system module. This prevents -pedantic from causing warnings in the system headers used to create modules. Fixes <rdar://problem/14201171>. llvm-svn: 184560
* This patch adds new private headers to the module map. PrivateLawrence Crowl2013-06-201-10/+10
| | | | | | | headers may be included from within the module, but not from outside the module. llvm-svn: 184471
* [Modules] Make r180934 more efficient by only loading top-level module maps ↵Douglas Gregor2013-05-101-0/+14
| | | | | | in system header directories. llvm-svn: 181643
* [PCH] Remove the ASTReaderListener::ReadHeaderFileInfo callback.Argyrios Kyrtzidis2013-05-081-7/+0
| | | | | | | | This made sense in pre-module era, before merging of HeaderFileInfos was introduced. Final part of rdar://13840148. llvm-svn: 181490
* [modules] When building a module, make sure we don't serialize out ↵Argyrios Kyrtzidis2013-05-081-1/+3
| | | | | | | | | | | HeaderFileInfo for headers not belonging to the module. After r180934 we may initiate module map parsing for modules not related to the module what we are building, make sure we ignore the header file info of headers from such modules. First part of rdar://13840148 llvm-svn: 181489
* <rdar://problem/13037793> Allow the names of modules to differ from the name ↵Douglas Gregor2013-03-211-8/+31
| | | | | | of their subdirectory in the include path. llvm-svn: 177621
* [Modules] Don't eagerly load and associate all the module header files.Argyrios Kyrtzidis2013-03-131-2/+16
| | | | | | | | | | | | | | In a module-enabled Cocoa PCH file, we spend a lot of time stat'ing the headers in order to associate the FileEntries with their modules and support implicit module import. Use a more lazy scheme by enhancing HeaderInfoTable to store extra info about the module that a header belongs to, and associate it with its module only when there is a request for loading the header info for a particular file. Part of rdar://13391765 llvm-svn: 176976
* Remove unused static variable.Douglas Gregor2013-03-051-4/+0
| | | | llvm-svn: 176535
* Teach subframework header lookup to suggest modules <rdar://problem/13176200>.Douglas Gregor2013-02-081-1/+22
| | | | llvm-svn: 174683
* <limits.h> includes <linux/limits.h> on Linux, no need to special-case itDmitri Gribenko2013-01-261-3/+1
| | | | llvm-svn: 173578
* Since we're stuck with realpath for the header <-> module mapping,Douglas Gregor2013-01-261-6/+5
| | | | | | | | factor the realpath calls into FileManager::getCanonicalName() so we can cache the results of this epically slow operation. 5% speedup on my modules test, and realpath drops out of the profile. llvm-svn: 173542
* Fix compilation on Linux, which defines PATH_MAX in a weird place,Douglas Gregor2013-01-221-0/+5
| | | | | | from Saleem Abdulrasool! llvm-svn: 173208
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-4/+4
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Rework the realpath nonsense for framework lookups to deal moreDouglas Gregor2013-01-101-97/+117
| | | | | | uniformly with symlinks between top-level and embedded frameworks. llvm-svn: 172030
* Return true from HeaderSearch::isFileMultipleIncludeGuarded if the fileArgyrios Kyrtzidis2012-12-101-1/+2
| | | | | | was #import'ed. llvm-svn: 169761
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-5/+5
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Introduce inferred framework modules into the module map file,Douglas Gregor2012-11-061-1/+27
| | | | | | | | | | | | | | allowing a module map to be placed one level above the '.framework' directories to specify that all .frameworks within that directory can be inferred as framework modules. One can also specifically exclude frameworks known not to work. This makes explicit (and more restricted) behavior modules have had "forever", where *any* .framework was assumed to be able to be built as a module. That's not necessarily true, so we white-list directories (with exclusions) when those directories have been audited. llvm-svn: 167482
* Move HeaderSearchOptions into the Lex library, make it intrusivelyDouglas Gregor2012-10-241-2/+4
| | | | | | reference-counted, and hold a reference to it in HeaderSearch. llvm-svn: 166583
* Under certain terrible circumstances (<rdar://problem/10805775>),Douglas Gregor2012-09-251-0/+13
| | | | | | | | | top-level frameworks can actually be symlinked over to embedded frameworks, and accessed via the top-level framework's headers. In this case, we need to determine that the framework was *actually* an embedded framework, so we can load the appropriate top-level module. llvm-svn: 164620
* Remove an unused private field exposed by the recent LLVM_DELETED_FUNCTION ↵Craig Topper2012-09-181-1/+1
| | | | | | changes. llvm-svn: 164103
* When the header file search resolves a quoted include to a file in theDouglas Gregor2012-08-131-5/+13
| | | | | | | | | | | current directory, propagate the framework and in-index-header-map from the including header's information down to the included header's information. Fixes <rdar://problem/11261291>. As with everything header-map related, we can't really test this in isolation within Clang, so it's tested elsewhere. llvm-svn: 161759
* Fix a typo (the the => the)Sylvestre Ledru2012-07-231-1/+1
| | | | llvm-svn: 160622
* Documentation cleanup:James Dennett2012-06-201-8/+4
| | | | | | | | * Escaped # and < characters in Doxygen comments as needed; * Removed a Doxygen comment in HeaderSearch.cpp that was redundant with the corresponding comment in the header file. llvm-svn: 158776
* Rename a loop variable to silence a gcc warning.Richard Trieu2012-06-131-3/+3
| | | | llvm-svn: 158420
* Add -isystem-prefix and -ino-system-prefix arguments, which can be used toRichard Smith2012-06-131-0/+10
| | | | | | | | | | override whether headers are system headers by checking for prefixes of the header name specified in the #include directive. This allows warnings to be disabled for third-party code which is found in specific subdirectories of include paths. llvm-svn: 158418
* [Lex] Add support for 'user specified system frameworks' (see test case).Daniel Dunbar2012-04-051-7/+30
| | | | | | - Developers of system frameworks need a way for their framework to be treated as a "system framework" during development. Otherwise, they are unable to properly test how their framework behaves when installed because of the semantic changes (in warning behavior) applied to system frameworks. llvm-svn: 154105
* [Lex] HeaderSearch: Introduce a FrameworkCacheEntry structure to hold the ↵Daniel Dunbar2012-04-051-13/+11
| | | | | | | | FrameworkMap items. - No functionality change. llvm-svn: 154104
* Simplify.Daniel Dunbar2012-04-051-2/+1
| | | | llvm-svn: 154103
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-15/+15
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Thread a TargetInfo through to the module map; we'll need it forDouglas Gregor2012-01-301-2/+7
| | | | | | target-specific module requirements. llvm-svn: 149224
OpenPOWER on IntegriCloud