summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/Inputs/redecl-merge-top.h
Commit message (Collapse)AuthorAgeFilesLines
* Ensure that the identifier chains have the most recent declaration after ↵Douglas Gregor2013-02-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | module deserialization. This commit introduces a set of related changes to ensure that the declaration that shows up in the identifier chain after deserializing declarations with a given identifier is, in fact, the most recent declaration. The primary change involves waiting until after we deserialize and wire up redeclaration chains before updating the identifier chains. There is a minor optimization in here to avoid recursively deserializing names as part of looking to see whether top-level declarations for a given name exist. A related change that became suddenly more urgent is to property record a merged declaration when an entity first declared in the current translation unit is later deserialized from a module (that had not been loaded at the time of the original declaration). Since we key off the canonical declaration (which is parsed, not from an AST file) for emitted redeclarations, we simply record this as a merged declaration during AST writing and let the readers merge them. Re-fixes <rdar://problem/13189985>, presumably for good this time. llvm-svn: 175447
* When we load a function or method body from an AST file, we checkDouglas Gregor2012-10-091-0/+2
| | | | | | | | | | whether that function/method already has a body (loaded from some other AST file), as introduced in r165137. Delay this check until after the redeclaration chains have been wired up. While I'm here, make the loading of method bodies lazy. llvm-svn: 165513
* Merge pending instantiations instead of overwriting existing ones.Axel Naumann2012-10-021-9/+0
| | | | | | | | | | | Check whether a pending instantiation needs to be instantiated (or whether an instantiation already exists). Verify the size of the PendingInstantiations record (was only checking size of existing PendingInstantiations). Migrate Obj-C++ part of redecl-merge into separate test, now that this is growing. templates.mm: test that CodeGen has seen exactly one definition of template instantiations. redecl-merge.m: use "@" specifier for expected-diagnostics. llvm-svn: 164993
* Bring ASTReader and Writer into sync for the case where a canonical template ↵Axel Naumann2012-10-011-0/+5
| | | | | | | | | specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written. The easiest way out is to store whether the decl was canonical at the time of writing. Add test. llvm-svn: 164927
* Implement cross-module declaration merging for tag declarations, soDouglas Gregor2012-01-031-0/+4
| | | | | | | | | | | | that if two modules A and B both contain a declaration of a tag such as struct X; and those two modules are unrelated, the two declarations of X will be merged into a single redeclaration chain. llvm-svn: 147488
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-011-0/+5
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Re-implement (de-)serialization of redeclaration chains forDouglas Gregor2011-12-191-0/+4
| | | | | | | | | | | | | | | | redeclaration templates (RedeclarableTemplateDecl), similarly to the way (de-)serialization is implemented for Redeclarable<T>. In the process, found a simpler formulation for handling redeclaration chains and implemented that in both places. The new test establishes that we're building the redeclaration chains properly. However, the FIXME indicates where we're tickling a different bug that has to do with us not setting the DefinitionData pointer properly in redeclarations that we detected after the definition itself was deserialized. The (separable) fix for that bug is forthcoming. llvm-svn: 146883
* Optimize serialized representation of redeclarable declarations forDouglas Gregor2011-12-191-0/+2
| | | | | | | | | | | which there are no redeclarations. This reduced by size of the PCH file for Cocoa.h by ~650k: ~536k of that was in the new LOCAL_REDECLARATIONS table, which went from a ridiculous 540k down to an acceptable 3.5k, while the rest was due to the more compact abbreviated representation of redeclarable declaration kinds (which no longer need to store the 'first' declaration ID). llvm-svn: 146869
* Completely re-implement (de-)serialization of declarationDouglas Gregor2011-12-171-0/+5
chains. The previous implementation relied heavily on the declaration chain being stored as a (circular) linked list on disk, as it is in memory. However, when deserializing from multiple modules, the different chains could get mixed up, leading to broken declaration chains. The new solution keeps track of the first and last declarations in the chain for each module file. When we load a declaration, we search all of the module files for redeclarations of that declaration, then splice together all of the lists into a coherent whole (along with any redeclarations that were actually parsed). As a drive-by fix, (de-)serialize the redeclaration chains of TypedefNameDecls, which had somehow gotten missed previously. Add a test of this serialization. This new scheme creates a redeclaration table that is fairly large in the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The table is mmap'd in and searched via a binary search, but it's still quite large. A future tweak will eliminate entries for declarations that have no redeclarations anywhere, and should drastically reduce the size of this table. llvm-svn: 146841
OpenPOWER on IntegriCloud