summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fixed TypedefDecl and TemplateTypeParameter source range.Abramo Bagnara2011-03-061-8/+9
| | | | llvm-svn: 127119
* When determining template instantiation arguments within a functionDouglas Gregor2011-03-051-38/+59
| | | | | | | | | | | template (not a specialization!), use the "injected" function template arguments, which correspond to the template parameters of the function template. This is required when substituting into the default template parameters of template template parameters within a function template. Fixes PR9016. llvm-svn: 127092
* *Recursively* set the context of a template parameter, so that we alsoDouglas Gregor2011-03-041-17/+15
| | | | | | capture the template parameters of template template parameters. llvm-svn: 127012
* Make sure to put template parameters into their owning template'sDouglas Gregor2011-03-041-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DeclContext once we've created it. This mirrors what we do for function parameters, where the parameters start out with translation-unit context and then are adopted by the appropriate DeclContext when it is created. Also give template parameters public access and make sure that they don't show up for the purposes of name lookup. Fixes PR9400, a regression introduced by r126920, which implemented substitution of default template arguments provided in template template parameters (C++ core issue 150). How on earth could the DeclContext of a template parameter affect the handling of default template arguments? I'm so glad you asked! The link is Sema::getTemplateInstantiationArgs(), which determines the outer template argument lists that correspond to a given declaration. When we're instantiating a default template argument for a template template parameter within the body of a template definition (not it's instantiation, per core issue 150), we weren't getting any outer template arguments because the context of the template template parameter was the translation unit. Now that the context of the template template parameter is its owning template, we get the template arguments from the injected-class-name of the owning template, so substitution works as it should. llvm-svn: 127004
* Fixed source range for ClassTemplateSpecializationDecl.Abramo Bagnara2011-03-041-0/+13
| | | | llvm-svn: 126999
* Improved TemplateTypeParmDecl end location.Abramo Bagnara2011-03-041-1/+11
| | | | llvm-svn: 126996
* Fixed end location of NonTypeTemplateParamDecl.Abramo Bagnara2011-03-041-1/+4
| | | | llvm-svn: 126994
* Revert all of my commits that devirtualized the Decl hierarchy, whichDouglas Gregor2011-02-191-8/+20
| | | | | | | | lead to a serious slowdown (4%) on parsing of Cocoa.h. This memory optimization should be revisited later, when we have time to look at the generated code. llvm-svn: 126033
* Devirtualize DeclaratorDecl::getInnerLocStart() and TagDecl::getInnerLocStart().Douglas Gregor2011-02-171-7/+0
| | | | llvm-svn: 125754
* Devirtualize NamedDecl::getNameForDiagnostic().Douglas Gregor2011-02-171-13/+0
| | | | llvm-svn: 125751
* Devirtualize RedeclarableTemplateDecl::newCommon().Douglas Gregor2011-02-171-0/+8
| | | | llvm-svn: 125750
* NonTypeTemplateParmDecl is just a DeclaratorDecl, not a VarDecl.John McCall2011-02-091-1/+12
| | | | | | | Also, reorganize and make very explicit the logic for determining the value kind and type of a referenced declaration. llvm-svn: 125150
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-191-16/+63
| | | | | | | | | | | | | | | | | | | | | 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
* Teach template template argument pack expansions to keep track of theDouglas Gregor2011-01-141-1/+4
| | | | | | | 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-141-1/+2
| | | | | | it will expand to, if known. Propagate this information throughout Sema. llvm-svn: 123470
* Keep track of the number of expansions to be produced from a type packDouglas Gregor2011-01-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | 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
* PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad2011-01-121-5/+5
| | | | | | | and mark the fields they use as mutable. This allows us to remove a few const_casts. llvm-svn: 123314
* Add TemplateArgument::CreatePackCopy() to create a new parameter packDouglas Gregor2011-01-111-5/+2
| | | | | | | in ASTContext-allocated memory, copying the provided template arguments. Use this new routine where we can. No functionality change. llvm-svn: 123289
* Add semantic analysis for the creation of and an AST representationDouglas Gregor2011-01-051-2/+1
| | | | | | | | | | | | | | | | | | | | | 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-051-2/+3
| | | | | | | template<template<class> class ...Metafunctions> struct apply_to_each; llvm-svn: 122874
* When creating the injected-class-name for a class template involving aDouglas Gregor2011-01-041-1/+5
| | | | | | | non-type template parameter pack, make sure to create a pack expansion for the corresponding template argument. llvm-svn: 122799
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-231-2/+3
| | | | | | | | | | | | | | packs, e.g., template<typename T, unsigned ...Dims> struct multi_array; along with semantic analysis support for finding unexpanded non-type template parameter packs in types, expressions, and so on. Template instantiation involving non-type template parameter packs probably doesn't work yet. That'll come soon. llvm-svn: 122527
* When forming the injected-class-name of a variadic template, theDouglas Gregor2010-12-231-9/+26
| | | | | | | | | template argument corresponding to a template parameter pack is an argument pack of a pack expansion of that template parameter pack. Implements C++0x [temp.dep.type]p2 (at least, as much of it as we can). llvm-svn: 122498
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-0/+1
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* Remove broken support for variadic templates, along with the variousDouglas Gregor2010-11-071-120/+24
| | | | | | | | | | | | | 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
* Use the ASTMutationListener to track added template specializations in a ↵Argyrios Kyrtzidis2010-10-281-0/+16
| | | | | | chained PCH. llvm-svn: 117533
* Make AST deserialization for class template specializations lazier, byDouglas Gregor2010-10-271-0/+23
| | | | | | | not loading the specializations of a class template until some AST consumer needs them. llvm-svn: 117498
* Avoid setters in ASTDeclReader::VisitClassTemplatePartialSpecializationDecl.Argyrios Kyrtzidis2010-09-131-13/+0
| | | | llvm-svn: 113743
* Fix C++ PCH issues.Argyrios Kyrtzidis2010-09-081-7/+9
| | | | | | | | | | | PCH got a severe beating by the boost-using test case reported here: http://llvm.org/PR8099 Fix issues like: -When PCH reading, make sure Decl's getASTContext() doesn't get called since a Decl in the parent hierarchy may be initializing. -In ASTDeclReader::VisitFunctionDecl VisitRedeclarable should be called before using FunctionDecl's isCanonicalDecl() -In ASTDeclReader::VisitRedeclarableTemplateDecl CommonOrPrev must be initialized before anything else. llvm-svn: 113391
* Refactor find*Specialization functions using SpecEntryTraitsPeter Collingbourne2010-07-301-16/+17
| | | | | | | | | This patch reimplements the find*Specialization family of member functions of {Class,Function}TemplateDecl in terms of a common implementation that uses SpecEntryTraits to obtain the most recent declaration. llvm-svn: 109869
* Implement RedeclarableTemplateDecl::getNextRedeclarationPeter Collingbourne2010-07-291-0/+7
| | | | | | | This patch uses the newly added Latest field of CommonBase to provide a getNextRedeclaration() implementation for RedeclarableTemplateDecl. llvm-svn: 109756
* Store latest redeclaration for each redeclarable template declarationPeter Collingbourne2010-07-291-0/+13
| | | | | | | This patch adds a Latest field to RedeclarableTemplateDecl's CommonBase class which is used to store the latest redeclaration. llvm-svn: 109755
* Refactor redeclarable template declarationsPeter Collingbourne2010-07-291-42/+35
| | | | | | | | | | | This patch refactors much of the common code in ClassTemplateDecl and FunctionTemplateDecl into a common base class RedeclarableTemplateDecl together with support functions in a template class RedeclarableTemplate. The patch also includes similar refactoring for these classes' PCH reader and writer implementations. llvm-svn: 109754
* Remove destructors from declaration nodesDouglas Gregor2010-07-251-9/+0
| | | | llvm-svn: 109380
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-33/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Read/write FriendTemplateDecl for PCH.Argyrios Kyrtzidis2010-07-221-0/+5
| | | | llvm-svn: 109113
* Hide FunctionTemplateDecl's specializations folding set as implementation ↵Argyrios Kyrtzidis2010-07-201-0/+10
| | | | | | | | | | | detail and introduce FunctionTemplateDecl::findSpecialization. Redeclarations of specializations will not cause the previous decl to be removed from the set, the set will keep the canonical decl. findSpecialization will return the most recent redeclaration. llvm-svn: 108834
* Hide the specializations folding sets of ClassTemplateDecl as an ↵Argyrios Kyrtzidis2010-07-201-2/+39
| | | | | | | | | | | | | implementation detail (InsertPos leaks though) and add methods to its interface for adding/finding specializations. Simplifies its users a bit and we no longer need to replace specializations in the folding set with their redeclarations. We just return the most recent redeclarations. As a bonus, it fixes http://llvm.org/PR7670. llvm-svn: 108832
* Whenever we're creating an expression that is typically an rvalueDouglas Gregor2010-07-131-1/+1
| | | | | | | | | | | | | | | | (e.g., a call, cast, etc.), immediately adjust the expression's type to strip cv-qualifiers off of all non-class types (in C++) or all types (in C). This effectively extends my previous fix for PR7463, which was restricted to calls, to other kinds of expressions within similar characteristics. I've audited every use of getNonReferenceType() in the code base, switching to the newly-renamed getNonLValueExprType() where necessary. Big thanks to Eli for pointing out just how incomplete my original fix for PR7463 actually was. We've been handling cv-qualifiers on rvalues wrong for a very, very long time. Fixes PR7463. llvm-svn: 108253
* When performing substitution of template arguments within the body ofDouglas Gregor2010-07-081-2/+2
| | | | | | | a template, be sure to include the template arguments from the injected-class-name. Fixes PR7587. llvm-svn: 107895
* Add some side-effect free Create methods for TypeDecl subclasses and use ↵Argyrios Kyrtzidis2010-07-021-2/+9
| | | | | | them for PCH reading. llvm-svn: 107468
* Fix various bugs in recent commits for C++ PCH.Argyrios Kyrtzidis2010-06-281-1/+2
| | | | llvm-svn: 106995
* Modify ClassTemplateSpecializationDecl and ↵Argyrios Kyrtzidis2010-06-231-13/+50
| | | | | | ClassTemplatePartialSpecializationDecl to allow PCH read/write. llvm-svn: 106624
* Make it easier to read/write the template part of FunctionDecl.Argyrios Kyrtzidis2010-06-221-0/+16
| | | | | | | | | | | Introduce: -FunctionDecl::getTemplatedKind() which returns an enum signifying what kind of templated FunctionDecl it is. -An overload of FunctionDecl::setFunctionTemplateSpecialization() which accepts arrays of TemplateArguments and TemplateArgumentLocs -A constructor to TemplateArgumentList which accepts an array of TemplateArguments. llvm-svn: 106532
* Combine ClassTemplateDecl's PreviousDeclaration with CommonPtr, as in ↵Argyrios Kyrtzidis2010-06-211-29/+18
| | | | | | FunctionTemplateDecl. llvm-svn: 106412
* Initial support for reading templates from PCH.Argyrios Kyrtzidis2010-06-191-10/+18
| | | | llvm-svn: 106392
* Revert r106099; it broke self-host.Douglas Gregor2010-06-161-9/+2
| | | | llvm-svn: 106100
* Added TemplateTypeParmType::getDecl().Abramo Bagnara2010-06-161-2/+9
| | | | llvm-svn: 106099
* Don't omit class explicit instantiation from AST.Abramo Bagnara2010-06-121-1/+3
| | | | llvm-svn: 105880
* Added inherited info to template and non-type arguments of templates.Abramo Bagnara2010-06-091-2/+3
| | | | llvm-svn: 105716
OpenPOWER on IntegriCloud