summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Make sure we're always setting the previous declaration of an ObjCInterfaceDeclDouglas Gregor2011-12-161-1/+1
| | | | llvm-svn: 146763
* Fix chaining of ObjCInterfaceDecl redeclarationsDouglas Gregor2011-12-161-9/+14
| | | | llvm-svn: 146722
* Move ObjCInterfaceDecl's "EndLoc" into DefinitionData, since it onlyDouglas Gregor2011-12-152-4/+4
| | | | | | | | applies to an actual definition. Plus, clarify the purpose of this field and give the accessor a different name, since getLocEnd() is supposed to be the same as getSourceRange().getEnd(). llvm-svn: 146694
* Keep track of all declarations of an Objective-C class (both forwardDouglas Gregor2011-12-152-2/+0
| | | | | | | | | | declarations and definitions) as ObjCInterfaceDecls within the same redeclaration chain. This new representation matches what we do for C/C++ variables/functions/classes/templates/etc., and makes it possible to answer the query "where are all of the declarations of this class?" llvm-svn: 146679
* Extend ObjCInterfaceDecl::DefinitionData to contain a pointer to theDouglas Gregor2011-12-151-5/+5
| | | | | | | definition, and implement ObjCInterfaceDecl::getDefinition() efficiently based on that. llvm-svn: 146669
* Introduce the core infrastructure needed to model a completeDouglas Gregor2011-12-154-7/+39
| | | | | | | | | | | | | | | redeclaration chain for Objective-C classes, 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 the definition knows that it is the definition. - Serialization support for when a definition gets added to a declaration that comes from an AST file. However, note that we're not taking advantage of much of this code yet, because we're still re-using ObjCInterfaceDecls. llvm-svn: 146667
* Move the definition-specific data of ObjCInterfaceDecl into aDouglas Gregor2011-12-152-59/+106
| | | | | | | | | | | | | | | | separately-allocated DefinitionData structure, which we manage the same way as CXXRecordDecl::DefinitionData. This prepares the way for making ObjCInterfaceDecls redeclarable, to more accurately model forward declarations of Objective-C classes and eliminate the mutation of ObjCInterfaceDecl that causes us serious trouble in the AST reader. Note that ObjCInterfaceDecl's accessors are fairly robust against being applied to forward declarations, because Clang (and Sema in particular) doesn't perform RequireCompleteType/hasDefinition() checks everywhere it has to. Each of these overly-robust cases is marked with a FIXME, which we can tackle over time. llvm-svn: 146644
* Eliminate the vistigial ObjCClassDecl::ObjCClassRef, and inline itsDouglas Gregor2011-12-142-5/+4
| | | | | | | members into ObjCClassDecl, saving ourselves one pointer per forward declaration. llvm-svn: 146564
* Tweak submodule ID handling in the AST writerDouglas Gregor2011-12-122-6/+9
| | | | llvm-svn: 146445
* Use llvm::sys::fs::equivalent rather than comparing inodes, becauseDouglas Gregor2011-12-091-6/+5
| | | | | | comparing inodes doesn't actually work on Windows. llvm-svn: 146260
* Move ChainedIncludesSource into the Frontend library. This never reallyChandler Carruth2011-12-092-241/+0
| | | | | | | | | | belonged in the Serialization library, it's setting up a compilation, not just deserializing. This should fix PR11512, making Serialization actually be layered below Frontend, a long standing layering violation in Clang. llvm-svn: 146233
* Clean up the comments for this file now that its contents are totallyChandler Carruth2011-12-091-4/+3
| | | | | | | | different from what the comments indicated. Also drop a no longer used include that also violates the layering between Serialization and Frontend. llvm-svn: 146230
* Move a free function from the Frontend library into the Lex library asChandler Carruth2011-12-091-2/+2
| | | | | | | | part of HeaderSearch. This function just normalizes filenames for use inside of a synthetic include directive, but it is used in both the Frontend and Serialization libraries so it needs a common home. llvm-svn: 146227
* Save category name loc in ObjCCategoryImplDecl, patch by Jason Haslam!Argyrios Kyrtzidis2011-12-092-1/+3
| | | | llvm-svn: 146213
* Separate the serialization library's diagnostics from the frontend'sChandler Carruth2011-12-092-2/+2
| | | | | | | diagnostics. Conflating them was highly confusing and makes it harder to establish a firm layering separation between these two libraries. llvm-svn: 146207
* Implement umbrella directories for modules, which are similar toDouglas Gregor2011-12-082-4/+36
| | | | | | | | | | | | | | | umbrella headers in the sense that all of the headers within that directory (and eventually its subdirectories) are considered to be part of the module with that umbrella directory. However, unlike umbrella headers, which are expected to include all of the headers within their subdirectories, Clang will automatically include all of the headers it finds in the named subdirectory. The intent here is to allow a module map to trivially turn a subdirectory into a module, where the module's structure can mimic the directory structure. llvm-svn: 146165
* Within the module representation, generalize the notion of an umbrellaDouglas Gregor2011-12-082-4/+4
| | | | | | | | | | header to also support umbrella directories. The umbrella directory for an umbrella header is the directory in which the umbrella header resides. No functionality change yet, but it's coming. llvm-svn: 146158
* Remove unused-but-set variable.Benjamin Kramer2011-12-071-2/+0
| | | | llvm-svn: 146034
* Implement inferred submodules support, which (when requested)Douglas Gregor2011-12-062-29/+41
| | | | | | | implicitly generates submodules corresponding to the headers that fall within a module. llvm-svn: 145887
* Parse inferred submodules in module maps, track their contents inDouglas Gregor2011-12-052-1/+18
| | | | | | | Module, and (de-)serialize this information. Semantics of inferred submodules to follow. llvm-svn: 145864
OpenPOWER on IntegriCloud