summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Never cache the result of a module file lookup.Douglas Gregor2013-02-081-3/+4
| | | | llvm-svn: 174744
* Be a little more permissive with -fmodules-ignore-macro= by removing ↵Douglas Gregor2013-02-071-7/+2
| | | | | | everything after the second '=' if it is there. llvm-svn: 174567
* Introduce -fmodules-ignore-macro=NNN to ignore a macro when building/loading ↵Douglas Gregor2013-02-071-0/+30
| | | | | | | | | | | | | | | | | | | | | modules. The use of this flag enables a modules optimization where a given set of macros can be labeled as "ignored" by the modules system. Definitions of those macros will be completely ignored when building the module hash and will be stripped when actually building modules. The overall effect is that this flag can be used to drastically reduce the number of Eventually, we'll want modules to tell us what set of macros they respond to (the "configuration macros"), and anything not in that set will be excluded. However, that requires a lot of per-module information that must be accurate, whereas this option can be used more readily. Fixes the rest of <rdar://problem/13165109>. llvm-svn: 174560
* Detect when we end up trying to load conflicting module files.Douglas Gregor2013-02-061-3/+18
| | | | | | | | | | | | This can happen when one abuses precompiled headers by passing more -D options when using a precompiled hedaer than when it was built. This is intentionally permitted by precompiled headers (and is exploited by some build environments), but causes problems for modules. First part of <rdar://problem/13165109>, detecting when something when horribly wrong. llvm-svn: 174554
* For ModuleLoader::makeModuleVisible() also pass the source location where theArgyrios Kyrtzidis2013-02-011-4/+6
| | | | | | module import occurred. llvm-svn: 174191
* Don't warn about Unicode characters in -E mode.Jordan Rose2013-01-301-0/+2
| | | | | | | | | | | | | | | People use the C preprocessor for things other than C files. Some of them have Unicode characters. We shouldn't warn about Unicode characters appearing outside of identifiers in this case. There's not currently a way for the preprocessor to tell if it's in -E mode, so I added a new flag, derived from the PreprocessorOutputOptions. This is only used by the Unicode warnings for now, but could conceivably be used by other warnings or even behavioral differences later. <rdar://problem/13107323> llvm-svn: 173881
* Implement the reader of the global module index and wire it into theDouglas Gregor2013-01-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | AST reader. The global module index tracks all of the identifiers known to a set of module files. Lookup of those identifiers looks first in the global module index, which returns the set of module files in which that identifier can be found. The AST reader only needs to look into those module files and any module files not known to the global index (e.g., because they were (re)built after the global index), reducing the number of on-disk hash tables to visit. For an example source I'm looking at, we go from 237844 total identifier lookups into on-disk hash tables down to 126817. Unfortunately, this does not translate into a performance advantage. At best, it's a wash once the global module index has been built, but that's ignore the cost of building the global module index (which is itself fairly large). Profiles show that the global module index code is far less efficient than it should be; optimizing it might give enough of an advantage to justify its continued inclusion. llvm-svn: 173405
* Rename the -cc1 option "-generate-module-index" toDouglas Gregor2013-01-251-8/+21
| | | | | | | "-fmodules-global-index" and expand its behavior to include both the use and generation of the global module index. llvm-svn: 173404
* Implement the writer side of the global module index. Douglas Gregor2013-01-231-1/+9
| | | | | | | | | | | | | | | | | | | | The global module index is a "global" index for all of the module files within a particular subdirectory in the module cache, which keeps track of all of the "interesting" identifiers and selectors known in each of the module files. One can perform a fast lookup in the index to determine which module files will have more information about entities with a particular name/selector. This information can help eliminate redundant lookups into module files (a serious performance problem) and help with creating auto-import/auto-include Fix-Its. The global module index is created or updated at the end of a translation unit that has triggered a (re)build of a module by scraping all of the .pcm files out of the module cache subdirectory, so it catches everything. As with module rebuilds, we use the file system's atomicity to synchronize. llvm-svn: 173301
* Nuke SetUpBuildDumpLog.Sean Silva2013-01-201-32/+3
| | | | | | | Also, it was the only reason that `argc` and `argv` were being passed into createDiagnostics, so remove those parameters and clean up callers. llvm-svn: 172945
* Fix what appears to be a copy-paste error.Sean Silva2013-01-201-1/+1
| | | | | | | | | | This looks like it was copied from SetUpBuildDumpLog, which dumps to the file `DiagOpts->DumpBuildInformation`. There is another member `DiagOpts->DiagnosticLogFile` which appears to be unused. The fact that this feature doesn't even print to the output file specified on the command line makes me think that it should be ripped out. llvm-svn: 172944
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-1/+1
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Provide Decl::getOwningModule(), which determines the (sub)module inDouglas Gregor2013-01-121-0/+6
| | | | | | | | | | | | | which a particular declaration resides. Use this information to customize the "definition of 'blah' must be imported from another module" diagnostic with the module the user actually has to import. Additionally, recover by importing that module, so we don't complain about other names in that module. Still TODO: coming up with decent Fix-Its for these cases, and expand this recovery approach for other name lookup failures. llvm-svn: 172290
* Be more careful about updating the failed-modules setDouglas Gregor2013-01-101-2/+3
| | | | llvm-svn: 172035
* Remove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>Douglas Gregor2013-01-041-2/+0
| | | | llvm-svn: 171478
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-12/+12
| | | | | | | | | | | | | 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
* Refactor recording the preprocessor conditional directive regions out ofArgyrios Kyrtzidis2012-12-041-1/+1
| | | | | | | | | PreprocessingRecord and into its own class, PPConditionalDirectiveRecord. Decoupling allows a client to use the functionality of PPConditionalDirectiveRecord without needing a PreprocessingRecord. llvm-svn: 169229
* Rename ModuleBuildPath -> ModuleBuildStack. Thanks, Dmitri!Douglas Gregor2012-11-301-6/+6
| | | | llvm-svn: 169045
* When an error occurs while building a module on demand, provide "WhileDouglas Gregor2012-11-301-14/+25
| | | | | | | | | building module 'Foo' imported from..." notes (the same we we provide "In file included from..." notes) in the diagnostic, so that we know how this module got included in the first place. This is part of <rdar://problem/12696425>. llvm-svn: 169021
* Keep track of modules that have failed to build. If we encounter anDouglas Gregor2012-11-291-18/+55
| | | | | | | | | | | | import of that module elsewhere, don't try to build the module again: it won't work, and the experience is quite dreadful. We track this information somewhat globally, shared among all of the related CompilerInvocations used to build modules on-the-fly, so that a particular Clang instance will only try to build a given module once. Fixes <rdar://problem/12552849>. llvm-svn: 168961
* Frontend: Create a virtual file for named pipe inputs.Daniel Dunbar2012-11-271-1/+5
| | | | | | - This ensures we see the right buffer size for the file. llvm-svn: 168636
* Since CreateTargetInfo is taking ownership of the target options, passDouglas Gregor2012-11-161-1/+1
| | | | | | it as a pointer. llvm-svn: 168136
* [modules] Setup the import location of a module file and use itArgyrios Kyrtzidis2012-11-151-2/+3
| | | | | | as the include location of the main file of an imported module. llvm-svn: 168061
* Add a FileCharacteristic parameter to SourceManager::createFileIDForMemBufferArgyrios Kyrtzidis2012-11-091-1/+9
| | | | | | | for completeness and use it in CompilerInstance::InitializeSourceManager if the input is a memory buffer. llvm-svn: 167628
* Turn FrontendInputFile into an immutable class and have it also acceptArgyrios Kyrtzidis2012-11-091-2/+2
| | | | | | a memory buffer instead of only a filename. llvm-svn: 167627
* Make CompilerInstance::InitializeSourceManager accept a FrontendInputFile,Argyrios Kyrtzidis2012-11-091-5/+7
| | | | | | no functionality change. llvm-svn: 167626
* When loading a module fails because it is out of date, rebuild thatDouglas Gregor2012-11-071-3/+26
| | | | | | module in place. <rdar://problem/10138913> llvm-svn: 167539
* Frontend: Add support for reading named pipes as the main file.Daniel Dunbar2012-11-051-0/+13
| | | | | | | | - The whole {File,Source}Manager is built around wanting to pre-determine the size of files, so we can't fit this in naturally. Instead, we handle it like we do STDIN, where we just replace the main file contents upfront. llvm-svn: 167419
* [PCH] Remove the stat cache from the PCH file.Argyrios Kyrtzidis2012-10-311-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stat cache became essentially useless ever since we started validating all file entries in the PCH. But the motivating reason for removing it now is that it also affected correctness in this situation: -You have a header without include guards (using "#pragma once" or #import) -When creating the PCH: -The same header is referenced in an #include with different filename cases. -In the PCH, of course, we record only one file entry for the header file -But we cache in the PCH file the stat info for both filename cases -Then the source files are updated and the header file is updated in a way that its size and modification time are the same but its inode changes -When using the PCH: -We validate the headers, we check that header file and we create a file entry with its current inode -There's another #include with a filename with different case than the previously created file entry -In order to get its stat info we go through the cached stat info of the PCH and we receive the old inode -because of the different inodes, we think they are different files so we go ahead and include its contents. Removing the stat cache will potentially break clients that are attempting to use the stat cache as a way of avoiding having the actual input files available. If that use case is important, patches are welcome to bring it back in a way that will actually work correctly (i.e., emit a PCH that is self-contained, coping with literal strings, line/column computations, etc.). This fixes rdar://5502805 llvm-svn: 167172
* Decouple code-completion for the SkipFunctionBodies frontend option andArgyrios Kyrtzidis2012-10-311-1/+0
| | | | | | add a test to make sure code-completion skips bodies. llvm-svn: 167141
* Teach the preprocessor to hold onto the preprocessor options.Douglas Gregor2012-10-241-1/+2
| | | | llvm-svn: 166599
* Move HeaderSearchOptions into the Lex library, make it intrusivelyDouglas Gregor2012-10-241-1/+2
| | | | | | reference-counted, and hold a reference to it in HeaderSearch. llvm-svn: 166583
* Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor2012-10-231-17/+17
| | | | | | | the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
* Allow clients of the AST reader to specify what kinds of AST loadDouglas Gregor2012-10-221-2/+4
| | | | | | | | | | failures they know how to tolerate, e.g., out-of-date input files or configuration/version mismatches. Suppress the corresponding diagnostics if the client can handle it. No clients actually use this functionality, yet. llvm-svn: 166449
* Distinguish the various kinds of AST file loading failures:Douglas Gregor2012-10-221-2/+8
| | | | | | | | file corruption, compiler version mismatch, target/language configuration mismatch, out-of-date AST file. No functionality change yet. llvm-svn: 166446
* Make sure temporary files are deleted when recovering from a crash when ↵Benjamin Kramer2012-10-141-0/+1
| | | | | | compiling modules. llvm-svn: 165911
* Delete temporary output files when an error occurs during PCH reading.Benjamin Kramer2012-10-141-0/+1
| | | | | | | | This reduces the spam make test leaves behind in /tmp. The assert isn't particularly useful because it's not run with -disable-free (the default when using the clang driver) but should cover all -cc1 tests. llvm-svn: 165910
* Rework the (de-)serialization of macros, as stored inDouglas Gregor2012-10-091-0/+2
| | | | | | | | | | | | | | | | MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. llvm-svn: 165560
* Introduce ASTConsumer::HandleImplicitImportDecl() callback that is invokedArgyrios Kyrtzidis2012-10-031-3/+6
| | | | | | when an ImportDecl that was implicitly created due to an inclusion directive. llvm-svn: 165084
* In the Module class, add a reference to the corresponding AST file.Argyrios Kyrtzidis2012-09-291-0/+3
| | | | llvm-svn: 164873
* Add a new libclang completion API to get brief documentation comment that isDmitri Gribenko2012-07-021-8/+3
| | | | | | | | | | | | | | | | attached to a declaration in the completion string. Since extracting comments isn't free, a new code completion option is introduced. A new code completion option that enables including brief comments into CodeCompletionString should be a, err, code completion option. But because ASTUnit caches global declarations during parsing before even completion consumer is created, the option is duplicated as a translation unit option (in both libclang and ASTUnit, like the option to cache code completion results). llvm-svn: 159539
* Pulls diagnostics for temp file handling into the common diagnostic kinds.Manuel Klimek2012-05-161-1/+1
| | | | llvm-svn: 156947
* For final output files create them with mode 0664 to match otherEric Christopher2012-05-111-1/+2
| | | | | | | | compilers and expected defaults. Part of rdar://11325849 llvm-svn: 156592
* Remove variables made dead by r155923David Blaikie2012-05-011-2/+0
| | | | | | This makes Clang's build warning free again. llvm-svn: 155928
* Remove dead code found by static analyzer.Ted Kremenek2012-05-011-5/+0
| | | | llvm-svn: 155923
* objective-c modern translator: buildit objc boolFariborz Jahanian2012-04-161-0/+4
| | | | | | | type for rewriter project will be BoolTy. // rdar://11231426. llvm-svn: 154861
* Changed all direct calls to CompletionConsumer.reset(..) to go callErik Verbruggen2012-04-121-4/+4
| | | | | | | | CompilerInstance::setCodeCompletionConsumer instead, in order to change the SkipFunctionBodies flag accordingly. Also fixed setCodeCompletionConsumer to take a reset() to null into account. llvm-svn: 154585
* Added a flag to the parser to skip method bodies.Erik Verbruggen2012-04-121-0/+1
| | | | llvm-svn: 154584
* [PCH] Mark a PCH file with a flag to indicate if the serialized AST hadArgyrios Kyrtzidis2012-03-071-1/+5
| | | | | | | | | | | | | | | | compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. llvm-svn: 152192
* [preprocessor] Enhance PreprocessingRecord to keep track of locations of ↵Argyrios Kyrtzidis2012-03-051-1/+1
| | | | | | | | | conditional directives. Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns true if a given range intersects with a conditional directive block. llvm-svn: 152018
OpenPOWER on IntegriCloud