summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization
Commit message (Collapse)AuthorAgeFilesLines
* Serialization/deserialization support for floating point #pragmaPeter Collingbourne2011-02-152-0/+53
| | | | | | options, enabled OpenCL extensions and default FP_CONTRACT setting. llvm-svn: 125589
* Allow resolving headers from a PCH even after headers+PCH were moved to ↵Argyrios Kyrtzidis2011-02-153-7/+80
| | | | | | | | | | | another path. Store in PCH the directory that the PCH was originally created in. If a header file is not found at the path that we expect it to be and the PCH file was moved from its original location, try to resolve the file by assuming that header+PCH were moved together and the header is in the same place relative to the PCH. llvm-svn: 125576
* When reading the AST, delay loading of the redeclaration chain to avoid ↵Argyrios Kyrtzidis2011-02-123-12/+67
| | | | | | | | | | | deeply nested calls. Temporarily set the first (canonical) declaration as the previous one, which is the one that matters, and mark the real previous DeclID to be loaded & attached later on. Fixes rdar://8956193. llvm-svn: 125434
* Add CMake dependencies so that LLVM_USED_LIBS order doesn't matter.Jeffrey Yasskin2011-02-111-1/+2
| | | | | | | I also sorted the tools/driver dependencies since their order no longer matters. llvm-svn: 125417
* Rename the operation that loads a preprocessed entity from a given offset to ↵Douglas Gregor2011-02-111-1/+1
| | | | | | indicate that we're loading from an offset, not an index, lest one be confused. No functionality change. llvm-svn: 125394
* Eliminate a major performance problem with chained PCH, where we wereDouglas Gregor2011-02-111-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | causing the deserialization of a large number of declarations when writing the visible-updates record for the translation unit in C. This takes us from: *** AST File Statistics: 2 stat cache hits 6 stat cache misses 1/64463 source location entries read (0.001551%) 15606/16956 types read (92.038216%) 59266/89334 declarations read (66.342041%) 38952/61393 identifiers read (63.446976%) 0/7778 selectors read (0.000000%) 24192/34644 statements read (69.830276%) 388/8809 macros read (4.404586%) 2095/5189 lexical declcontexts read (40.373867%) 0/4587 visible declcontexts read (0.000000%) 0/7716 method pool entries read (0.000000%) 0 method pool misses to *** AST File Statistics: 2 stat cache hits 6 stat cache misses 1/64463 source location entries read (0.001551%) 26/16956 types read (0.153338%) 18/89334 declarations read (0.020149%) 145/61393 identifiers read (0.236183%) 0/7778 selectors read (0.000000%) 21/34644 statements read (0.060617%) 0/8809 macros read (0.000000%) 0/5189 lexical declcontexts read (0.000000%) 0/4587 visible declcontexts read (0.000000%) 0/7716 method pool entries read (0.000000%) 0 method pool misses when generating a chained PCH for a header that #includes Cocoa.h (from a PCH file) and adds one simple function declaration. The generated PCH file is now only 9580 bytes (down from > 2MB). llvm-svn: 125326
* Implement AST/PCH chaining support for macro definitions. Previously,Douglas Gregor2011-02-111-3/+16
| | | | | | | | | | | | | | we would deserialize all of the macro definitions we knew about while serializing the macro definitions at the end of the AST/PCH file. Even though we skipped most of them (since they were unchanged), it's still a performance problem. Now, we do the standard AST/PCH chaining trick: watch what identifiers are deserialized as macro names, and consider only those identifiers (along with macro definitions that have been deserialized/written in the source) when serializing the preprocessor state. llvm-svn: 125324
* When we're writing macro definitions to an AST/PCH File, sort theDouglas Gregor2011-02-101-7/+27
| | | | | | | macro definitions by macro name first. That way, we'll get a stable ordering in the AST/PCH file. llvm-svn: 125297
* Implement two related optimizations that make de-serialization ofDouglas Gregor2011-02-102-34/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* CMake: LLVM_NO_RTTI must be obsolete now!NAKAMURA Takumi2011-02-101-2/+0
| | | | llvm-svn: 125275
* AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actionsPeter Collingbourne2011-02-093-0/+30
| | | | llvm-svn: 125217
* AST, Sema, Serialization: keep track of cudaConfigureCallPeter Collingbourne2011-02-092-0/+21
| | | | llvm-svn: 125216
* NonTypeTemplateParmDecl is just a DeclaratorDecl, not a VarDecl.John McCall2011-02-092-2/+2
| | | | | | | Also, reorganize and make very explicit the logic for determining the value kind and type of a referenced declaration. llvm-svn: 125150
* Split the serialized representation for the detailed preprocessingDouglas Gregor2011-02-082-190/+225
| | | | | | | | | | 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
* A few more tweaks to the blocks AST representation: John McCall2011-02-074-13/+28
| | | | | | | | | | | | | | | | | - BlockDeclRefExprs always store VarDecls - BDREs no longer store copy expressions - BlockDecls now store a list of captured variables, information about how they're captured, and a copy expression if necessary With that in hand, change IR generation to use the captures data in blocks instead of walking the block independently. Additionally, optimize block layout by emitting fields in descending alignment order, with a heuristic for filling in words when alignment of the end of the block header is insufficient for the most aligned field. llvm-svn: 125005
* Improve our uniquing of file entries when files are re-saved or areDouglas Gregor2011-02-051-17/+23
| | | | | | | | | | | | | | overridden via remapping. Thus, when we create a "virtual" file in the file manager, we still stat() the real file that lives behind it so that we can provide proper uniquing based on inodes. This helps keep the file manager much more consistent. To take advantage of this when reparsing files in libclang, we disable the use of the stat() cache when reparsing or performing code completion, since the stat() cache is very likely to be out of date in this use case. llvm-svn: 124971
* Basic implementation of inherited constructors. Only generates declarations, ↵Sebastian Redl2011-02-052-1/+5
| | | | | | and probably only works for very basic use cases. llvm-svn: 124970
* Implement proper (de-)serialization for explicit template argumentDouglas Gregor2011-02-042-55/+56
| | | | | | | lists with zero template arguments. Fixes some seriously scary crashers in C++ PCH. llvm-svn: 124862
* An insomniac stab at making block declarations list the variables they closeJohn McCall2011-02-024-2/+15
| | | | | | | on, as well as more reliably limiting invalid references to locals from nested scopes. llvm-svn: 124721
* Fix a thinko where I didn't update a consistency check forDouglas Gregor2011-02-011-1/+1
| | | | | | | PackExpansionType in the AST reader. We need more testing for variadic templates + PCH, but this fixes PR9073. llvm-svn: 124662
* Basic support for -mms-bitfields, from Carl Norum!Douglas Gregor2011-02-012-0/+3
| | | | llvm-svn: 124661
* Give OpaqueValueExpr a source location, because its source locationDouglas Gregor2011-01-282-0/+2
| | | | | | | | might be queried in places where we absolutely require a valid location (e.g., for template instantiation). Fixes some major brokenness in the use of __is_convertible_to. llvm-svn: 124465
* TextDiagnosticPrinter.cpp: Show diagnostics as far as possible even with ↵Axel Naumann2011-01-271-0/+3
| | | | | | | | | | | | | | invalid PresomedLoc, instead of just silencing it. FileManager.cpp: Allow virtual files in nonexistent directories. FileManager.cpp: Close FileDescriptor for virtual files that correspond to actual files. FileManager.cpp: Enable virtual files to be created even for files that were flagged as NON_EXISTENT_FILE, e.g. by a prior (unsuccessful) addFile(). ASTReader.cpp: Read a PCH even if the original source files cannot be found. Add a test for reading a PCH of a file that has been removed and diagnostics referencing that file. llvm-svn: 124374
* Do a proper recursive lookup when deciding whether a class's usualJohn McCall2011-01-272-2/+6
| | | | | | | | | deallocation function has a two-argument form. Store the result of this check in new[] and delete[] nodes. Fixes rdar://problem/8913519 llvm-svn: 124373
* Rvalue references for *this: Douglas Gregor2011-01-262-0/+2
| | | | | | | | | | | | - 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-243-9/+0
| | | | llvm-svn: 124122
* Serialize and deserialize IsMarkedFinal/IsMarkedExplicit.Anders Carlsson2011-01-222-0/+5
| | | | llvm-svn: 124041
* Generalise support for non-inheritable attributesPeter Collingbourne2011-01-212-3/+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
* Add IsMarkedOverride and IsMarkedFinal flags to FunctionDecl (to be used by ↵Anders Carlsson2011-01-202-0/+5
| | | | | | CXXRecordDecl). llvm-svn: 123885
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-192-14/+42
| | | | | | | | | | | | | | | | | | | | | a pack expansion, e.g., the parameter pack Values in: template<typename ...Types> struct Outer { template<Types ...Values> struct Inner; }; This new implementation approach introduces the notion of an "expanded" non-type template parameter pack, for which we have already expanded the types of the parameter pack (to, say, "int*, float*", for Outer<int*, float*>) but have not yet expanded the values. Aside from creating these expanded non-type template parameter packs, this patch updates template argument checking and non-type template parameter pack instantiation to make use of the appropriate types in the parameter pack. llvm-svn: 123845
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-4/+4
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-1/+0
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* Introduce a new kind of TemplateName that captures a substitutedDouglas Gregor2011-01-152-4/+26
| | | | | | | | | | | | | | | 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-152-0/+4
| | | | llvm-svn: 123510
* Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,Douglas Gregor2011-01-152-1/+33
| | | | | | | | | that captures the substitution of a non-type template argument pack for a non-type template parameter pack within a pack expansion that cannot be fully expanded. This follows the approach taken by SubstTemplateTypeParmPackType. llvm-svn: 123506
* Teach template template argument pack expansions to keep track of theDouglas Gregor2011-01-142-1/+11
| | | | | | | number of expansions, when we know it, and propagate that information through Sema. llvm-svn: 123493
* Teach PackExpansionExpr to keep track of the number of pack expansionsDouglas Gregor2011-01-142-0/+2
| | | | | | it will expand to, if known. Propagate this information throughout Sema. llvm-svn: 123470
* Properly propagate #pragma diagnostic mappings from PCH but not command-line ↵Argyrios Kyrtzidis2011-01-142-20/+42
| | | | | | | | 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-142-2/+8
| | | | | | | | | | | | | | | | | | | | | | | 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-142-0/+25
| | | | | | | | | | | | | | | | | 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
* Add the location of the right parenthesis of a C++ named castDouglas Gregor2011-01-122-2/+5
| | | | | | | (static_cast, dynamic_cast, reinterpret_cast, or const_cast) to improve source-location information. Fixes PR8960. llvm-svn: 123336
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-084-40/+34
| | | | | | | 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-072-0/+3
| | | | | | | | 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-062-0/+49
| | | | | | | | | | 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-052-6/+17
| | | | | | | | | | | | | 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-052-3/+10
| | | | | | | | | | | | | | | | | | | | | 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 support for template template parameter packs, e.g.,Douglas Gregor2011-01-052-1/+4
| | | | | | | template<template<class> class ...Metafunctions> struct apply_to_each; llvm-svn: 122874
* Implement the sizeof...(pack) expression to compute the length of aDouglas Gregor2011-01-042-0/+25
| | | | | | | | | parameter pack. Note that we're missing proper libclang support for the new SizeOfPackExpr expression node. llvm-svn: 122813
* Implement pack expansion of base initializers, so that we canDouglas Gregor2011-01-041-5/+9
| | | | | | | initialize those lovely mixins that come from pack expansions of base specifiers. llvm-svn: 122793
OpenPOWER on IntegriCloud