summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* The code trying to assign a typedef to an anonymous tag declaration wasJohn McCall2011-02-011-7/+9
| | | | | | | | extremely rambunctious, both on parsing and on template instantiation. Calm it down, fixing an internal consistency assert on anonymous enum instantiation manglings. llvm-svn: 124653
* Use attributes for all the override control specifiers.Anders Carlsson2011-01-241-2/+0
| | | | llvm-svn: 124122
* Sema: process non-inheritable attributes on function declarations earlyPeter Collingbourne2011-01-211-6/+2
| | | | | | | This allows us to simplify the handling for the overloadable attribute, removing a number of FIXMEs. llvm-svn: 123961
* When instantiating member functions, propagate whether the member function ↵Anders Carlsson2011-01-201-0/+4
| | | | | | | | is marked 'final' and 'override'. Also, call CheckOverrideControl when instantiating member functions. llvm-svn: 123900
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-191-17/+129
| | | | | | | | | | | | | | | | | | | | | 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
* NonTypeTemplateParmDecls always have TypeSourceInfo. There's no senseDouglas Gregor2011-01-191-10/+4
| | | | | | in pretending otherwise. llvm-svn: 123839
* Handle substitutions into function parameter packs whose patternsDouglas Gregor2011-01-141-1/+1
| | | | | | contain multiple parameter packs at different levels. llvm-svn: 123488
* When we're instantiating a direct variable initializer that has a packDouglas Gregor2011-01-141-6/+6
| | | | | | | | expansion in it, we may end up instantiating to an empty expression-list. In this case, the variable is uninitialized; tweak the instantiation logic to handle this case. Fixes PR8977. llvm-svn: 123449
* Keep track of the number of expansions to be produced from a type packDouglas Gregor2011-01-141-5/+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
* When mapping from a function parameter pack to the set of functionDouglas Gregor2011-01-111-3/+4
| | | | | | | | | parameters it expanded to, map exactly the number of function parameters that were expanded rather than just running to the end of the instantiated parameter list. This finishes the implementation of the last sentence of C++0x [temp.deduct.call]p1. llvm-svn: 123213
* Implement the last bullet of [temp.deduct.type]p5 and part of the lastDouglas Gregor2011-01-111-0/+2
| | | | | | | | | sentence of [temp.deduct.call]p1, both of which concern the non-deducibility of parameter packs not at the end of a parameter-type-list. The latter isn't fully implemented yet; see the new FIXME. llvm-svn: 123210
* Work-in-progress implementation of C++0x [temp.arg.explicit]p9, whichDouglas Gregor2011-01-101-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | allows an argument pack determines via explicit specification of function template arguments to be extended by further, deduced arguments. For example: template<class ... Types> void f(Types ... values); void g() { f<int*, float*>(0, 0, 0); // Types is deduced to the sequence int*, float*, int } There are a number of FIXMEs in here that indicate places where we need to implement + test retained expansions, plus a number of other places in deduction where we need to correctly cope with the explicitly-specified arguments when deducing an argument pack. Furthermore, it appears that the RecursiveASTVisitor needs to be auditied; it's missing some traversals (especially w.r.t. template arguments) that cause it not to find unexpanded parameter packs when it should. The good news, however, is that the tr1::tuple implementation now works fully, and the tr1::bind example (both from N2080) is actually working now. llvm-svn: 123163
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-1/+1
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* When instantiating the arguments to an initializer, use theDouglas Gregor2011-01-071-30/+4
| | | | | | | TreeTransform version of TransformExprs() rather than explicit loop, so that we expand pack expansions properly. Test cast coming soon... llvm-svn: 123014
* Implement substitution of a function parameter pack for its set ofDouglas Gregor2011-01-071-17/+50
| | | | | | | | | | | | | | | | | | | | | | | | instantiated function parameters, enabling instantiation of arbitrary pack expansions involving function parameter packs. At this point, we can now correctly compile a simple, variadic print() example: #include <iostream> #include <string> void print() {} template<typename Head, typename ...Tail> void print(const Head &head, const Tail &...tail) { std::cout << head; print(tail...); } int main() { std::string hello = "Hello"; print(hello, ", world!", " ", 2011, '\n'); } llvm-svn: 123000
* Implement support for template template parameter packs, e.g.,Douglas Gregor2011-01-051-2/+2
| | | | | | | template<template<class> class ...Metafunctions> struct apply_to_each; llvm-svn: 122874
* Implement pack expansion of base initializers, so that we canDouglas Gregor2011-01-041-1/+65
| | | | | | | initialize those lovely mixins that come from pack expansions of base specifiers. llvm-svn: 122793
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-231-1/+2
| | | | | | | | | | | | | | 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
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-221-18/+7
| | | | | | | | | | | pattern is a template argument, which involves repeatedly deducing template arguments using the pattern of the pack expansion, then bundling the resulting deductions into an argument pack. We can now handle a variety of simple list-handling metaprograms using variadic templates. See, e.g., the new "count" metaprogram. llvm-svn: 122439
* Implement instantiation of pack expansions whose pattern is a type-idDouglas Gregor2010-12-211-0/+55
| | | | | | in an exception specification. llvm-svn: 122297
* Added missing IgnoreParens().Abramo Bagnara2010-12-141-4/+4
| | | | llvm-svn: 121795
* Restore r121752 without modification.John McCall2010-12-141-7/+8
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-141-8/+7
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-141-7/+8
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Skip ParenType on function instantiations.Abramo Bagnara2010-12-131-3/+3
| | | | llvm-svn: 121720
* Fix PR8760: IndirectFieldDecl Type was not updated during template ↵Francois Pichet2010-12-091-1/+2
| | | | | | instantiation. llvm-svn: 121363
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-1/+1
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-041-10/+15
| | | | | | | | | | | | | | | | 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
* Added struct/class syntactic info for c++0x scoped enum.Abramo Bagnara2010-12-031-2/+2
| | | | llvm-svn: 120828
* Minor whitespace and comment fixes. No functionality change.Nico Weber2010-11-281-1/+1
| | | | llvm-svn: 120266
* Tie DefineVTablesUsed() in with recursive function instantiation so that we emitNick Lewycky2010-11-251-1/+10
| | | | | | | | | | a useful template instantiation stack. Fixes PR8640. This also causes a slight change to where the "instantianted from" note shows up in truly esoteric cases (see the change to test/SemaCXX/destructor.cpp), but that isn't directly the fault of this patch. llvm-svn: 120135
* Major anonymous union/struct redesign.Francois Pichet2010-11-211-0/+23
| | | | | | | | | | | A new AST node is introduced: def IndirectField : DDecl<Value>; IndirectFields are injected into the anonymous's parent scope and chain back to the original field. Name lookup for anonymous entities now result in an IndirectFieldDecl instead of a FieldDecl. There is no functionality change, the code generated should be the same. llvm-svn: 119919
* A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky2010-11-201-5/+5
| | | | llvm-svn: 119886
* Instantiate class member template partial specialization declarationsDouglas Gregor2010-11-101-96/+26
| | | | | | | | | in the order they occur within the class template, delaying out-of-line member template partial specializations until after the class has been fully instantiated. This fixes a regression introduced by r118454 (itself a fix for PR8001). llvm-svn: 118704
* Don't lose track of previous-declarations when instantiating a class template.Nick Lewycky2010-11-081-1/+11
| | | | | | Fixes PR8001. llvm-svn: 118454
* Remove broken support for variadic templates, along with the variousDouglas Gregor2010-11-071-11/+11
| | | | | | | | | | | | | 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
* When searching for an instantiated declaration requires instantiationDouglas Gregor2010-11-051-0/+2
| | | | | | | | of its parent context, be sure to update the parent-context pointer after instantiation. Fixes two anonymous-union instantiation issues in <rdar://problem/8635664>. llvm-svn: 118313
* Preserve the template type parameter name when instantiating a templace.Nick Lewycky2010-10-301-1/+1
| | | | | | Fixes PR8489. llvm-svn: 117776
* No really, we don't have a retain/release system for statements/expressionsJohn McCall2010-10-261-1/+1
| | | | | | anymore. llvm-svn: 117357
* Parse attributes on enumerators and instantiate attributes on enum decls.John McCall2010-10-221-0/+4
| | | | llvm-svn: 117182
* Pass TInfo to CXXDestructorDecl::Create(), just like we do for otherCraig Silverstein2010-10-211-2/+1
| | | | | | | | function decls. Reviewed by rjmccall and nlewycky. llvm-svn: 116979
* When instantiating a dependently-scoped friend function declaration,John McCall2010-10-191-0/+3
| | | | | | we may need to complete the type before looking into it. llvm-svn: 116795
* Instantiate enclosing template parameter lists when instantiating friends.John McCall2010-10-191-0/+19
| | | | llvm-svn: 116789
* Redirect templated friend class decls to a new Sema callback andJohn McCall2010-10-191-0/+2
| | | | | | | construct an unsupported friend when there's a friend with a templated scope specifier. Fixes a consistency crash, rdar://problem/8540527 llvm-svn: 116786
* Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor2010-10-081-1/+23
| | | | | | bit by me). llvm-svn: 116122
* Fix handling of dependent nested namespace specifiers in UsingDeclsDouglas Gregor2010-09-291-4/+20
| | | | | | during template instantiation, from Martin Vejnar! llvm-svn: 115051
* Reinstate r114925 and r114929, both steps towardDouglas Gregor2010-09-281-2/+1
| | | | | | <rdar://problem/8459981>. llvm-svn: 114984
* Temporarily revert 114929 114925 114924 114921. It looked like they (or at leastBill Wendling2010-09-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one of them) was causing a series of failures: http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/4518 svn merge -c -114929 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114929 into '.': U include/clang/Sema/Sema.h U include/clang/AST/DeclCXX.h U lib/Sema/SemaDeclCXX.cpp U lib/Sema/SemaTemplateInstantiateDecl.cpp U lib/Sema/SemaDecl.cpp U lib/Sema/SemaTemplateInstantiate.cpp U lib/AST/DeclCXX.cpp svn merge -c -114925 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114925 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/AST/DeclCXX.cpp svn merge -c -114924 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114924 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/Sema/SemaDecl.cpp G lib/AST/DeclCXX.cpp U lib/AST/ASTContext.cpp svn merge -c -114921 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114921 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/Sema/SemaDecl.cpp G lib/AST/DeclCXX.cpp llvm-svn: 114933
* Centralize the management of CXXRecordDecl::DefinitionData'sDouglas Gregor2010-09-281-2/+1
| | | | | | | | | | | HasTrivialConstructor, HasTrivialCopyConstructor, HasTrivialCopyAssignment, and HasTrivialDestructor bits in CXXRecordDecl's methods. This completes all but the Abstract bit and the set of conversion functions, both of which will require a bit of extra work. The majority of <rdar://problem/8459981> is now implemented (but not all of it). llvm-svn: 114929
* When emitting a new-expression inside a conditional expression,John McCall2010-09-171-1/+2
| | | | | | | | | | | | | | | | the cleanup might not be dominated by the allocation code. In this case, we have to store aside all the delete arguments in case we need them later. There's room for optimization here in cases where we end up not actually needing the cleanup in different branches (or being able to pop it after the initialization code). Also make sure we only call this operator delete along the path where we actually allocated something. Fixes rdar://problem/8439196. llvm-svn: 114145
OpenPOWER on IntegriCloud