summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/ASTWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement two related optimizations that make de-serialization ofDouglas Gregor2011-02-101-21/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AST/PCH files more lazy: - Don't preload all of the file source-location entries when reading the AST file. Instead, load them lazily, when needed. - Only look up header-search information (whether a header was already #import'd, how many times it's been included, etc.) when it's needed by the preprocessor, rather than pre-populating it. Previously, we would pre-load all of the file source-location entries, which also populated the header-search information structure. This was a relatively minor performance issue, since we would end up stat()'ing all of the headers stored within a AST/PCH file when the AST/PCH file was loaded. In the normal PCH use case, the stat()s were cached, so the cost--of preloading ~860 source-location entries in the Cocoa.h case---was relatively low. However, the recent optimization that replaced stat+open with open+fstat turned this into a major problem, since the preloading of source-location entries would now end up opening those files. Worse, those files wouldn't be closed until the file manager was destroyed, so just opening a Cocoa.h PCH file would hold on to ~860 file descriptors, and it was easy to blow through the process's limit on the number of open file descriptors. By eliminating the preloading of these files, we neither open nor stat the headers stored in the PCH/AST file until they're actually needed for something. Concretely, we went from *** HeaderSearch Stats: 835 files tracked. 364 #import/#pragma once files. 823 included exactly once. 6 max times a file is included. 3 #include/#include_next/#import. 0 #includes skipped due to the multi-include optimization. 1 framework lookups. 0 subframework lookups. *** Source Manager Stats: 835 files mapped, 3 mem buffers mapped. 37460 SLocEntry's allocated, 11215575B of Sloc address space used. 62 bytes of files mapped, 0 files with line #'s computed. with a trivial program that uses a chained PCH including a Cocoa PCH to *** HeaderSearch Stats: 4 files tracked. 1 #import/#pragma once files. 3 included exactly once. 2 max times a file is included. 3 #include/#include_next/#import. 0 #includes skipped due to the multi-include optimization. 1 framework lookups. 0 subframework lookups. *** Source Manager Stats: 3 files mapped, 3 mem buffers mapped. 37460 SLocEntry's allocated, 11215575B of Sloc address space used. 62 bytes of files mapped, 0 files with line #'s computed. for the same program. llvm-svn: 125286
* AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actionsPeter Collingbourne2011-02-091-0/+1
| | | | llvm-svn: 125217
* AST, Sema, Serialization: keep track of cudaConfigureCallPeter Collingbourne2011-02-091-0/+9
| | | | llvm-svn: 125216
* Split the serialized representation for the detailed preprocessingDouglas Gregor2011-02-081-81/+97
| | | | | | | | | | record away from the core processor record. The tangling of these two data structures led to some inefficiencies (e.g., deserializing all of the detailed preprocessing record when we didn't need it, such as while performing code completion) along with some unnecessary ugliness. llvm-svn: 125117
* Update the writing of the block-information block in the AST fileDouglas Gregor2011-02-081-2/+82
| | | | | | | format, so that llvm-bcanalyzer knows about all of the various record kinds. llvm-svn: 125086
* Basic implementation of inherited constructors. Only generates declarations, ↵Sebastian Redl2011-02-051-0/+1
| | | | | | and probably only works for very basic use cases. llvm-svn: 124970
* Basic support for -mms-bitfields, from Carl Norum!Douglas Gregor2011-02-011-0/+1
| | | | llvm-svn: 124661
* Rvalue references for *this: Douglas Gregor2011-01-261-0/+1
| | | | | | | | | | | | - Add ref-qualifiers to the type system; they are part of the canonical type. Print & profile ref-qualifiers - Translate the ref-qualifier from the Declarator chunk for functions to the function type. - Diagnose mis-uses of ref-qualifiers w.r.t. static member functions, free functions, constructors, destructors, etc. - Add serialization and deserialization of ref-qualifiers. llvm-svn: 124281
* Use attributes for all the override control specifiers.Anders Carlsson2011-01-241-2/+0
| | | | llvm-svn: 124122
* Serialize and deserialize IsMarkedFinal/IsMarkedExplicit.Anders Carlsson2011-01-221-0/+2
| | | | llvm-svn: 124041
* Generalise support for non-inheritable attributesPeter Collingbourne2011-01-211-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Inheritable attributes on declarations may be inherited by any later redeclaration at merge time. By contrast, a non-inheritable attribute will not be inherited by later redeclarations. Non-inheritable attributes may be semantically analysed early, allowing them to influence the redeclaration/overloading process. Before this change, the "overloadable" attribute received special handling to be treated as non-inheritable, while all other attributes were treated as inheritable. This patch generalises the concept, while removing a FIXME. Some CUDA location attributes are also marked as non-inheritable in order to support special overloading semantics (to be introduced in a later patch). The patch introduces a new Attr subclass, InheritableAttr, from which all inheritable attributes derive. Non-inheritable attributes simply derive from Attr. N.B. I did not review every attribute to determine whether it should be marked non-inheritable. This can be done later on an incremental basis, as this change does not affect default functionality. llvm-svn: 123959
* Introduce a new kind of TemplateName that captures a substitutedDouglas Gregor2011-01-151-0/+8
| | | | | | | | | | | | | | | template template parameter pack that cannot be fully expanded because its enclosing pack expansion could not be expanded. This form of TemplateName plays the same role as SubstTemplateTypeParmPackType and SubstNonTypeTemplateParmPackExpr do for template type parameter packs and non-type template parameter packs, respectively. We should now handle these multi-level pack expansion substitutions anywhere. The largest remaining gap in our variadic-templates support is that we cannot cope with non-type template parameter packs whose type is a pack expansion. llvm-svn: 123521
* Store/retrieve -fshort-enums for PCH, fixes rdar://8854933.Argyrios Kyrtzidis2011-01-151-0/+3
| | | | llvm-svn: 123510
* Teach template template argument pack expansions to keep track of theDouglas Gregor2011-01-141-0/+6
| | | | | | | number of expansions, when we know it, and propagate that information through Sema. llvm-svn: 123493
* Properly propagate #pragma diagnostic mappings from PCH but not command-line ↵Argyrios Kyrtzidis2011-01-141-9/+21
| | | | | | | | warning flags. Addresses rdar://8435969&8852495 llvm-svn: 123462
* Keep track of the number of expansions to be produced from a type packDouglas Gregor2011-01-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | expansion, when it is known due to the substitution of an out parameter pack. This allows us to properly handle substitution into pack expansions that involve multiple parameter packs at different template parameter levels, even when this substitution happens one level at a time (as with partial specializations of member class templates and the signatures of member function templates). Note that the diagnostic we provide when there is an arity mismatch between an outer parameter pack and an inner parameter pack in this case isn't as clear as the normal diagnostic for an arity mismatch. However, this doesn't matter because these cases are very, very rare and (even then) only typically occur in a SFINAE context. The other kinds of pack expansions (expression, template, etc.) still need to support optional tracking of the number of expansions, and we need the moral equivalent of SubstTemplateTypeParmPackType for substituted argument packs of template template and non-type template parameters. llvm-svn: 123448
* Start implementing support for substitution into pack expansions thatDouglas Gregor2011-01-141-0/+12
| | | | | | | | | | | | | | | | | involve template parameter packs at multiple template levels that occur within the signatures members of class templates (and partial specializations thereof). This is a work-in-progress that is deficient in several ways, notably: - It only works for template type parameter packs, but we need to also support non-type template parameter packs and template template parameter packs. - It doesn't keep track of the lengths of the substituted argument packs in the expansion, so it can't properly diagnose length mismatches. However, this is a concrete step in the right direction. llvm-svn: 123425
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-6/+7
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Update AST reader/writer to handle new AppleKext.Fariborz Jahanian2011-01-071-0/+1
| | | | | | | | Fix an unexpected hickup caused by exceeding size of generated table (and a misleading comment). Improve on help message for -fapple-kext. llvm-svn: 123003
* Introduce an AttributedType, but don't actually use it anywhere yet.John McCall2011-01-061-0/+22
| | | | | | | | | | The initial TreeTransform is a cop-out, but it's more-or-less equivalent to what we were doing before, or rather what we're doing now and might eventually stop doing in favor of using this type. I am simultaneously intrigued by the possibilities of rebuilding a dependent Attri llvm-svn: 122942
* Replace the representation of template template argument packDouglas Gregor2011-01-051-2/+6
| | | | | | | | | | | | | expansions with something that is easier to use correctly: a new template argment kind, rather than a bit on an existing kind. Update all of the switch statements that deal with template arguments, fixing a few latent bugs in the process. I"m happy with this representation, now. And, oh look! Template instantiation and deduction work for template template argument pack expansions. llvm-svn: 122896
* Add semantic analysis for the creation of and an AST representationDouglas Gregor2011-01-051-0/+2
| | | | | | | | | | | | | | | | | | | | | for template template argument pack expansions. This allows fun such as: template<template<class> class ...> struct apply_impl { /*...*/ }; template<template<class> class ...Metafunctions> struct apply { typedef typename apply_impl<Metafunctions...>::type type; }; However, neither template argument deduction nor template instantiation is implemented for template template argument packs, so this functionality isn't useful yet. I'll probably replace the encoding of template template argument pack expansions in TemplateArgument so that it's harder to accidentally forget about the expansion. However, this is a step in the right general direction. llvm-svn: 122890
* Implement pack expansions whose pattern is a base-specifier.Douglas Gregor2011-01-031-0/+3
| | | | llvm-svn: 122782
* Add -fobjc-default-synthesized-properties flagTed Kremenek2010-12-231-0/+2
| | | | | | | | | | | | to allow us to explicitly control whether or not Objective-C properties are default synthesized. Currently this feature only works when using the -fobjc-non-fragile-abi2 flag (so there is no functionality change), but we can now turn off this feature without turning off all the features coupled with -fobjc-non-fragile-abi2. llvm-svn: 122519
* Replace all uses of PathV1::makeAbsolute with PathV2::fs::make_absolute.Michael J. Spencer2010-12-211-4/+5
| | | | llvm-svn: 122340
* Introduce a new type, PackExpansionType, to capture types that areDouglas Gregor2010-12-201-0/+8
| | | | | | | | | | | | | | | | | | | | pack expansions, e.g. given template<typename... Types> struct tuple; template<typename... Types> struct tuple_of_refs { typedef tuple<Types&...> types; }; the type of the "types" typedef is a PackExpansionType whose pattern is Types&. This commit introduces support for creating pack expansions for template type arguments, as above, but not for any other kind of pack expansion, nor for any form of instantiation. llvm-svn: 122223
* Fix diagnostic pragmas.Argyrios Kyrtzidis2010-12-151-1/+1
| | | | | | | | | | | | Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state. Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect a lot of places, like C++ inline methods, template instantiations, the lexer, etc. Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location. Fixes rdar://8365684. llvm-svn: 121873
* Added ParenType type node.Abramo Bagnara2010-12-101-0/+9
| | | | llvm-svn: 121488
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-1/+0
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-041-2/+6
| | | | | | | | | | | | | | | | used in a constructor initializer list: struct X { X() : au_i1(123) {} union { int au_i1; float au_f1; }; }; clang will now deal with au_i1 explicitly as an IndirectFieldDecl. llvm-svn: 120900
* Serialization: support for CUDA language extensionsPeter Collingbourne2010-12-011-0/+1
| | | | llvm-svn: 120588
* When using a precompiled preamble with detailed preprocessing records,Douglas Gregor2010-11-301-14/+30
| | | | | | | | | | trap the serialized preprocessing records (macro definitions, macro instantiations, macro definitions) from the generation of the precompiled preamble, then replay those when walking the list of preprocessed entities. This eliminates a bug where clang_getCursor() wasn't able to find preprocessed-entity cursors in the preamble. llvm-svn: 120396
* Merge System into Support.Michael J. Spencer2010-11-291-1/+1
| | | | llvm-svn: 120297
* PCH files only cache successful stats. Remove the code that reads/writes Chris Lattner2010-11-231-16/+9
| | | | | | the result code of the stat to/from the PCH file since it is always 0. llvm-svn: 120031
* rework the stat cache, pulling it out of FileManager.h intoChris Lattner2010-11-231-0/+1
| | | | | | | its own header and giving it some more structure. No functionality change. llvm-svn: 120030
* Add a variant of GCC-style vector types for ARM NEON.Bob Wilson2010-11-101-1/+1
| | | | | | | | | NEON vector types need to be mangled in a special way to comply with ARM's ABI, similar to some of the AltiVec-specific vector types. This patch is mostly just renaming a bunch of "AltiVecSpecific" things, since they will no longer be specific to AltiVec. Besides that, it just adds the new "NeonVector" enum. llvm-svn: 118724
* Remove broken support for variadic templates, along with the variousDouglas Gregor2010-11-071-2/+2
| | | | | | | | | | | | | abstractions (e.g., TemplateArgumentListBuilder) that were designed to support variadic templates. Only a few remnants of variadic templates remain, in the parser (parsing template type parameter packs), AST (template type parameter pack bits and TemplateArgument::Pack), and Sema; these are expected to be used in a future implementation of variadic templates. But don't get too excited about that happening now. llvm-svn: 118385
* Don't write an empty DIAG_USER_MAPPINGS record.Argyrios Kyrtzidis2010-11-051-1/+2
| | | | llvm-svn: 118305
* Read/write from/to PCH the diagnostic mappings that the user set so that ↵Argyrios Kyrtzidis2010-11-051-0/+17
| | | | | | | | e.g. #pragma clang diagnostic can be used in a PCH. Fixes rdar://8435969. llvm-svn: 118303
* Flush statements after writing each DECL_CXX_BASE_SPECIFIERS nodeDouglas Gregor2010-10-301-0/+3
| | | | llvm-svn: 117770
* Make the deserialization of C++ base class specifiers lazy, improvingDouglas Gregor2010-10-291-7/+70
| | | | | | the performance of C++ PCH and reducing stack depth in the reader. llvm-svn: 117732
* Use the ASTMutationListener to track when a named decl gets added to a ↵Argyrios Kyrtzidis2010-10-281-17/+22
| | | | | | | | DeclContext, meaning we need to rewrite its name lookup table in a chained PCH. llvm-svn: 117536
* Properly add chained template specializations.Argyrios Kyrtzidis2010-10-281-0/+2
| | | | llvm-svn: 117535
* Fix the re-serializing decls in a chained PCH mechanism.Argyrios Kyrtzidis2010-10-281-5/+4
| | | | llvm-svn: 117534
* Use the ASTMutationListener to track added template specializations in a ↵Argyrios Kyrtzidis2010-10-281-19/+10
| | | | | | chained PCH. llvm-svn: 117533
* Keep track in chained PCH of implicit members that were added after the ↵Argyrios Kyrtzidis2010-10-241-0/+14
| | | | | | definition was completed. llvm-svn: 117240
* Start fleshing out ASTMutationListener; notify when a tag definition is ↵Argyrios Kyrtzidis2010-10-241-0/+29
| | | | | | | | | completed. In that case a chained PCH will record the updates to the DefinitionData pointer of forward references. If a forward reference mutated into a definition re-write it into the chained PCH, this is too big of a change. llvm-svn: 117239
* Introduce a DeclsToRewrite field in ASTWrite, used for collecting the decls ↵Argyrios Kyrtzidis2010-10-241-0/+7
| | | | | | that will be replaced in the chained PCH. llvm-svn: 117238
* Some method renaming, no functionality change.Argyrios Kyrtzidis2010-10-241-4/+4
| | | | llvm-svn: 117237
* Refactoring.Argyrios Kyrtzidis2010-10-241-33/+71
| | | | | | | - Pass around RecordDataImpl instead of the concrete RecordData so that any SmallVector can be used. - Move ASTDeclWriter::WriteCXXDefinitionData to ASTWriter::AddCXXDefinitionData. llvm-svn: 117236
OpenPOWER on IntegriCloud