summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unused IncrProcessing parameter from Preprocessor ctorAlp Toker2014-05-021-1/+0
| | | | | | | Preprocessor::enableIncrementalProcessing() provides a consistent interface to enable the feature. llvm-svn: 207824
* [cleanup] Fix an 80-column violationJustin Bogner2014-04-281-1/+2
| | | | llvm-svn: 207446
* Quick fix for layering that broke shared library build.John Thompson2014-04-231-0/+26
| | | | llvm-svn: 207011
* Fix unused variable.John Thompson2014-04-231-1/+1
| | | | llvm-svn: 206981
* Initial implementation of -modules-earch-all option, for searching for ↵John Thompson2014-04-231-38/+101
| | | | | | symbols in non-imported modules. llvm-svn: 206977
* Allow multiple modules with the same name to coexist in the module cacheBen Langmuir2014-04-141-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Frontend] If the module file lock owner have died, try to get the lock ↵Argyrios Kyrtzidis2014-04-061-22/+33
| | | | | | again. Needs llvm r205683. llvm-svn: 205684
* Add an option -fmodules-validate-system-headersBen Langmuir2014-03-121-3/+6
| | | | | | | | When enabled, always validate the system headers when loading a module. The end result of this is that when these headers change, we will notice and rebuild the module. llvm-svn: 203630
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-4/+4
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-6/+5
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* [Preprocessor] Pass TranslationUnitKind to the preprocessor and if it is ↵Argyrios Kyrtzidis2014-03-071-2/+5
| | | | | | | | | | TU_Prefix avoid warning for unused macros. rdar://15034698 llvm-svn: 203213
* Add dependencies from imported modules with -MDBen Langmuir2014-03-071-1/+5
| | | | | | | | 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
* [C++11] Simplify a callback to use a lambda.Richard Smith2014-03-041-18/+2
| | | | llvm-svn: 202897
* [C++11] Replace verbose functors with succinct lambdasBenjamin Kramer2014-03-011-21/+7
| | | | | | No functionality change. llvm-svn: 202590
* Reapply fixed "Honour 'use-external-names' in FileManager"Ben Langmuir2014-02-281-1/+1
| | | | | | | | | | | | | | | | Was r202442 There were two issues with the original patch that have now been fixed. 1. We were memset'ing over a FileEntry in a test case. After adding a std::string to FileEntry, this still happened to not break for me. 2. I didn't pass the FileManager into the new compiler instance in compileModule. This was hidden in some cases by the fact I didn't clear the module cache in the test. Also, I changed the copy constructor for FileEntry, which was memcpy'ing in a (now) unsafe way. llvm-svn: 202539
* [ASTUnit] Fix use-after-free bug in ↵Argyrios Kyrtzidis2014-02-271-7/+12
| | | | | | | | | | | | | | | ASTUnit::getMainBufferWithPrecompiledPreamble(). With r197755 we started reading the contents of buffer file entries, but the buffers may point to ASTReader blobs that have been disposed. Fix this by having the CompilerInstance object keep a reference to the ASTReader as well as having the ASTContext keep reference to the ExternalASTSource. This was very difficult to construct a test case for. rdar://16149782 llvm-svn: 202346
* Update for llvm api change.Rafael Espindola2014-02-241-6/+6
| | | | llvm-svn: 202053
* Recommit virtual file systemBen Langmuir2014-02-201-1/+11
| | | | | | | | | | | Previously reverted in r201755 due to causing an assertion failure. I've removed the offending assertion, and taught the CompilerInstance to create a default virtual file system inside createFileManager. In the future, we should be able to reach into the CompilerInvocation to customize this behaviour without breaking clients that don't care. llvm-svn: 201818
* Reverting the virtual file system implementation, because it triggers an ↵Juergen Ributzka2014-02-201-8/+1
| | | | | | | | | | assertion in our internal build bots. This reverts commits 201618, 201635, 201636, 201639, 201685, 201691, and 201696. llvm-svn: 201755
* Pass VFS from CompilerInstance to FileManagerBen Langmuir2014-02-191-1/+1
| | | | | | This change was somehow missed from r201618 llvm-svn: 201636
* Initial implementation of virtual file systemBen Langmuir2014-02-191-0/+7
| | | | | | | | | | | | This adds the minimum virtual file system support to start migrating FileManager onto the VFS. Originally discussed here: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html Differential Revision: http://llvm-reviews.chandlerc.com/D2745 llvm-svn: 201618
* Add an option to allow Clang verify source files for a module only once duringDmitri Gribenko2014-02-121-14/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the build When Clang loads the module, it verifies the user source files that the module was built from. If any file was changed, the module is rebuilt. There are two problems with this: 1. correctness: we don't verify system files (there are too many of them, and stat'ing all of them would take a lot of time); 2. performance: the same module file is verified again and again during a single build. This change allows the build system to optimize source file verification. The idea is based on the fact that while the project is being built, the source files don't change. This allows us to verify the module only once during a single build session. The build system passes a flag, -fbuild-session-timestamp=, to inform Clang of the time when the build started. The build system also requests to enable this feature by passing -fmodules-validate-once-per-build-session. If these flags are not passed, the behavior is not changed. When Clang verifies the module the first time, it writes out a timestamp file. Then, when Clang loads the module the second time, it finds a timestamp file, so it can compare the verification timestamp of the module with the time when the build started. If the verification timestamp is too old, the module is verified again, and the timestamp file is updated. llvm-svn: 201224
* Stat system dependencies when using -verify-pchBen Langmuir2014-02-071-7/+4
| | | | | | | | We don't stat the system headers to check for stalenes during regular PCH loading for performance reasons. When explicitly saying -verify-pch, we want to check all the dependencies - user or system. llvm-svn: 200979
* Add a CC1 option -verify-pchBen Langmuir2014-02-051-1/+8
| | | | | | | | | This option will: - load the given pch file - verify it is not out of date by stat'ing dependencies, and - return 0 on success and non-zero on error llvm-svn: 200884
* Require a module.map file to load a moduleBen Langmuir2014-01-221-23/+10
| | | | | | | | Removes some old code that allowed a module to be loaded from a pcm file even if the module.map could not be found. Also update a number of tests that relied on the old behavior. llvm-svn: 199852
* Use the simpler version of llvm::sys::fs::remove when possible.Rafael Espindola2014-01-101-8/+4
| | | | llvm-svn: 198957
* Modules: Don't warn upon missing headers while reading the module map.Daniel Jasper2013-12-171-5/+13
| | | | | | | | | | | | | | | 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
* Allow a new syntax in a module requires-declaration:Richard Smith2013-10-281-3/+3
| | | | | | | | | | | | requires ! feature The purpose of this is to allow (for instance) the module map for /usr/include to exclude <tgmath.h> and <complex.h> when building in C++ (these headers are instead provided by the C++ standard library in this case, and the glibc C <tgmath.h> header would otherwise try to include <complex.h>, resulting in a module cycle). llvm-svn: 193549
* Use the same SourceManager for ModuleMaps and compilations.Manuel Klimek2013-10-241-26/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix crash if a submodule @imports another submodule from the same module. TheRichard Smith2013-10-181-6/+6
| | | | | | | test also adds FIXMEs for a number of places where imports and includes of submodules don't work very well. llvm-svn: 193005
* Fix potential race in module building code.Eli Friedman2013-09-171-8/+2
| | | | | | | | | Let the module building code handle the case of overwriting an existing file itself, so the existing locking infrastructure works correctly. <rdar://problem/14403381> llvm-svn: 190833
* SourceManager intialization tweaks.Benjamin Kramer2013-08-121-13/+14
| | | | | | | | | | - Open files before calling stat on them. - Go through FileManager for getting the buffer of named pipes. It has the necessary plumbing to deal with "volatile" files. - Print the cause when stdin reading fails. The only case I can imagine where this happens is when stdin is wired to a device file, so no test case. llvm-svn: 188178
* clang-cl: Support /showIncludesHans Wennborg2013-08-091-1/+6
| | | | | | | | | | This option prints information about #included files to stderr. Clang could already do it, this patch just teaches the existing code about the /showIncludes style and adds the flag. Differential Revision: http://llvm-reviews.chandlerc.com/D1333 llvm-svn: 188037
* Use the simpler is_directory.Rafael Espindola2013-07-171-2/+1
| | | | llvm-svn: 186487
* Update for llvm API change.Rafael Espindola2013-07-161-8/+8
| | | | llvm-svn: 186448
* Use llvm::sys::fs::createUniqueFile.Rafael Espindola2013-07-051-4/+3
| | | | | | | Include a test that clang now produces output files with permissions matching the umask. llvm-svn: 185727
* Use llvm::sys::fs::createTemporaryFile.Rafael Espindola2013-07-051-6/+2
| | | | llvm-svn: 185717
* We don't need to check for windows' error codes in here.Rafael Espindola2013-07-051-3/+1
| | | | | | | The operator== calls equivalent which calls default_error_condition which handles windows to posix conversion. llvm-svn: 185702
* Update for llvm::sys::fs::unique_file not creating directories.Rafael Espindola2013-06-281-13/+21
| | | | llvm-svn: 185127
* Small improvements to createOutputFile.Rafael Espindola2013-06-271-25/+41
| | | | | | | | * Use a single stat to find out if the file exists and if it is a regular file. * Use early returns when possible. * Add comments explaining why we have each check. llvm-svn: 185091
* Remove PathV1.h from CompilerInstance.cpp.Rafael Espindola2013-06-261-8/+6
| | | | llvm-svn: 184913
* [Modules] If a module map resides in a system header directory, treat it as ↵Douglas Gregor2013-06-211-1/+1
| | | | | | | | | a system module. This prevents -pedantic from causing warnings in the system headers used to create modules. Fixes <rdar://problem/14201171>. llvm-svn: 184560
* Use llvm::sys::fs::can_write.Rafael Espindola2013-06-181-1/+2
| | | | llvm-svn: 184234
* Don't depend on the transitive inclusion of PathV1.h.Rafael Espindola2013-06-131-0/+1
| | | | llvm-svn: 183945
* Use the sys::RemoveFileOnSignal that takes a StringRef.Rafael Espindola2013-06-131-1/+1
| | | | llvm-svn: 183944
* Use the global functions instead of the Program methods.Rafael Espindola2013-06-121-1/+1
| | | | llvm-svn: 183861
* [modules] If we hit a failure while loading a PCH/module, abort parsing ↵Argyrios Kyrtzidis2013-05-241-0/+2
| | | | | | | | | | instead of trying to continue in an invalid state. Also don't let libclang create a PCH with such an error. Fixes rdar://13953768 llvm-svn: 182629
* Remove DiagnosticConsumer::clone(), a bad idea that is now unused.Douglas Gregor2013-05-031-11/+4
| | | | llvm-svn: 181070
* When building a module, forward diagnostics to the outer diagnostic consumer.Douglas Gregor2013-05-031-2/+5
| | | | | | | | | | | | | | | Previously, we would clone the current diagnostic consumer to produce a new diagnostic consumer to use when building a module. The problem here is that we end up losing diagnostics for important diagnostic consumers, such as serialized diagnostics (where we'd end up with two diagnostic consumers writing the same output file). With forwarding, the diagnostics from all of the different modules being built get forwarded to the one serialized-diagnostic consumer and are emitted in a sane way. Fixes <rdar://problem/13663996>. llvm-svn: 181067
* Remove the unused MemoryBuffers, no functionality change.Argyrios Kyrtzidis2013-04-041-8/+0
| | | | llvm-svn: 178780
OpenPOWER on IntegriCloud