summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r147664; it's breaking clang regression tests.Eli Friedman2012-01-061-2/+2
| | | | llvm-svn: 147681
* Silence GCC warnings.Jakub Staszak2012-01-061-2/+2
| | | | llvm-svn: 147664
* Stash Decl's TopLevelDeclInObjCContainer and ModulePrivate bitsDouglas Gregor2012-01-062-6/+6
| | | | | | | | into the two unused lower bits of the NextDeclInContext link, dropping the number of bits in Decl down to 32, and saving 8 bytes per declaration on x86-64. llvm-svn: 147660
* Introduce a "Hidden" bit into Decl, to track whether that declarationDouglas Gregor2012-01-062-5/+5
| | | | | | | | | | is hidden from name lookup. The previous hack of tweaking the ModulePrivate bit when loading a declaration from a hidden submodule was brittle. Note that we now have 34 bits in Decl. I'll fix that next. llvm-svn: 147658
* Teach DeclContext deserialization to pay attention to endianness, fromDouglas Gregor2012-01-062-2/+4
| | | | | | David Fang and Takumi Nakamura. Fixes many PCH failures on PowerPC. llvm-svn: 147657
* Don't seed the ASTWriter's declaration -> ID mapping with the IDs ofDouglas Gregor2012-01-052-10/+23
| | | | | | | each deserialized declaration, since that information is already available in each declaration. llvm-svn: 147619
* When we deserialize a declaration from a module file, allocate extraDouglas Gregor2012-01-052-20/+2
| | | | | | | | | | | | | | | storage for the global declaration ID. Declarations that are parsed (rather than deserialized) are unaffected, so the number of declarations that pay this cost tends to be relatively small (since relatively few declarations are ever deserialized). This replaces a largish DenseMap within the AST reader. It's not strictly a win in terms of memory use---not every declaration was added to that DenseMap in the first place---but it's cleaner to have this information available for every deserialized declaration, so that future clients can rely on it. llvm-svn: 147617
* When creating declarations that are deserialized from an module file,Douglas Gregor2012-01-051-101/+53
| | | | | | | go through a central allocation routine Decl::AllocateDeserializedDecl(). No actual functionality change (yet). llvm-svn: 147614
* When loading an AST file, set SourceManager::MainFileID to the main file of ↵Argyrios Kyrtzidis2012-01-051-7/+10
| | | | | | | | the AST file, as suggested by Tom Honermann. llvm-svn: 147612
* Store the submodules of a module in source order, as they are storedDouglas Gregor2012-01-042-19/+10
| | | | | | | | in the module map. This provides a bit more predictability for the user, as well as eliminating the need to sort the submodules when serializing them. llvm-svn: 147564
* Implement declaration merging for variables in disjoint modules.Douglas Gregor2012-01-041-1/+16
| | | | llvm-svn: 147535
* Implement declaration merging for non-template functions fromDouglas Gregor2012-01-042-44/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | different modules. This implementation is a first approximation of what we want, using only the function type to determine equivalence. Later, we'll want to deal with some of the more subtle issues, including: - C allows a prototyped declaration and a non-prototyped declaration to be merged, which we should support - We may want to ignore the return type when merging, then complain if the return types differ. Or, we may want to leave it as it us, so that we only complain if overload resolution eventually fails. - C++ non-static member functions need to consider cv-qualifiers and ref-qualifiers. - Function templates need to consider the template parameters and return type. - Function template specializations will have special rules. - We can now (accidentally!) end up overloading in C, even without the "overloadable" attribute, and will need to detect this at some point. The actual detection of "is this an overload?" is implemented by Sema::IsOverload(), which will need to be moved into the AST library for re-use here. That will be a future refactor. llvm-svn: 147534
* Implement declaration merging for typedefs loaded from disjointDouglas Gregor2012-01-041-6/+18
| | | | | | | | | | | modules, so long as the typedefs refer to the same underlying type. This ensures that the typedefs end up in the same redeclaration chain. To test this, fix name lookup for C/Objective-C to properly deal with multiple declarations with the same name in the same scope. llvm-svn: 147533
* Implement cross-module declaration merging for tag declarations, soDouglas Gregor2012-01-031-2/+38
| | | | | | | | | | | | 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
* Don't attempt to merge a deserialized declaration with existingDouglas Gregor2012-01-031-0/+4
| | | | | | | declarations in the AST unless modules are enabled. This case doesn't come up with precompiled headers, and it isn't cheap. llvm-svn: 147451
* Factor the merging of declarations in the AST reader out to a separateDouglas Gregor2012-01-031-78/+48
| | | | | | | | member function template, since the behavior is identical for ObjCInterfaceDecl and ObjCProtocolDecl. It's expected that all redeclarable entities will have the same behavior. llvm-svn: 147450
* Eliminate ObjCProtocolDecl's end-of-definition location. It is notDouglas Gregor2012-01-022-3/+0
| | | | | | used anywhere. llvm-svn: 147422
* Move ObjCProtocolDecl::EndLoc into its DefinitionData, and giveDouglas Gregor2012-01-022-2/+3
| | | | | | ObjCProtocolDecl proper source-range information. llvm-svn: 147420
* Eliminate the ForwardDecl/InitiallyForwardDecl bits from ObjCProtocolDecl. ↵Douglas Gregor2012-01-012-5/+1
| | | | | | They are no longer needed llvm-svn: 147419
* Implement declaration merging for Objective-C protocols acrossDouglas Gregor2012-01-011-3/+45
| | | | | | | multiple, disjoint modules. There is far too much duplicating with the ObjCInterfaceDecl case here, which I'll eliminate shortly. llvm-svn: 147417
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-013-34/+0
| | | | | | ObjCProtocolDecl modules forward declarations properly. llvm-svn: 147415
* Don't bother rewriting an Objective-C class or protocol declaration to the ↵Douglas Gregor2012-01-011-2/+0
| | | | | | module file when we've merely added a definition llvm-svn: 147414
* Eliminate ASTMutationListener::UpdatedAttributeList, which is noDouglas Gregor2012-01-011-7/+0
| | | | | | longer needed now that we aren't back-patching ObjCProtocolDecls. llvm-svn: 147413
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-011-1/+1
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Introduce the core infrastructure needed to model redeclaration chainsDouglas Gregor2012-01-015-10/+61
| | | | | | | | | | | | | | | for Objective-C protocols, including: - Using the first declaration as the canonical declaration - Using the definition as the primary DeclContext - Making sure that all declarations have a pointer to the definition data, and that we know which declaration is the definition - Serialization support for redeclaration chains and for adding definitions to already-serialized declarations. However, note that we're not taking advantage of much of this code yet, because we're still re-using ObjCProtocolDecls. llvm-svn: 147410
* Move the data that corresponds to the definition of a protocol into aDouglas Gregor2012-01-012-20/+39
| | | | | | | | | separately-allocated DefinitionData structure. Introduce various functions that will help with the separation of declarations from definitions (isThisDeclarationADefinition(), hasDefinition(), getDefinition()). llvm-svn: 147408
* Implement support for module requirements, which indicate the languageDouglas Gregor2011-12-312-0/+32
| | | | | | | | | features needed for a particular module to be available. This allows mixed-language modules, where certain headers only work under some language variants (e.g., in C++, std.tuple might only be available in C++11 mode). llvm-svn: 147387
* Fix cmake build with -DBUILD_SHARED_LIBS=ON.Rafael Espindola2011-12-291-2/+1
| | | | llvm-svn: 147338
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-273-19/+0
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* Initialize member that ends up in PCH files.Benjamin Kramer2011-12-271-1/+1
| | | | llvm-svn: 147288
* Make a note for an optimization that I'd like to implement, when the ASTs ↵Douglas Gregor2011-12-221-0/+8
| | | | | | for local externs are sound llvm-svn: 147185
* Serialize the AST reader's mapping from canonical declarations to theDouglas Gregor2011-12-223-6/+64
| | | | | | | | | | | | | | | | set of (previously-canonical) declaration IDs to the module file, so that future AST reader instances that load the module know which declarations are merged. This is important in the fairly tricky case where a declaration of an entity, e.g., @class X; occurs before the import of a module that also declares that entity. We merge the declarations, and record the fact that the declaration of X loaded from the module was merged into the (now canonical) declaration of X that we parsed. llvm-svn: 147181
* If we end up merging an Objective-C class with an existing Objective-CDouglas Gregor2011-12-221-2/+16
| | | | | | | class that comes from a different module file, make sure that we load all of the pending declarations for the original declaration. llvm-svn: 147168
* When deserializing an Objective-C class, check whether we have anotherDouglas Gregor2011-12-222-29/+225
| | | | | | | | | | | | | | | | declaration of that same class that either came from some other module or occurred in the translation unit loading the module. In this case, we need to merge the two redeclaration chains immediately so that all such declarations have the same canonical declaration in the resulting AST (even though they don't in the module files we've imported). Focusing on Objective-C classes until I'm happy with the design, then I'll both (1) extend this notion to other kinds of declarations, and (2) optimize away this extra checking when we're not dealing with modules. For now, doing this checking for PCH files/preambles gives us better testing coverage. llvm-svn: 147123
* Implement a trivial, obvious optimization for deserialization ofDouglas Gregor2011-12-211-2/+2
| | | | | | | | | | redeclaration chains: only ever have the reader search for redeclarations of the first (canonical) declaration, since we only ever record redeclaration ranges for the that declaration. Searching for redeclarations of non-canonical declarations will never find anything, so it's a complete waste of time. llvm-svn: 147055
* When we make a previously-deserialized module definition visible,Douglas Gregor2011-12-202-3/+14
| | | | | | | notify the AST deserialization listener so that the AST writer knows that it can write the macro definition. llvm-svn: 146994
* Fix off-by-one error in an assert condition. No functionality change, but betterRichard Smith2011-12-201-1/+1
| | | | | | error detection. llvm-svn: 146962
* Detect when mapping a #include/#import over to a submodule ends upDouglas Gregor2011-12-202-1/+1
| | | | | | | | | | | | | hitting a submodule that was never actually created, e.g., because that header wasn't parsed. In such cases, complain (because the module's umbrella headers don't cover everything) and fall back to including the header. Later, we'll add a warning at module-build time to catch all such cases. However, this fallback is important to eliminate assertions in the ASTWriter when this happens. llvm-svn: 146933
* Eliminate the first->last redeclaration map from the AST fileDouglas Gregor2011-12-192-26/+5
| | | | | | | format. It's no longer being used, now that we have a new implementation of redeclaration chains. llvm-svn: 146905
* Remove ASTReader's PendingForwardRefs, which is now handled by theDouglas Gregor2011-12-192-57/+8
| | | | | | (more general) fix-up of definition data pointers. llvm-svn: 146903
* Once we have fully deserialized a redeclaration chain for somethingDouglas Gregor2011-12-193-15/+54
| | | | | | | | | | | with a definition pointer (e.g., C++ and Objective-C classes), zip through the redeclaration chain to make sure that all of the declarations point to the definition data. As part of this, realized again why the first redeclaration of an entity in a file is important, and brought back that idea. llvm-svn: 146886
* Re-implement (de-)serialization of redeclaration chains forDouglas Gregor2011-12-192-106/+93
| | | | | | | | | | | | | | | | 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
* The submodule offset map can introduce "empty" remapping entries forDouglas Gregor2011-12-191-11/+13
| | | | | | | | | | imported modules that don't introduce any new entities of a particular kind. Allow these entries to be replaced with entries for another loaded module. In the included test case, selectors exhibit this behavior. llvm-svn: 146870
* Optimize serialized representation of redeclarable declarations forDouglas Gregor2011-12-192-40/+29
| | | | | | | | | | | 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
* Combine common (de-)serialization logic for typedefs and type aliasesDouglas Gregor2011-12-192-10/+15
| | | | | | into operations on TypedefNameDecl. No functionality change. llvm-svn: 146866
* constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'Richard Smith2011-12-192-3/+12
| | | | | | | | | | | | | | | | | | | | | variable is initialized by a non-constant expression, and pass in the variable being declared so that earlier-initialized fields' values can be used. Rearrange VarDecl init evaluation to make this possible, and in so doing fix a long-standing issue in our C++ constant expression handling, where we would mishandle cases like: extern const int a; const int n = a; const int a = 5; int arr[n]; Here, n is not initialized by a constant expression, so can't be used in an ICE, even though the initialization expression would be an ICE if it appeared later in the TU. This requires computing whether the initializer is an ICE eagerly, and saving that information in PCH files. llvm-svn: 146856
* Begin adding AVX2 intrinsics. Necessitated increasing the number of bits ↵Craig Topper2011-12-192-2/+3
| | | | | | used to store builtinID when serializing identifier table. llvm-svn: 146855
* Completely re-implement (de-)serialization of declarationDouglas Gregor2011-12-175-87/+318
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [PCH] Don't deserialize bodies of interesting decls while iteratingArgyrios Kyrtzidis2011-12-171-41/+49
| | | | | | | | | over them because more interesting decls can be added during body deserialization. Should fix msvc build tests. llvm-svn: 146824
* [PCH] In ASTReader::FinishedDeserializing fully load the interesting decls,Argyrios Kyrtzidis2011-12-171-0/+9
| | | | | | | | | including deserializing their bodies, so that any other declarations that get referenced in the body will be fully deserialized by the time we pass them to the consumer. Could not reduce to a test case unfortunately. rdar://10587158. llvm-svn: 146817
OpenPOWER on IntegriCloud