summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Extend the ASTContext constructor to delay the initialization ofDouglas Gregor2011-09-021-1/+1
| | | | | | | | builtin types (When requested). This is another step toward making ASTUnit build the ASTContext as needed when loading an AST file, rather than doing so after the fact. No actual functionality change (yet). llvm-svn: 138985
* Modules hide macro definitions by default, so that silly things likeDouglas Gregor2011-09-011-32/+51
| | | | | | | | | | | include guards don't show up as macro definitions in every translation unit that imports a module. Macro definitions can, however, be exported with the intentionally-ugly #__export_macro__ directive. Implement this feature by not even bothering to serialize non-exported macros to a module, because clients of that module need not (should not) know that these macros even exist. llvm-svn: 138943
* Support importing of ObjC categories from modules.Argyrios Kyrtzidis2011-09-011-0/+34
| | | | | | | | | | | | The initial incentive was to fix a crash when PCH chaining categories to an interface, but the fix was done in the "modules way" that I hear is popular with the kids these days. Each module stores the local chain of categories and we combine them when the interface is loaded. We also warn if non-dependent modules introduce duplicate named categories. llvm-svn: 138926
* Serialize the new bits in CXXRecordDecl::DefinitionData.Sebastian Redl2011-08-311-0/+2
| | | | llvm-svn: 138855
* When writing out the entries in a lookup table for a DeclContext, makeDouglas Gregor2011-08-301-1/+24
| | | | | | | | sure that all of the CXXConversionDecls go into the same bucket. Otherwise, name lookup might not find them all. Fixes <rdar://problem/10041960>. llvm-svn: 138824
* In ASTWriter::WriteDeclContextVisibleBlock, don't write empty lookups.Argyrios Kyrtzidis2011-08-301-2/+4
| | | | | | | Empty lookups can occur in the DeclContext map when we are chaining PCHs, where the empty lookup indicates that we already looked in ExternalASTSource. llvm-svn: 138816
* Remove obsolete ObjCInferRelatedReturnType from LangOptions...the correct ↵Jordy Rose2011-08-301-1/+0
| | | | | | option is ObjCInferRelatedResultType. llvm-svn: 138793
* Don't force the complete deserialization of the visible-declarationsDouglas Gregor2011-08-241-3/+1
| | | | | | | | | | table when serializing an AST file. This was a holdover from the days before chained PCH, and is a complete waste of time and storage now. It's a good thing it's useless, because I have no idea how I would have implemented MaterializeVisibleDecls efficiently in the presence of modules. llvm-svn: 138496
* Boost the efficiency of SourceManager::getMacroArgExpandedLocation.Argyrios Kyrtzidis2011-08-211-0/+3
| | | | | | | | | | | | | | | | | | Currently getMacroArgExpandedLocation is very inefficient and for the case of a location pointing at the main file it will end up checking almost all of the SLocEntries. Make it faster: -Use a map of macro argument chunks to their expanded source location. The map is for a single source file, it's stored in the file's ContentCache and lazily computed, like the source lines cache. -In SLocEntry's FileInfo add an 'unsigned NumCreatedFIDs' field that keeps track of the number of FileIDs (files and macros) that were created during preprocessing of that particular file SLocEntry. This is useful when computing the macro argument map in skipping included files while scanning for macro arg FileIDs that lexed from a specific source file. Due to padding, the new field does not increase the size of SLocEntry. llvm-svn: 138225
* Keep track of which modules have been loaded directly (e.g., viaDouglas Gregor2011-08-181-15/+20
| | | | | | | | | | | | | -import-module) vs. loaded because some other module depends on them. As part of doing this, pass down the module that caused a module to be loaded directly, rather than assuming that we're loading a chain. Finally, write out all of the directly-loaded modules when serializing an AST file (using the new IMPORTS record), so that an AST file can depend on more than one other AST file, all of which will be loaded when that AST file is loaded. This allows us to form and load a tree of modules, but we can't yet load a DAG of modules. llvm-svn: 137923
* In the AST file format, eliminate the CHAINED_METADATA record. Instead,Douglas Gregor2011-08-171-10/+22
| | | | | | | | | | | | | all AST files have a normal METADATA record that has the same form regardless of whether we refer to a chained PCH or any other kind of AST file. Introduce the IMPORTS record, which describes all of the AST files that are imported by this AST file, and how (as a module, a PCH file, etc.). Currently, we emit at most one entry to this record, to support chained PCH. llvm-svn: 137869
* [PCH] When writing out ExpansionInfo, make sure we don't lose track if it's ↵Argyrios Kyrtzidis2011-08-171-1/+2
| | | | | | a macro arg expansion or not. llvm-svn: 137792
* Switch the __int128_t and __uint128_t types over to predefined typesDouglas Gregor2011-08-121-1/+4
| | | | | | | in the AST format, which are built lazily by the ASTContext when requested. llvm-svn: 137437
* Switch the Objective-C 'SEL' type over to a predefined type in theDouglas Gregor2011-08-121-1/+2
| | | | | | | AST file format, lazily generating the actual declaration in ASTContext as needed. llvm-svn: 137434
* Switch the Objective-C 'Class' type over to a predefined type in theDouglas Gregor2011-08-121-2/+3
| | | | | | | AST file format, lazily generating the actual declaration in ASTContext as needed. llvm-svn: 137431
* Move the creation of the predefined typedef for Objective-C's 'id'Douglas Gregor2011-08-121-2/+3
| | | | | | | | | type over into the AST context, then make that declaration a predefined declaration in the AST format. This ensures that different AST files will at least agree on the (global) declaration ID for 'id', and eliminates one of the "special" types in the AST file format. llvm-svn: 137429
* Collapse ASTWriter::WriteASTChain into ASTWriter::WriteASTCore,Douglas Gregor2011-08-121-306/+103
| | | | | | | | eliminating a pile of redundant code (and probably some bugs in the process). The variation between chained and non-chained PCH is fairly small now anyway. llvm-svn: 137410
* In the serialized AST format, make the translation unit a "predefined"Douglas Gregor2011-08-121-5/+46
| | | | | | | | | | declaration that never actually gets serialized. Instead, serialize the various kinds of update records (lexical decls, visible decls, the addition of an anonymous namespace) for the translation unit, even if we're not chaining. This way, we won't have to deal with multiple loaded translation unit declarations. llvm-svn: 137395
* The AST reader and writer don't need accessors for poking at the predefined ↵Douglas Gregor2011-08-111-4/+4
| | | | | | Objective-C types llvm-svn: 137366
* Renamings to consistently use 'Constexpr' not 'ConstExpr' when referring to ↵Richard Smith2011-08-101-1/+1
| | | | | | the C++0x 'constexpr' keyword. llvm-svn: 137230
* Move the creation of the record type for the state of Objective-C fastDouglas Gregor2011-08-091-1/+0
| | | | | | | | enumerations from the ASTContext into CodeGen, so that we don't need to serialize it to AST files. This appears to be the last of the low-hanging fruit for SpecialTypes. llvm-svn: 137124
* Don't serialize the block descriptor or block extended descriptorDouglas Gregor2011-08-091-2/+0
| | | | | | | types to AST files; they're only used by debug info generation anyway, and shouldn't ever exist in the AST anyway. llvm-svn: 137122
* Move the construction of the RecordDecl representing the runtimeDouglas Gregor2011-08-091-1/+0
| | | | | | | | layout of a constant NSString from the ASTContext over to CodeGen, since this is solely CodeGen's responsibility. Eliminates one of the unnecessary "special" types that we serialize. llvm-svn: 137121
* Migrate the serialization of ASTContext's AutoDeduceTy andDouglas Gregor2011-08-091-6/+6
| | | | | | | AutoRRefDeductTy from the "special types" block to predefined types. The latter behaves better when loading multiple AST files. llvm-svn: 137120
* Introduce local -> global mapping for preprocessed entity IDs. This isDouglas Gregor2011-08-041-2/+6
| | | | | | | | | the last of the ID/offset/index mappings that I know of. Unfortunately, the "gap" method of testing doesn't work here due to the way the preprocessing record performs iteration. We'll do more testing once multi-AST loading is possible. llvm-svn: 136902
* In the AST reader and writer, slide the preprocessed entity IDs by +1Douglas Gregor2011-08-041-4/+6
| | | | | | | so that we use ID zero as a sentinel for "no result". This matches the convention set by all of the other global IDs. llvm-svn: 136885
* Add some missing record names to the AST output. No functionality change, ↵Douglas Gregor2011-08-041-0/+3
| | | | | | but llvm-bcanalyzer will be a little more informative now for AST files llvm-svn: 136883
* Implement the local -> global remapping for macro definition IDs inDouglas Gregor2011-08-041-1/+3
| | | | | | the detailed preprocessing record. Tested with the standard "gaps" method. llvm-svn: 136882
* Don't introduce a local -> global mapping for CXXBaseSpecifiers. TheDouglas Gregor2011-08-041-7/+3
| | | | | | | | IDs will never cross module boundaries, since they're tied to the CXXDefinitionData, so just use a local mapping throughout. Eliminate the global -> local tables and supporting data. llvm-svn: 136847
* Introduce local -> global selector ID mapping into the ASTDouglas Gregor2011-08-031-2/+4
| | | | | | reader. Tested with the usual "gaps" method. llvm-svn: 136839
* Introduce a local-to-global remapping for identifiers in the ASTDouglas Gregor2011-08-031-1/+4
| | | | | | | reader, and fix up the one (!) place where we were improperly mapping a local ID to a global ID. Tested via the usual "gaps" trick. llvm-svn: 136817
* Introduce a constant for the number of predefined declarations in anDouglas Gregor2011-08-031-2/+2
| | | | | | | | AST file, along with an enumeration naming those predefined declarations. No functionality change, but this will make it easier to introduce new predefined declarations, when/if we need them. llvm-svn: 136781
* Introduce the local -> global declaration ID mapping into the ASTDouglas Gregor2011-08-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | reader, to allow AST files to be loaded with their declarations remapped to different ID numbers. Fix a number of places where we were either failing to map local declaration IDs into global declaration IDs or where interpreting the local declaration IDs within the wrong module. I've tested this via the usual "random gaps" method. It works well except for the preamble tests, because our handling of the precompiled preamble requires declaration and preprocessed entity to be stable when parsing code and then loading that back into memory. This property will hold in general, but my randomized testing naturally breaks this property to get more coverage. In the future, I expect that the precompiled preamble logic won't need this property. I am very unhappy with the current handling of the translation unit, which is a rather egregious hack. We're going to have to do something very different here for loading multiple AST files, because we don't want to have to cope with merging two translation units. Likely, we'll just handle translation units entirely via "update" records, and predefine a single, fixed declaration ID for the translation unit. That will come later. llvm-svn: 136779
* Change the hashing function for DeclContext lookup within an AST fileDouglas Gregor2011-08-021-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | by eliminating the type ID from constructor, destructor, and conversion function names. There are several reasons for this change: - A given type (say, int*) isn't guaranteed to have a single, unique type ID within a chain of PCH files. Hence, we could end up hashing based on the wrong type ID, causing name lookup to fail. - The mapping from types back to type IDs required one DenseMap entry for every type that was ever deserialized, which was an unacceptable cost to support just the name lookup of constructors, destructors, and conversion functions. Plus, this mapping could never actually work with chained or multiple PCH, based on the first bullet. Once we have eliminated the type from the hash function, these problems go away, as does my horrible "reverse type remap" hack, which was doomed from the start (see bullet #1 above) and far too complicated. However, note that removing the type from the hash function means that all constructors, destructors, and conversion functions have the same hash key, so I've updated the caller to double-check that the declarations found have the appropriate name. llvm-svn: 136708
* Implement a proper local -> global type ID remapping scheme in the ASTDouglas Gregor2011-08-021-24/+26
| | | | | | | | | | | | | | | | | | | | | | reader. This scheme permits an AST file to be loaded with its type IDs shifted anywhere in the type ID space. At present, the type indices are still allocated in the same boring way they always have been, just by adding up the number of types in each PCH file within the chain. However, I've done testing with this patch by randomly sliding the base indices at load time, to ensure that remapping is occurring as expected. I may eventually formalize this in some testing flag, but loading multiple (non-chained) AST files at once will eventually exercise the same code. There is one known problem with this patch, which involves name lookup of operator names (e.g., "x.operator int*()") in cases where multiple PCH files in the chain. The hash function itself depends on having a stable type ID, which doesn't happen with chained PCH and *certainly* doesn't happen when sliding type IDs around. We'll need another approach. I'll tackle that next. llvm-svn: 136693
* Generalize the module offset map to include mapping information forDouglas Gregor2011-08-021-18/+26
| | | | | | | | all of the kinds of IDs that can be offset. No effectively functionality change; this is preparation for adding remapping for IDs. llvm-svn: 136686
* Move the serialization of the MODULE_OFFSET_MAP out of the ↵Douglas Gregor2011-08-011-32/+35
| | | | | | source-manager-writing code and into the general chained-PCH writing code llvm-svn: 136624
* Rename the AST file's SOURCE_LOCATION_MAP to MODULE_OFFSET_MAP, to indicate ↵Douglas Gregor2011-08-011-2/+2
| | | | | | the greater role it will soon play in remapping. llvm-svn: 136619
* Lazily deserialize Sema::VTableUses. Plus, fix the utterly andDouglas Gregor2011-07-281-2/+0
| | | | | | | | completely broken deserialization mapping code we had for VTableUses, which would have broken horribly as soon as our local-to-global ID mapping became interesting. llvm-svn: 136371
* Make Sema::WeakUndeclaredIdentifiers lazily deserialized.Douglas Gregor2011-07-281-6/+2
| | | | llvm-svn: 136368
* Make Sema::LocallyScopedExternalDecls lazily deserialized. In theory,Douglas Gregor2011-07-281-3/+5
| | | | | | | | | we could turn this into an on-disk hash table so we don't load the whole thing the first time we need it. However, it tends to be very, very small (i.e., empty) for most precompiled headers, so it isn't all that interesting. llvm-svn: 136352
* AST serialization support for the Framework in IndexHeaderMapHeaderDouglas Gregor2011-07-281-6/+35
| | | | | | fields of HeaderFileInfo. llvm-svn: 136332
* Switch Sema::DynamicClasses over to LazyVectorDouglas Gregor2011-07-281-5/+2
| | | | llvm-svn: 136317
* Switch Sema::ExtVectorDecls over to LazyVector.Douglas Gregor2011-07-281-6/+2
| | | | llvm-svn: 136314
* Turn Sema::DelegatingCtorDecls into a LazyVector.Douglas Gregor2011-07-271-6/+2
| | | | llvm-svn: 136273
* Switch Sema::UnusedFileScopedDecls over to a LazyVector. Douglas Gregor2011-07-271-18/+15
| | | | | | | | | - Added LazyVector::erase() to support this use case. - Factored out the LazyDecl-of-Decls to RecordData translation in the ASTWriter. There is still a pile of code duplication here to eliminate. llvm-svn: 136270
* Introduce a new data structure, LazyVector, which is a vector whoseDouglas Gregor2011-07-271-7/+12
| | | | | | | | | | | | | contents are lazily loaded on demand from an external source (e.g., an ExternalASTSource or ExternalSemaSource). The "loaded" entities are kept separate from the "local" entities, so that the two can grow independently. Switch Sema::TentativeDefinitions from a normal vector that is eagerly populated by the ASTReader into one of these LazyVectors, making the ASTReader a bit more like me (i.e., lazy). llvm-svn: 136262
* This patch extends the previous patch by starting to incorporate more ↵Jonathan D. Turner2011-07-261-9/+4
| | | | | | functionality, like lookup-by-name and exporting lookup tables, into the module manager. Methods now have documentation. A few more functions have been switched over to the new iterator style and away from manual/explicit iteration. Ultimately we want to move away from name lookup here, as symlinks make filenames not a safe unique value, but we use it here as a stopgap before better measures are in place (namely instead using FileEntry* from a global FileManager). llvm-svn: 136107
* Migrate 'Instantiation' data and API bits of SLocEntry to 'Expansion'Chandler Carruth2011-07-261-1/+1
| | | | | | | | etc. With this I think essentially all of the SourceManager APIs are converted. Comments and random other bits of cleanup should be all thats left. llvm-svn: 136057
* Convert InstantiationInfo and much of the related code to ExpansionInfoChandler Carruth2011-07-261-4/+4
| | | | | | | | | and various other 'expansion' based terms. I've tried to reformat where appropriate and catch as many references in comments but I'm going to do several more passes. Also I've tried to expand parameter names to be more clear where appropriate. llvm-svn: 136056
OpenPOWER on IntegriCloud