summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't separately serialize the list of instance variables in anDouglas Gregor2012-01-262-13/+0
| | | | | | Objective-C class. The AST reader just throws away this data anyway! llvm-svn: 149067
* Introduce a generation number for selector lookups in the globalDouglas Gregor2012-01-251-4/+16
| | | | | | | method pool, so that we don't perform the same lookups into the same PCH/module file repeatedly. llvm-svn: 148895
* Rework the external Sema source's ReadMethodPool() so that it doesn'tDouglas Gregor2012-01-251-35/+27
| | | | | | | return pre-built lists. Instead, it feeds the methods it deserializes to Sema so that Sema can unique them, which keeps the chains shorter. llvm-svn: 148889
* Only mark an IdentifierInfo as having changed since deserializationDouglas Gregor2012-01-242-5/+15
| | | | | | | | when it actually has changed (and not, e.g., when we've simply attached a deserialized macro definition). Good for ~1.5% reduction in module file size, mostly in the identifier table. llvm-svn: 148808
* Optimize unqualified/global name lookup in modules by introducing aDouglas Gregor2012-01-183-15/+43
| | | | | | | | | | 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
* Rework the way in which we (de-)serialize the declarationsDouglas Gregor2012-01-172-10/+24
| | | | | | | | | | | | | | | | corresponding to TagType and ObjCInterfaceType. Previously, we would serialize the definition (if available) or the canonical declaration (if no definition was available). However, this can end up forcing the deserialization of the definition even through we might not want to yet. Instead, always serialize the canonical declaration reference in the TagType/ObjCInterfaceType entry, and as part of loading a pending definition, update the "decl" pointer within the type node to point at the definition. This is more robust in hard-to-isolate cases where the *Type gets built and filled in before we see the definition. llvm-svn: 148323
* When collecting all of the redeclarations of a declaration loaded fromDouglas Gregor2012-01-171-1/+4
| | | | | | | | a module file, be sure to also add the first (potentially canonical) declarations to the chain. This isn't guaranteed to occur because the first declaration is not listed in the stored redeclaration chain. llvm-svn: 148314
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-172-7/+6
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-172-18/+5
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-172-4/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* Now that deserializing a definition of a C++ class/Objective-CDouglas Gregor2012-01-152-39/+14
| | | | | | | | | | class/Objective-C protocol suffices get all of the redeclarations of that declaration wired to the definition, we no longer need to record the identity of the definition in every declaration. Instead, just record a bit to indicate whether a particular declaration is the definition. llvm-svn: 148224
* When deserializing the definition of a C++ class/ObjC class/ObjCDouglas Gregor2012-01-153-98/+25
| | | | | | | | | | | | | | | protocol, record the definition pointer in the canonical declaration for that entity, and then propagate that definition pointer from the canonical declaration to all other deserialized declarations. This approach works well even when deserializing declarations that didn't know about the original definition, which can occur with modules. A nice bonus from this definition-deserialization approach is that we no longer need update records when a definition is added, because the redeclaration chains ensure that the if any declaration is loaded, the definition will also get loaded. llvm-svn: 148223
* Completely re-implement (de-)serialization of redeclarationDouglas Gregor2012-01-155-136/+154
| | | | | | | | | | | | | | | | 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
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-142-11/+11
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Introduce Decl::getPreviousDecl() and Decl::getMostRecentDecl(),Douglas Gregor2012-01-141-42/+2
| | | | | | | | virtual functions that provide previous/most recent redeclaration information for any declaration. Use this to eliminate the redundant, less efficient getPreviousDecl() functions. llvm-svn: 148184
* Revert accidental commitDouglas Gregor2012-01-141-3/+1
| | | | llvm-svn: 148183
* Add a FIXME for mutation of the common pointer of a ↵Douglas Gregor2012-01-141-1/+3
| | | | | | RedeclarableTemplateDecl. It is not clear that it's worth delaying the allocation of said pointer llvm-svn: 148182
* Reimplement RedeclarableTemplateDecl in terms ofDouglas Gregor2012-01-143-87/+47
| | | | | | | | | | | Redeclarable<RedeclarableTemplateDecl>, eliminating a bunch of redeclaration-chain logic both in RedeclarableTemplateDecl and especially in its (de-)serialization. As part of this, eliminate the RedeclarableTemplate<> class template, which was an abstraction that didn't actually save anything. llvm-svn: 148181
* (Implicit) parameters deserialized as part of a function type must notDouglas Gregor2012-01-131-2/+4
| | | | | | | get added to the identifier chains as part of deserialization, because they should not be visible to name lookup. llvm-svn: 148159
* Progress towards making isUsed() reflect whether a declaration is odr-used; ↵Eli Friedman2012-01-131-0/+1
| | | | | | | | don't set isUsed for local variables which are referenced in unevaluated contexts. Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate. I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check. Someone who actually understands the semantics here should fix that. llvm-svn: 148158
* Add IsImplicit field in ObjCMessageExpr that is true when the messageArgyrios Kyrtzidis2012-01-122-0/+2
| | | | | | | | | | was constructed, e.g. for a property access. This allows the selector identifier locations machinery for ObjCMessageExpr to function correctly, in that there are not real locations to handle/report for such a message. llvm-svn: 148013
* When deserializing an anonymous namespace from a module, do not attachDouglas Gregor2012-01-091-8/+16
| | | | | | | | the anonymous namespace to its parent. Semantically, this means that the anonymous namespaces defined in one module are distinct from the anonymous namespaces defined in another module. llvm-svn: 147782
* Implement merging of namespace-scope declarations across modules, soDouglas Gregor2012-01-091-5/+11
| | | | | | | | | | that we can merge, for example, two occurrences of namespace N { void f(); } in two disjoint modules. llvm-svn: 147780
* Implement redeclaration merging for namespaces defined in distinctDouglas Gregor2012-01-092-10/+55
| | | | | | | | | modules. Teach name lookup into namespaces to search in each of the merged DeclContexts as well as the (now-primary) DeclContext. This supports the common case where two different modules put something into the same namespace. llvm-svn: 147778
* Pack UsingDecl more.Benjamin Kramer2012-01-072-2/+2
| | | | | | 88 -> 80 bytes on x86_64. llvm-svn: 147736
* Switch NamespaceDecl from its own hand-rolled redeclaration chain overDouglas Gregor2012-01-072-24/+31
| | | | | | | | | | | | to Redeclarable<NamespaceDecl>, so that we benefit from the improveed redeclaration deserialization and merging logic provided by Redeclarable<T>. Otherwise, no functionality change. As a drive-by fix, collapse the "inline" bit into the low bit of the original namespace/anonymous namespace, saving 8 bytes per NamespaceDecl on x86_64. llvm-svn: 147729
* During name lookup, use redecl_iterator to walk over the redeclarationDouglas Gregor2012-01-061-2/+5
| | | | | | | | | | | | | chain to determine whether any declaration of the given entity is visible, eliminating the redundant (and less efficient) getPreviousDeclaration() implementation. This tweak uncovered an omission in the handling of RedeclarableTemplateDecl, where we weren't making sure to search for additional redeclarations of a template in other module files. Things would be cleaner if RedeclarableTemplateDecl actually used Redeclarable. llvm-svn: 147687
* 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
OpenPOWER on IntegriCloud