summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* AST representation for user-defined literals, plus just enough of semanticRichard Smith2012-03-071-0/+1
| | | | | | | | | | | | | | | | | | | | | analysis to make the AST representation testable. They are represented by a new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic properties, including full CodeGen support, are achieved for free by this representation. UserDefinedLiterals can never be dependent, so no custom instantiation behavior is required. They are mangled as if they were direct calls to the underlying literal operator. This matches g++'s apparent behavior (but not its actual mangling, which is broken for literal-operator-ids). User-defined *string* literals are now fully-operational, but the semantic analysis is quite hacky and needs more work. No other forms of user-defined literal are created yet, but the AST support for them is present. This patch committed after midnight because we had already hit the quota for new kinds of literal yesterday. llvm-svn: 152211
* [PCH] Mark a PCH file with a flag to indicate if the serialized AST hadArgyrios Kyrtzidis2012-03-071-2/+7
| | | | | | | | | | | | | | | | compiler errors or not. -Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time. By default, such a PCH file will be rejected with an error when trying to load it. [libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors occurred. -Have libclang API calls accept a PCH that had compiler errors. The general idea is that we want libclang to stay functional even if a PCH had a compiler error. rdar://10976363. llvm-svn: 152192
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-0/+4
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes andRichard Smith2012-02-251-0/+9
| | | | | | | | | data members for deleted or user-provided destructors. Now it's computed in advance, serialize it, and in passing fix all the other record DefinitionData flags whose serialization was missing. llvm-svn: 151441
* Change the text of a FIXME.Argyrios Kyrtzidis2012-02-241-1/+2
| | | | llvm-svn: 151387
* [PCH] When keeping track of top-level decls for "targeted deserialization"Argyrios Kyrtzidis2012-02-241-0/+3
| | | | | | | | make sure we don't mistake ParmVarDecls for top-level decls. Fixes rdar://10920009. llvm-svn: 151330
* Improve our handling of lambda expressions that occur within defaultDouglas Gregor2012-02-211-0/+1
| | | | | | | | | | | | | | | | | | | arguments. There are two aspects to this: - Make sure that when marking the declarations referenced in a default argument, we don't try to mark local variables, both because it's a waste of time and because the semantics are wrong: we're not in a place where we could capture these variables again even if it did make sense. - When a lambda expression occurs in a default argument of a function template, make sure that the corresponding closure type is considered dependent, so that it will get properly instantiated. The second bit is a bit of a hack; to fix it properly, we may have to rearchitect our handling of default arguments, parsing them only after creating the function definition. However, I'd like to separate that work from the lambdas work. llvm-svn: 151076
* Implement name mangling for lambda expressions that occur within theDouglas Gregor2012-02-211-0/+1
| | | | | | | | | | | | | | | | default arguments of function parameters. This simple-sounding task is complicated greatly by two issues: (1) Default arguments aren't actually a real context, so we need to maintain extra state within lambda expressions to track when a lambda was actually in a default argument. (2) At the time that we parse a default argument, the FunctionDecl doesn't exist yet, so lambda closure types end up in the enclosing context. It's not clear that we ever want to change that, so instead we introduce the notion of the "effective" context of a declaration for the purposes of name mangling. llvm-svn: 151011
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-201-0/+1
| | | | | | | | | | | | | | | name mangling in the Itanium C++ ABI for lambda expressions is so dependent on context, we encode the number used to encode each lambda as part of the lambda closure type, and maintain this value within Sema. Note that there are a several pieces still missing: - We still get the linkage of lambda expressions wrong - We aren't properly numbering or mangling lambda expressions that occur in default function arguments or in data member initializers. - We aren't (de-)serializing the lambda numbering tables llvm-svn: 150982
* Implement AST (de-)serialization for lambda expressions.Douglas Gregor2012-02-141-0/+19
| | | | llvm-svn: 150491
* Within the body of a lambda expression, decltype((x)) for anDouglas Gregor2012-02-121-0/+1
| | | | | | | | | | | | | | | | id-expression 'x' will compute the type based on the assumption that 'x' will be captured, even if it isn't captured, per C++11 [expr.prim.lambda]p18. There are two related refactors that go into implementing this: 1) Split out the check that determines whether we should capture a particular variable reference, along with the computation of the type of the field, from the actual act of capturing the variable. 2) Always compute the result of decltype() within Sema, rather than AST, because the decltype() computation is now context-sensitive. llvm-svn: 150347
* Track whether a function type has a trailing return type as type sugar. Use thisRichard Smith2012-02-101-1/+1
| | | | | | | | | | | to pretty-print such function types better, and to fix a case where we were not instantiating templates in lexical order. In passing, move the Variadic bit from Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits. Also ensure that we always substitute the return type of a function when substituting explicitly-specified arguments, since that can cause us to bail out with a SFINAE error before we hit a hard error in parameter substitution. llvm-svn: 150241
* Revert my patches which removed Diagnostic.h includes by moving some ↵Benjamin Kramer2012-02-071-1/+0
| | | | | | | | | | | | | | | | | | operator overloads out of line. This seems to negatively affect compile time onsome ObjC tests (which use a lot of partial diagnostics I assume). I have to come up with a way to keep them inline without including Diagnostic.h everywhere. Now adding a new diagnostic requires a full rebuild of e.g. the static analyzer which doesn't even use those diagnostics. This reverts commit 6496bd10dc3a6d5e3266348f08b6e35f8184bc99. This reverts commit 7af19b817ba964ac560b50c1ed6183235f699789. This reverts commit fdd15602a42bbe26185978ef1e17019f6d969aa7. This reverts commit 00bd44d5677783527d7517c1ffe45e4d75a0f56f. This reverts commit ef9b60ffed980864a8db26ad30344be429e58ff5. llvm-svn: 150006
* Added source location for the template keyword in ↵Abramo Bagnara2012-02-061-0/+1
| | | | | | | | | | DependentTemplateSpecializationTypeLoc nodes (DTSTLoc). The new info is propagated to TSTLoc on template instantiation, getting rid of 3 FIXMEs in TreeTransform.h and another one Parser.cpp. Simplified code in TypeSpecLocFiller visitor methods for DTSTLoc and DependentNameTypeLoc by removing what now seems to be dead code (adding corresponding assertions). llvm-svn: 149923
* Removed redundant location info from ElaboratedTypeLoc / DependentNameLoc / ↵Abramo Bagnara2012-02-061-2/+2
| | | | | | DependentTSTLoc. Uniformed names referencing elaborated keyword. No intended functionality changes. llvm-svn: 149889
* Added location for template keyword in TemplateSpecializationTypeLoc. In the ↵Abramo Bagnara2012-02-061-2/+3
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-11/+11
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move various diagnostic operator<< overloads out of line and remove includes ↵Benjamin Kramer2012-02-041-0/+1
| | | | | | | | | of Diagnostic.h. Fix all the files that depended on transitive includes of Diagnostic.h. With this patch in place changing a diagnostic no longer requires a full rebuild of the StaticAnalyzer. llvm-svn: 149781
* Introduce module attributes into the module map grammar, along with aDouglas Gregor2012-01-271-1/+3
| | | | | | | | | | | | | single attribute ("system") that allows us to mark a module as being a "system" module. Each of the headers that makes up a system module is considered to be a system header, so that we (for example) suppress warnings there. If a module is being inferred for a framework, and that framework directory is within a system frameworks directory, infer it as a system framework. llvm-svn: 149143
* Reimplement (de-)serialization of Objective-C categories to eliminateDouglas Gregor2012-01-271-32/+58
| | | | | | | | | | | | | | 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
* Rework the way in which we (de-)serialize the declarationsDouglas Gregor2012-01-171-2/+2
| | | | | | | | | | | | | | | | 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
* Delay the creation of the built-in Objective-C class 'Protocol' byDouglas Gregor2012-01-171-1/+2
| | | | | | | moving it from a "special type" to a predefined declaration, as we do for id, Class, and SEL. llvm-svn: 148313
* When deserializing the definition of a C++ class/ObjC class/ObjCDouglas Gregor2012-01-151-58/+0
| | | | | | | | | | | | | | | 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-151-21/+72
| | | | | | | | | | | | | | | | 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
* Don't seed the ASTWriter's declaration -> ID mapping with the IDs ofDouglas Gregor2012-01-051-4/+11
| | | | | | | 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-051-1/+1
| | | | | | | | | | | | | | | 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
* Store the submodules of a module in source order, as they are storedDouglas Gregor2012-01-041-15/+6
| | | | | | | | 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
* Eliminate ObjCForwardProtocolDecl, which is redundant now thatDouglas Gregor2012-01-011-1/+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
* Introduce the core infrastructure needed to model redeclaration chainsDouglas Gregor2012-01-011-0/+19
| | | | | | | | | | | | | | | 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
* Implement support for module requirements, which indicate the languageDouglas Gregor2011-12-311-0/+14
| | | | | | | | | 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
* Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDeclDouglas Gregor2011-12-271-1/+0
| | | | | | | covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
* Serialize the AST reader's mapping from canonical declarations to theDouglas Gregor2011-12-221-1/+21
| | | | | | | | | | | | | | | | 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
* When we make a previously-deserialized module definition visible,Douglas Gregor2011-12-201-1/+6
| | | | | | | notify the AST deserialization listener so that the AST writer knows that it can write the macro definition. llvm-svn: 146994
* Detect when mapping a #include/#import over to a submodule ends upDouglas Gregor2011-12-201-1/+0
| | | | | | | | | | | | | 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-191-16/+5
| | | | | | | format. It's no longer being used, now that we have a new implementation of redeclaration chains. llvm-svn: 146905
* Begin adding AVX2 intrinsics. Necessitated increasing the number of bits ↵Craig Topper2011-12-191-0/+1
| | | | | | used to store builtinID when serializing identifier table. llvm-svn: 146855
* Completely re-implement (de-)serialization of declarationDouglas Gregor2011-12-171-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Introduce the core infrastructure needed to model a completeDouglas Gregor2011-12-151-3/+20
| | | | | | | | | | | | | | | 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
* Tweak submodule ID handling in the AST writerDouglas Gregor2011-12-121-5/+9
| | | | llvm-svn: 146445
* Implement umbrella directories for modules, which are similar toDouglas Gregor2011-12-081-3/+13
| | | | | | | | | | | | | | | 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-081-2/+2
| | | | | | | | | | 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
* Implement inferred submodules support, which (when requested)Douglas Gregor2011-12-061-13/+26
| | | | | | | 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-051-0/+6
| | | | | | | Module, and (de-)serialize this information. Semantics of inferred submodules to follow. llvm-svn: 145864
* Implement support for wildcard exports in modules, allowing a moduleDouglas Gregor2011-12-051-1/+2
| | | | | | | | to re-export anything that it imports. This opt-in feature makes a module behave more like a header, because it can be used to re-export the transitive closure of a (sub)module's dependencies. llvm-svn: 145811
* Actually add a useful bit to the comment pre-FIXMEDouglas Gregor2011-12-051-1/+1
| | | | llvm-svn: 145809
* When writing a module file, keep track of the set of (sub)modules thatDouglas Gregor2011-12-051-16/+32
| | | | | | | it imports, establishing dependencies at the (sub)module granularity. This is not a user-visible change (yet). llvm-svn: 145808
* Module files representing actual modules don't need to know the set of ↵Douglas Gregor2011-12-031-19/+20
| | | | | | modules they import, since that information isn't actually used. Drop it from the AST file llvm-svn: 145738
* Implement support for precompiled headers, preambles, and serializedDouglas Gregor2011-12-031-0/+21
| | | | | | | | "main" files that import modules. When loading any of these kinds of AST files, we make the modules that were imported visible into the translation unit that loaded the PCH file or preamble. llvm-svn: 145737
OpenPOWER on IntegriCloud