summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateVariadic.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-031-10/+28
| | | | | | | | | | | | | | | | | template argument (described by an expression, of course). For example: template<int...> struct int_tuple { }; template<int ...Values> struct square { typedef int_tuple<(Values*Values)...> type; }; It also lays the foundation for pack expansions in an initializer-list. llvm-svn: 122751
* When instantiating a non-type template parameter pack, be sure toDouglas Gregor2010-12-241-1/+1
| | | | | | | | extract the appropriate argument from the argument pack (based on the current substitution index, of course). Simple instantiation of pack expansions involving non-type template parameter packs now works. llvm-svn: 122532
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-231-4/+17
| | | | | | | | | | | | | | 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 parsing of function parameter packs and non-type templateDouglas Gregor2010-12-231-0/+69
| | | | | | | | | | | | parameter packs (C++0x [dcl.fct]p13), including disambiguation between unnamed function parameter packs and varargs (C++0x [dcl.fct]p14) for cases like void f(T...) where T may or may not contain unexpanded parameter packs. llvm-svn: 122520
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-221-0/+6
| | | | | | | | | | | 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/+80
| | | | | | in an exception specification. llvm-svn: 122297
* Give the RecursiveASTVisitor a configuration functionDouglas Gregor2010-12-201-0/+2
| | | | | | | | | | | shouldWalkTypesOfTypeLocs() that determines whether it should walk the Types within TypeLocs. This walk is redundant, but perhaps required for some clients. Disabling this redundant walk in the unexpanded parameter pack finder produces better results, because we get parameter packs with source location info *unless* such source location information isn't available. llvm-svn: 122287
* Implement basic support for template instantiation of pack expansionsDouglas Gregor2010-12-201-14/+25
| | | | | | | | | | | | | | | | | whose patterns are template arguments. We can now instantiate, e.g., typedef tuple<pair<OuterTypes, InnerTypes>...> type; where OuterTypes and InnerTypes are template type parameter packs. There is a horrible inefficiency in TemplateArgumentLoc::getPackExpansionPattern(), where we need to create copies of TypeLoc data because our interfaces traffic in TypeSourceInfo pointers where they should traffic in TypeLocs instead. I've isolated in efficiency in this one routine; once we refactor our interfaces to traffic in TypeLocs, we can eliminate it. llvm-svn: 122278
* Introduce a new type, PackExpansionType, to capture types that areDouglas Gregor2010-12-201-0/+60
| | | | | | | | | | | | | | | | | | | | 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
* Tweak a commentDouglas Gregor2010-12-161-1/+1
| | | | llvm-svn: 121979
* Check for unexpanded parameter packs in default arguments.Douglas Gregor2010-12-161-0/+16
| | | | llvm-svn: 121962
* Fix a regression I caused in r121930. It turns out thatDouglas Gregor2010-12-161-3/+7
| | | | | | | DeclarationNameInfo instances don't always have a non-NULL TypeSourceInfo? llvm-svn: 121940
* Check for unexpanded parameter packs in using declarations. As aDouglas Gregor2010-12-161-1/+51
| | | | | | | drive-by, make sure to check for unexpanded parameter packs within the name of a declaration. llvm-svn: 121930
* Test that all of the relevant types properly compute the "containsDouglas Gregor2010-12-151-3/+8
| | | | | | | unexpanded parameter pack" bit and that the recursive AST visitor can then find those unexpanded parameter packs. llvm-svn: 121899
* Introduce a RecursiveASTVisitor subclass that finds all unexpandedDouglas Gregor2010-12-151-6/+141
| | | | | | | | | | | | | | | | parameter packs within a statement, type, etc. Use this visitor to provide improved diagnostics for the presence of unexpanded parameter packs in a full expression, base type, declaration type, etc., by highlighting the unexpanded parameter packs and providing their names, e.g., test/CXX/temp/temp.decls/temp.variadic/p5.cpp:28:85: error: declaration type contains unexpanded parameter packs 'VeryInnerTypes', 'OuterTypes', ... ...VeryInnerTypes, OuterTypes>, pair<InnerTypes, OuterTypes> > types; ~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ^ llvm-svn: 121883
* Move the work-in-progress implementation of variadic templates to its own ↵Douglas Gregor2010-12-151-0/+46
file in Sema. No functionality change. llvm-svn: 121869
OpenPOWER on IntegriCloud