summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement (de-)serialization of the set of exported modules in aDouglas Gregor2011-12-021-1/+14
| | | | | | module map. llvm-svn: 145695
* Notify the AST writer (via ASTDeserializationListener) when aDouglas Gregor2011-12-021-0/+5
| | | | | | | (sub)module is read from an AST file. This makes sure that the AST writer knows how to map all modules to their global IDs. llvm-svn: 145685
* Implement name hiding for macro definitions within modules, such thatDouglas Gregor2011-12-021-3/+6
| | | | | | | | only the macro definitions from visible (sub)modules will actually be visible. This provides the same behavior for macros that r145640 provided for declarations. llvm-svn: 145683
* Implement name hiding for declarations deserialized from a non-visibleDouglas Gregor2011-12-011-0/+4
| | | | | | module. When that module becomes visible, so do those declarations. llvm-svn: 145640
* Infer the submodule ID for a given declaration based on the locationDouglas Gregor2011-12-011-4/+40
| | | | | | | of that declaration, and encode the submodule ID in each declaration stored in an AST file. llvm-svn: 145555
* Switch the ID numbers used for submodule IDs in the AST reader over toDouglas Gregor2011-12-011-4/+27
| | | | | | | | 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-6/+6
| | | | | | | | | 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
* Implement (de-)serialization of the description of a module and itsDouglas Gregor2011-11-301-1/+84
| | | | | | | | | submodules. This information will eventually be used for name hiding when dealing with submodules. For now, we only use it to ensure that the module "key" returned when loading a module will always be a module (rather than occasionally being a FileEntry). llvm-svn: 145497
* When writing a module file, pass the module through to the ASTDouglas Gregor2011-11-301-5/+6
| | | | | | writer. No functionality change. llvm-svn: 145479
* Implement (de-)serialization of the buffer contents for an overriddenDouglas Gregor2011-11-161-4/+16
| | | | | | | | | | file in the source manager. This allows us to properly create and use modules described by module map files without umbrella headers (or with incompletely umbrella headers). More generally, we can actually build a PCH file that makes use of file -> buffer remappings, which could be useful in libclang in the future. llvm-svn: 144830
* Add a -cc1-level option -fmodule-name=<name>, which will be used whenDouglas Gregor2011-11-151-0/+3
| | | | | | building modules. llvm-svn: 144680
* [PCH] Do not crash if a class extension in a chained PCH ↵Argyrios Kyrtzidis2011-11-141-0/+14
| | | | | | introduces/redeclares a property. llvm-svn: 144520
* [PCH] In ASTWriter::WriteChainedObjCCategories use getDeclID since the declsArgyrios Kyrtzidis2011-11-141-6/+5
| | | | | | should have been already emitted. llvm-svn: 144519
* [PCH] When chaining a PCH and serializing HeaderSearch, make sure the ↵Argyrios Kyrtzidis2011-11-131-4/+6
| | | | | | | | | HeaderFileInfos from the primary PCH is deserialized, otherwise we lose info that headers were already #imported/#included. llvm-svn: 144510
* Fix the signature of the getcontext builtin. Patch by Dimitry Andric.Rafael Espindola2011-11-131-0/+1
| | | | llvm-svn: 144505
* Add a method in ASTMutationListener for the last use of Decl's ↵Argyrios Kyrtzidis2011-11-121-8/+8
| | | | | | | | [is/set]ChangedSinceDeserialization and remove them. llvm-svn: 144466
* [PCH] When completing an objc forward reference, do not serialize the chain ↵Argyrios Kyrtzidis2011-11-121-16/+15
| | | | | | | | | | | | | | | of its categories because it is going to be rewritten (and the chain will be serialized again), otherwise we may form a cycle in its categories list when deserializing. Also introduce ASTMutationListener::CompletedObjCForwardRef to notify that a forward reference was completed; using Decl's isChangedSinceDeserialization/setChangedSinceDeserialization is bug inducing and kinda gross, we should phase it out. Fixes infinite loop in rdar://10418538. llvm-svn: 144465
* Rework the AST for the initializer of a delegating constructor, soDouglas Gregor2011-11-011-2/+2
| | | | | | | | | that it retains source location information for the type. Aside from general goodness (being able to walk the types described in that information), we now have a proper representation for dependent delegating constructors. Fixes PR10457 (for real). llvm-svn: 143410
* [PCH] Now that we store the location of a decl outside its recordArgyrios Kyrtzidis2011-10-311-3/+4
| | | | | | make sure that we keep track of locations of replaced decls as well. llvm-svn: 143341
* [PCH] Sort the file decls by file offset not raw source location.Argyrios Kyrtzidis2011-10-281-4/+5
| | | | | | | Currently sorting by raw source location does work as intended but who knows what may change in the future.. llvm-svn: 143256
* [PCH] In ASTWriter::associateDeclWithFile don't bother finding the file locArgyrios Kyrtzidis2011-10-281-4/+7
| | | | | | if we are not interested in the decl. llvm-svn: 143255
* [PCH] Keep track of file-level declarations that are contained by files.Argyrios Kyrtzidis2011-10-281-43/+127
| | | | | | | | | | | | 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
* Make the loading of information attached to an IdentifierInfo from anDouglas Gregor2011-10-271-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST file more lazy, so that we don't eagerly load that information for all known identifiers each time a new AST file is loaded. The eager reloading made some sense in the context of precompiled headers, since very few identifiers were defined before PCH load time. With modules, however, a huge amount of code can get parsed before we see an @import, so laziness becomes important here. The approach taken to make this information lazy is fairly simple: when we load a new AST file, we mark all of the existing identifiers as being out-of-date. Whenever we want to access information that may come from an AST (e.g., whether the identifier has a macro definition, or what top-level declarations have that name), we check the out-of-date bit and, if it's set, ask the AST reader to update the IdentifierInfo from the AST files. The update is a merge, and we now take care to merge declarations before/after imports with declarations from multiple imports. The results of this optimization are fairly dramatic. On a small application that brings in 14 non-trivial modules, this takes modules from being > 3x slower than a "perfect" PCH file down to 30% slower for a full rebuild. A partial rebuild (where the PCH file or modules can be re-used) is down to 7% slower. Making the PCH file just a little imperfect (e.g., adding two smallish modules used by a bunch of .m files that aren't in the PCH file) tips the scales in favor of the modules approach, with 24% faster partial rebuilds. This is just a first step; the lazy scheme could possibly be improved by adding versioning, so we don't search into modules we already searched. Moreover, we'll need similar lazy schemes for all of the other lookup data structures, such as DeclContexts. llvm-svn: 143100
* For modules, all macros that aren't include guards are implicitlyDouglas Gregor2011-10-171-3/+4
| | | | | | | public. Add a __private_macro__ directive to hide a macro, similar to the __module_private__ declaration specifier. llvm-svn: 142188
* Rename TagDecl::isDefinition -> isCompleteDefinitionJohn McCall2011-10-071-2/+2
| | | | | | | for better self-documenting code, since the semantics are subtly different from getDefinition(). llvm-svn: 141355
* Support for C1x _Atomic specifier (see testcase). This is primarily being ↵Eli Friedman2011-10-061-0/+12
| | | | | | | | committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic. Thanks to Jeffrey Yasskin for the thorough review! llvm-svn: 141330
* Basic/Diagnostic: Add a DiagSate::getOrAddMappingInfo method.Daniel Dunbar2011-09-291-1/+1
| | | | | | - Also, spell const_iterator as const_iterator. llvm-svn: 140765
* Basic/Diagnostics: Add a DiagnosticMappingInfo helper class, and switch toDaniel Dunbar2011-09-291-4/+3
| | | | | | | storing mappings with that instead of straying some magic constants about the source. llvm-svn: 140760
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-4/+4
| | | | llvm-svn: 140478
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* [PCH] Don't store the source range for each preprocessed entity sinceArgyrios Kyrtzidis2011-09-201-8/+0
| | | | | | we already have the range in the PPEntityOffsets array. llvm-svn: 140209
* [PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntityArgyrios Kyrtzidis2011-09-201-4/+0
| | | | | | and don't store the ID for each preprocessed entity. llvm-svn: 140208
* The location of the name in MacroDefinition is the beginning of its range,Argyrios Kyrtzidis2011-09-201-1/+0
| | | | | | don't store an extra location for it. llvm-svn: 140190
* In libclang, when visiting preprocessed entities in a source range, useArgyrios Kyrtzidis2011-09-191-16/+1
| | | | | | | | | | PreprocessingRecord's getPreprocessedEntitiesInRange. Also remove all the stuff that were added in ASTUnit that are unnecessary now that we do a binary search for preprocessed entities and deserialize only what is necessary. llvm-svn: 140063
* Introduce local_begin()/local_end() methods in PreprocessingRecord whichArgyrios Kyrtzidis2011-09-191-3/+3
| | | | | | return iterators for local, non-loaded, preprocessed entities. llvm-svn: 140062
* Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()Argyrios Kyrtzidis2011-09-191-2/+3
| | | | | | | | | | which will do a binary search and return a pair of iterators for preprocessed entities in the given source range. Source ranges of preprocessed entities are stored twice currently in the PCH/Module file but this will be fixed in a subsequent commit. llvm-svn: 140058
* With modules, we can end up loading a new module after we've seen anDouglas Gregor2011-09-171-7/+69
| | | | | | | | | arbitrary amount of code. This forces us to stage the AST writer more strictly, ensuring that we don't assign a declaration ID to a declaration until after we're certain that no more modules will get loaded. llvm-svn: 139974
* [PCH] Overhaul how preprocessed entities are [de]serialized.Argyrios Kyrtzidis2011-09-151-51/+23
| | | | | | | | | | | | | -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
* Don't try to write a macro offset for an identifier that names a ↵Douglas Gregor2011-09-141-17/+13
| | | | | | non-exported macro, for real this time llvm-svn: 139745
* Revert my exported-macro hackery. Something is amissDouglas Gregor2011-09-141-12/+13
| | | | llvm-svn: 139734
* Make sure that we actually keep the key length and data length in sync when ↵Douglas Gregor2011-09-141-14/+12
| | | | | | dealing with non-exported macros llvm-svn: 139731
* Don't try to write a macro offset for an identifier that names a ↵Douglas Gregor2011-09-141-1/+2
| | | | | | non-exported macro llvm-svn: 139728
* Switch the serialization of LangOptions over to use the .def file. WeDouglas Gregor2011-09-131-87/+5
| | | | | | | should no longer have the serialization of LangOptions out of sync with the structure itself (yay). llvm-svn: 139613
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-2/+2
| | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
* Keep the source range of attributes. Depends on a llvm tablegen commit.Argyrios Kyrtzidis2011-09-131-1/+1
| | | | llvm-svn: 139600
* Eliminate all but one caller of Decl::getPCHLevel()Douglas Gregor2011-09-091-2/+0
| | | | llvm-svn: 139430
* Introduce a new predicate Decl::isFromASTFile() to determine whether aDouglas Gregor2011-09-091-14/+14
| | | | | | | | declaration was deserialized from an AST file. Use this instead of Decl::getPCHLevel() wherever possible. This is a simple step toward killing off Decl::getPCHLevel(). llvm-svn: 139427
* [libclang] Fix annotation and getting a "macro expansion" cursorArgyrios Kyrtzidis2011-09-081-2/+5
| | | | | | for a builtin macro expansion. llvm-svn: 139298
* Implement the Objective-C 'instancetype' type, which is an alias ofDouglas Gregor2011-09-081-0/+2
| | | | | | | | | | 'id' that can be used (only!) via a contextual keyword as the result type of an Objective-C message send. 'instancetype' then gives the method a related result type, which we have already been inferring for a variety of methods (new, alloc, init, self, retain). Addresses <rdar://problem/9267640>. llvm-svn: 139275
* Finish implementing (de-)serialization of the CXXDefinitionData bitsDouglas Gregor2011-09-061-0/+4
| | | | | | | needed for implicit move constructors and move assignment operators. Fixes PR10847. llvm-svn: 139144
OpenPOWER on IntegriCloud