summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/Module.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [C++11] Use 'nullptr'. Serialization edition.Craig Topper2014-05-221-15/+15
| | | | llvm-svn: 209392
* Revert C++11ification in r203534 and r203536. Apparently our toolchains aren'tRichard Smith2014-03-111-0/+7
| | | | | | ready for this yet. llvm-svn: 203548
* If a visibility update record is found for a DeclContext after that Decl hasRichard Smith2014-03-111-7/+0
| | | | | | | already been loaded, apply that update record to the Decl immediately, rather than adding it to a pending list and never applying it. llvm-svn: 203534
* [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more ↵Argyrios Kyrtzidis2013-03-061-1/+1
| | | | | | | | than once. We can just re-use the one from HeaderFileInfoLookupTable. llvm-svn: 176565
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | 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
* [PCH] Remove the stat cache from the PCH file.Argyrios Kyrtzidis2012-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Move the set of files to be validated in an AST file into the controlDouglas Gregor2012-10-191-1/+1
| | | | | | | | | | | | | block, so the input files are validated early on, before we've committed to loading the AST file. This (accidentally) fixed a but wherein the main file used to generate the AST file would *not* be validated by the existing validation logic. At the moment, this leads to some duplication of filenames between the source manager block and input-file blocks, as well as validation logic. This will be handled via an upcoming patch. llvm-svn: 166251
* Rework the (de-)serialization of macros, as stored inDouglas Gregor2012-10-091-2/+8
| | | | | | | | | | | | | | | | 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
* Set the file entry for a Module* that was created during deserializationArgyrios Kyrtzidis2012-10-031-1/+2
| | | | | | of a module file. llvm-svn: 165086
* [libclang] When indexing an AST file, only deserialize the file levelArgyrios Kyrtzidis2012-10-021-1/+2
| | | | | | declarations of the current primary module. llvm-svn: 165046
* Use forward declarations for ASTDeclContextNameLookupTable and add a missing ↵Benjamin Kramer2012-04-151-2/+1
| | | | | | | | delete. It would be nice to use OwningPtr here, but DeclContextInfo is stored in a DenseMap. llvm-svn: 154763
* Reimplement (de-)serialization of Objective-C categories to eliminateDouglas Gregor2012-01-271-0/+1
| | | | | | | | | | | | | | the direct serialization of the linked-list structure. Instead, use a scheme similar to how we handle redeclarations, with redeclaration lists on the side. This addresses several issues: - In cases involving mixing and matching of many categories across many modules, the linked-list structure would not be consistent across different modules, and categories would get lost. - If a module is loaded after the class definition and its other categories have already been loaded, we wouldn't see any categories in the newly-loaded module. llvm-svn: 149112
* Optimize unqualified/global name lookup in modules by introducing aDouglas Gregor2012-01-181-2/+2
| | | | | | | | | | generational scheme for identifiers that avoids searching the hash tables of a given module more than once for a given identifier. Previously, loading any new module invalidated all of the previous lookup results for all identifiers, causing us to perform the lookups repeatedly. llvm-svn: 148412
* Completely re-implement (de-)serialization of redeclarationDouglas Gregor2012-01-151-1/+1
| | | | | | | | | | | | | | | | chains, again. The prior implementation was very linked-list oriented, and the list-splicing logic was both fairly convoluted (when loading from multiple modules) and failed to preserve a reasonable ordering for the redeclaration chains. This new implementation uses a simpler strategy, where we store the ordered redeclaration chains in an array-like structure (indexed based on the first declaration), and use that ordering to add individual deserialized declarations to the end of the existing chain. That way, the chain mimics the ordering from its modules, and a bug somewhere is far less likely to result in a broken linked list. llvm-svn: 148222
* Initialize member that ends up in PCH files.Benjamin Kramer2011-12-271-1/+1
| | | | llvm-svn: 147288
* Completely re-implement (de-)serialization of declarationDouglas Gregor2011-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Switch the ID numbers used for submodule IDs in the AST reader over toDouglas Gregor2011-12-011-2/+6
| | | | | | | | a standard global/local scheme, so that submodule definitions will eventually be able to refer to submodules in other top-level modules. We'll need this functionality soonish. llvm-svn: 145549
* Promote ModuleMap::Module to a namespace-scope class in the BasicDouglas Gregor2011-11-301-3/+3
| | | | | | | | | library, since modules cut across all of the libraries. Rename serialization::Module to serialization::ModuleFile to side-step the annoying naming conflict. Prune a bunch of ModuleMap.h includes that are no longer needed (most files only needed the Module type). llvm-svn: 145538
* [PCH] Keep track of file-level declarations that are contained by files.Argyrios Kyrtzidis2011-10-281-0/+1
| | | | | | | | | | | | Introduce a FILE_SORTED_DECLS [de]serialization record that contains a file sorted array of file-level DeclIDs in a PCH/Module. The rationale is to allow "targeted" deserialization of decls inside a range of a source file. Cocoa PCH increased by 0.8% Difference of creation time for Cocoa PCH is below the noise level. llvm-svn: 143238
* [PCH] Overhaul how preprocessed entities are [de]serialized.Argyrios Kyrtzidis2011-09-151-12/+4
| | | | | | | | | | | | | -Use an array of offsets for all preprocessed entities -Get rid of the separate array of offsets for just macro definitions; for references to macro definitions use an index inside the preprocessed entities array. -Deserialize each preprocessed entity lazily, at first request; not in bulk. Paves the way for binary searching of preprocessed entities that will offer efficiency and will simplify things on the libclang side a lot. llvm-svn: 139809
* Factor the Module and ModuleManager classes out into separate headersDouglas Gregor2011-08-251-0/+117
and .cpp files, since ASTReader.cpp was getting way too large. No functionality change. llvm-svn: 138582
OpenPOWER on IntegriCloud