summaryrefslogtreecommitdiff
path: root/lib/Serialization/ASTReader.cpp
Commit message (Collapse)AuthorAge
* DiagnosticIDs: use diagnostic severities to simplify extension handlingAlp Toker2014-06-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211479 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid invalidating successfully loaded module filesBen Langmuir2014-06-20
| | | | | | | | | | | | | | | | | Successfully loaded module files may be referenced in other ModuleManagers, so don't invalidate them. Two related things are fixed: 1) I thought the last module in the manager was always the one that failed, but it isn't. So check explicitly against the list of vetted modules from ReadASTCore. 2) We now keep the file descriptor of pcm file open, which avoids the possibility of having two different pcms for the same module loaded when building in parallel with headers being modified during a build. <rdar://problem/16835846> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211330 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] When we merge redecl chains or mark a decl used with an updateRichard Smith2014-06-16
| | | | | | | | record, mark all subsequent decls as 'used' too, to maintain the AST invariant that getPreviousDecl()->Used implies this->Used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211050 91177308-0d34-0410-b5e6-96231b3b80d8
* Include system_error directly.Rafael Espindola2014-06-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210802 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve diagnostic mapping terminologyAlp Toker2014-06-10
| | | | | | | | | | | | Diagnostic mappings are used to calculate the final severity of diagnostic instances. Detangle the implementation to reflect the terminology used in documentation and bindings. No change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210518 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented support for "pragma clang optimize on/off", based on attribute ↵Dario Domizioli2014-05-23
| | | | | | | | | | | | | | | | | | 'optnone'. This patch implements support for selectively disabling optimizations on a range of function definitions through a pragma. The implementation is that all function definitions in the range are decorated with attribute 'optnone'. #pragma clang optimize off // All function definitions in here are decorated with 'optnone'. #pragma clang optimize on // Compilation resumes as normal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209510 91177308-0d34-0410-b5e6-96231b3b80d8
* Frontend: Propagate ASTReaderListener API in ChainedASTReaderListenerJustin Bogner2014-05-22
| | | | | | | | | | | | | | | | | ASTReaderListener's documentation states that visitInputFile will be called based on the return values of needsInputFileVisitation and needsSystemInputFileVisitation, but ChainedASTReaderListener may call these methods on a child listener based on the values returned by the other child. Even worse, the calls to visitInputFile may be short-circuited due to the use of the boolean or, so the calls to visit may not occur at all for the second listener. This updates ChainedASTReaderListener::visitInputFile to propagate the ASTReaderListener behaviour to both children. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209394 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Serialization edition.Craig Topper2014-05-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209392 91177308-0d34-0410-b5e6-96231b3b80d8
* If two sibling modules declare the same entity, and we indirectly pull aRichard Smith2014-05-19
| | | | | | | | | declaration of that entity in from one of those modules, keep track of the fact that we've not completed the redeclaration chain yet so that we can pull the remaining declarations in from the other module if they're needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209161 91177308-0d34-0410-b5e6-96231b3b80d8
* If a declaration is loaded, and then a module import adds a redeclaration, thenRichard Smith2014-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ensure that querying the first declaration for its most recent declaration checks for redeclarations from the imported module. This works as follows: * The 'most recent' pointer on a canonical declaration grows a pointer to the external AST source and a generation number (space- and time-optimized for the case where there is no external source). * Each time the 'most recent' pointer is queried, if it has an external source, we check whether it's up to date, and update it if not. * The ancillary data stored on the canonical declaration is allocated lazily to avoid filling it in for declarations that end up being non-canonical. We'll still perform a redundant (ASTContext) allocation if someone asks for the most recent declaration from a decl before setPreviousDecl is called, but such cases are probably all bugs, and are now easy to find. Some finessing is still in order here -- in particular, we use a very general mechanism for handling the DefinitionData pointer on CXXRecordData, and a more targeted approach would be more compact. Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was addressing only a corner of the full problem space here. That's not covered by this patch. Early performance benchmarks show that this makes no measurable difference to Clang performance without modules enabled (and fixes a major correctness issue with modules enabled). I'll revert if a full performance comparison shows any problems. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209046 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge a couple of copy-and-pasted functionsAlp Toker2014-05-16
| | | | | | No change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209005 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename SourceManager::createFileIDForMemBuffer()Alp Toker2014-05-16
| | | | | | | | It makes more sense to just overload createFileID(). Gardening only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209002 91177308-0d34-0410-b5e6-96231b3b80d8
* Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer2014-05-10
| | | | | | | Required pulling LambdaExpr::Capture into its own header. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208470 91177308-0d34-0410-b5e6-96231b3b80d8
* Let ASTReader optionally delete its ASTDeserializationListener.Nico Weber2014-05-08
| | | | | | | | | | | | | | | | | | | | | Use this to fix the leak of DeserializedDeclsDumper and DeserializedDeclsChecker in FrontendAction (found by LSan), PR19560. The "delete this" bool is necessary because both PCHGenerator and ASTUnit return the same object from both getDeserializationListener() and getASTMutationListener(), so ASTReader can't just have a unique_ptr. It's also not possible to just let FrontendAction (or CompilerInstance) own these listeners due to lifetime issues (see comments on PR19560). Finally, ASTDeserializationListener can't easily be refcounted, since several of the current listeners are allocated on the stack. Having this bool isn't ideal, but it's a pattern that's used in other places in the codebase too, and it seems better than leaking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208277 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix latent bug. This can't actually manifest at the moment, but is a time-bombRichard Smith2014-05-08
| | | | | | | for the next time someone adds something to this function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208270 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace one-element SmallVectors inside DenseMaps with TinyPtrVector.Benjamin Kramer2014-05-03
| | | | | | That's exactly what TinyPtrVector was designed for. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207919 91177308-0d34-0410-b5e6-96231b3b80d8
* Defer loading any pending update records until we've finished deserializing.Richard Smith2014-04-30
| | | | | | | | This fixes a bug where an update record causes us to load an entity that refers to an entity we've not finished loading yet, resulting in badness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207603 91177308-0d34-0410-b5e6-96231b3b80d8
* [PCH/Modules] Don't tie TargetOptions::LinkerVersion to a module/PCH, it's a ↵Argyrios Kyrtzidis2014-04-29
| | | | | | | | driver only thing and doesn't affect any language/preprocessor/etc. semantics. rdar://16714526 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207570 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r207477 and r207479 without cyclic dependencyBen Langmuir2014-04-29
| | | | | | | | Fixed by moving ProcessWarningOptions from Frontend into Basic. All of the dependencies for ProcessWarningOptions were already in Basic, so this was a small change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207549 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r207477 (and r207479), "Check -Werror options during module validation"NAKAMURA Takumi2014-04-29
| | | | | | It tried to introduce cyclic dependencies. Serialization shouldn't depend on Frontend, since Frontend depends on Serialization. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207497 91177308-0d34-0410-b5e6-96231b3b80d8
* Check -Werror options during module validationBen Langmuir2014-04-29
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch checks whether the diagnostic options that could lead to errors (principally -Werror) are consistent between when a module was built and when it is loaded. If there are new -Werror flags, then the module is rebuilt. In order to canonicalize the options we do this check at the level of the constructed DiagnosticsEngine, which contains the final set of diag to diagnostic level mappings. Currently we only rebuild with the new diagnostic options, but we intend to refine this in the future to include the union of the new and old flags, since we know the old ones did not cause errors. System modules are only rebuilt when -Wsystem-headers is enabled. One oddity is that unlike checking language options, we don’t perform this diagnostic option checking when loading from a precompiled header. The reason for this is that the compiler cannot rebuild the PCH, so anything that requires it to be rebuilt effectively leaks into the build system. And in this case, that would mean the build system understanding the complex relationship between diagnostic options and the underlying diagnostic mappings, which is unreasonable. Skipping the check is safe, because these options do not affect the generated AST. You simply won’t get new build errors due to changed -Werror options automatically, which is also true for non-module cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207477 91177308-0d34-0410-b5e6-96231b3b80d8
* When two templates get merged together, also merge their pattern declarationsRichard Smith2014-04-24
| | | | | | | | | | | | | | | together. This is extremely hairy, because in general we need to have loaded both the template and the pattern before we can determine whether either should be merged, so we temporarily violate the rule that all merging happens before reading a decl ends, but *only* in the case where a template's pattern is being loaded while loading the template itself. In order to accomodate this for class templates, delay loading the injected class name type for the pattern of the template until after we've loaded the template itself, if we happen to load the template first. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207063 91177308-0d34-0410-b5e6-96231b3b80d8
* Make TypeDecl much less friendly.Richard Smith2014-04-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207007 91177308-0d34-0410-b5e6-96231b3b80d8
* When a module completes the definition of a class template specialization ↵Richard Smith2014-04-19
| | | | | | imported from another module, emit an update record, rather than using the broken decl rewriting mechanism. If multiple modules do this, merge the definitions together, much as we would if they were separate declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206680 91177308-0d34-0410-b5e6-96231b3b80d8
* Add module name and module map file to -module-file-infoBen Langmuir2014-04-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206217 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow multiple modules with the same name to coexist in the module cacheBen Langmuir2014-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206201 91177308-0d34-0410-b5e6-96231b3b80d8
* OnDiskHashTable: Make the iterable version separate.Justin Bogner2014-04-14
| | | | | | | | | | | | | | | Currently the on disk hash table's key_iterator and data_iterator make the assumption that the table data starts exactly four bytes after the base of the table. This happens to be true for all of the tables we currently iterate over, but not for all of the OnDiskHashTables we currently use. For example, key_ and data_iterator would iterate over meaningless data if they were used on the hash tables in PTHLexer. We make the API safer by breaking this into two types. One doesn't have the iterators, and the other must be told where the payload starts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206189 91177308-0d34-0410-b5e6-96231b3b80d8
* When module umbrellas change, rebuild themBen Langmuir2014-04-10
| | | | | | | With the VFS, it is easy to hit modified umbrellas by overriding the umbrella header, and what we want is to rebuild, not to fail. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205975 91177308-0d34-0410-b5e6-96231b3b80d8
* [Preprocessor/CodeComplete] Don't add include guard macros to ↵Argyrios Kyrtzidis2014-04-09
| | | | | | code-completion results. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205917 91177308-0d34-0410-b5e6-96231b3b80d8
* Have validate-system-headers override validate-once-per-build-sessionBen Langmuir2014-04-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205773 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-28
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205062 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-28
| | | | | | This reverts commit r205045. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205048 91177308-0d34-0410-b5e6-96231b3b80d8
* OnDiskHashTable: Use Endian.h to read little endian ostreamsJustin Bogner2014-03-28
| | | | | | | | | Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205045 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a FIXME, use std::move.Richard Smith2014-03-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205021 91177308-0d34-0410-b5e6-96231b3b80d8
* Comment parsing: when comment ranges are deserialized from multiple modules,Dmitri Gribenko2014-03-27
| | | | | | | | | | correctly order comments in SourceManager::isBeforeInTranslationUnit() order Unfortunately, this is not as simple as it was implemented previously, and actually requires doing a merge sort. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204936 91177308-0d34-0410-b5e6-96231b3b80d8
* If an update record makes a declaration interesting, pass it to the consumer.Richard Smith2014-03-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204550 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixing code that doesn't compile in MSVC 2012 (but does in MSVC 2013) from ↵Aaron Ballman2014-03-21
| | | | | | r204417 and related commits. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204471 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19215: When writing/reading a PCH that imported a module, store the locationRichard Smith2014-03-21
| | | | | | | | at which that PCH imported each visible submodule of the module. Such locations are needed when synthesizing macro directives resulting from the import. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204417 91177308-0d34-0410-b5e6-96231b3b80d8
* When the exception specification for a function in an imported PCH or module isRichard Smith2014-03-20
| | | | | | | resolved, emit an update record. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204403 91177308-0d34-0410-b5e6-96231b3b80d8
* Rearrange serialization block order to put decl update emission into the sameRichard Smith2014-03-20
| | | | | | | | | block as decl and type emission. This allows decl updates include statements and expressions. No functionality change (but the generated PCM files are incompatible with earlier versions of Clang). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204385 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR18806: Canonicalize the replacement type when deserializing a ↵Stephan Tolksdorf2014-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | SubstTemplateTypeParmType What's going on in the test case (without the patch applied) is this: When the header is parsed, decltype(B()) is canonicalized to decltype(Y()), because that was the first parsed equivalent decltype expression. Hence, the TemplateSpecializationType for Id<decltype(B())> ends up with SubstTemplateTypeParmType(T, decltype(Y())) as the AliasedType member. When the PCH file is included and the AST reader reads Id<decltype(B())>, it sees decltype(B()) before decltype(Y()). So, this time decltype(B()) ends up being the canonical type for both decltypes, which leads to an assert violation when the reader calls getSubstTemplateTypeParmType with the non-canonical decltype(Y()) as the replacement type. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits, aemerson Differential Revision: http://llvm-reviews.chandlerc.com/D3073 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204005 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix VS2012 build after r203881Hans Wennborg2014-03-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203951 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Emit the module file paths as dependencies of the PCH when we are ↵Argyrios Kyrtzidis2014-03-14
| | | | | | | | | | | building one. This is because the PCH is tied to the module files, if one of the module files changes or gets removed the build system should re-build the PCH file. rdar://16321245 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203885 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Make sure that the synthesized file "__inferred_module.map" ↵Argyrios Kyrtzidis2014-03-14
| | | | | | | | doesn't show up as dependency of a module file. Follow-up for rdar://15459210 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203882 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor ASTReader::readInputFileInfo to return a struct containing the ↵Argyrios Kyrtzidis2014-03-14
| | | | | | | | related information. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203881 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Replacing ObjCContainerDecl iterators meth_begin() and meth_end() ↵Aaron Ballman2014-03-13
| | | | | | with iterator_range methods(). Updating all of the usages of the iterators with range-based for loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203832 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-13
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203746 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert C++11ification in r203534 and r203536. Apparently our toolchains aren'tRichard Smith2014-03-11
| | | | | | | ready for this yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203548 91177308-0d34-0410-b5e6-96231b3b80d8
* Speculative workaround for apparent libstdc++ bug exposed by r203534.Richard Smith2014-03-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203536 91177308-0d34-0410-b5e6-96231b3b80d8
* If a visibility update record is found for a DeclContext after that Decl hasRichard Smith2014-03-11
| | | | | | | | already been loaded, apply that update record to the Decl immediately, rather than adding it to a pending list and never applying it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203534 91177308-0d34-0410-b5e6-96231b3b80d8