summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateDeduction.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement partial ordering of function template specializations Douglas Gregor2009-09-141-13/+258
| | | | | | (C++ [temp.func.order]). llvm-svn: 81777
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-272/+272
| | | | llvm-svn: 81346
* Tighten up the conversion from a single-level template argument listDouglas Gregor2009-08-281-11/+13
| | | | | | | | | | to a multi-level template argument list by making it explicit. The forced auditing of callers found a bug in the instantiation of member classes inside member templates. I *love* static type systems. llvm-svn: 80391
* Clarify the difference between substitution and instantiation by renamingJohn McCall2009-08-251-13/+13
| | | | | | functions that don't instantiate definitions. llvm-svn: 80037
* Implement conversion function templates, along with the ability to useDouglas Gregor2009-08-211-1/+139
| | | | | | | template argument deduction from a conversion function (C++ [temp.deduct.conv]) with implicit conversions. llvm-svn: 79693
* Get rid of Stmt::Clone now that we can reference count statements instead.Anders Carlsson2009-08-081-2/+1
| | | | llvm-svn: 78452
* Change uses of:Ted Kremenek2009-07-291-6/+6
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Fix the problems with template argument deduction and array types forDouglas Gregor2009-07-221-8/+65
| | | | | | | | real. It turns out that we need to actually move all of the qualifiers up to the array type itself, then recanonicalize the deduced template argument type. llvm-svn: 76788
* Canonicalize the types produced by template argument deduction.Douglas Gregor2009-07-221-1/+2
| | | | llvm-svn: 76777
* Improve template argument deduction for array types, so that a parameterDouglas Gregor2009-07-221-0/+8
| | | | | | | | | | const T can be matched with, e.g., volatile int [5] llvm-svn: 76773
* Remove ObjCQualifiedInterfaceType:-)Steve Naroff2009-07-181-1/+0
| | | | llvm-svn: 76321
* Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its ↵Argyrios Kyrtzidis2009-07-181-4/+4
| | | | | | place. llvm-svn: 76274
* Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methodsTed Kremenek2009-07-171-6/+6
| | | | | | | | | until Doug Gregor's Type smart pointer code lands (or more discussion occurs). These methods just call the new Type::getAs<XXX> methods, so we still have reduced implementation redundancy. Having explicit getAsXXXType() methods makes it easier to set breakpoints in the debugger. llvm-svn: 76193
* Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), ↵Ted Kremenek2009-07-171-3/+3
| | | | | | Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents. llvm-svn: 76139
* Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().Ted Kremenek2009-07-171-1/+1
| | | | llvm-svn: 76132
* Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.Ted Kremenek2009-07-161-2/+2
| | | | | | | | | | | | | | | | | | | | | This method is intended to eventually replace the individual Type::getAsXXXType<> methods. The motivation behind this change is twofold: 1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of them are basically copy-and-paste. 2) By centralizing the implementation of the getAs<Type> logic we can more smoothly move over to Doug Gregor's proposed canonical type smart pointer scheme. Along with this patch: a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>. b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>. llvm-svn: 76098
* Implement template argument deduction when taking the address of aDouglas Gregor2009-07-081-119/+295
| | | | | | | | function template. Most of the change here is in factoring out the common bits used for template argument deduction from a function call and when taking the address of a function template. llvm-svn: 75044
* Template argument deduction from a call has improved a bitDouglas Gregor2009-07-071-1/+1
| | | | llvm-svn: 74966
* Improve template argument deduction from a call. In particular,Douglas Gregor2009-07-071-76/+171
| | | | | | | | implement C++ [temp.deduct.call]p3b3, which allows a template-id parameter to match a derived class of the argument, while deducing template arguments. llvm-svn: 74965
* Keep track of more information within the template instantiation stack, e.g.,Douglas Gregor2009-07-011-2/+4
| | | | | | | | | | | | | | by distinguishing between substitution that occurs for template argument deduction vs. explicitly-specifiad template arguments. This is used both to improve diagnostics and to make sure we only provide SFINAE in those cases where SFINAE should apply. In addition, deal with the sticky issue where SFINAE only considers substitution of template arguments into the *type* of a function template; we need to issue hard errors beyond this point, as test/SemaTemplate/operator-template.cpp illustrates. llvm-svn: 74651
* Cope with explicitly-specified function template arguments when thereDouglas Gregor2009-07-011-7/+10
| | | | | | | are fewer template arguments than there are template parameters for that function. llvm-svn: 74578
* When explicit template arguments are provided for a function call,Douglas Gregor2009-06-301-16/+93
| | | | | | | | | substitute those template arguments into the function parameter types prior to template argument deduction. There's still a bit of work to do to make this work properly when only some of the template arguments are specified. llvm-svn: 74576
* Keep track of function template specializations, to eliminateDouglas Gregor2009-06-291-6/+14
| | | | | | | redundant, implicit instantiations of function templates and provide a place where we can hang function template specializations. llvm-svn: 74454
* Set the rest of the flags we need to perform template argumentDouglas Gregor2009-06-261-5/+28
| | | | | | | deduction using a base class of the argument type. No actual functionality change; this is just a hook. llvm-svn: 74356
* During template argument deduction from a function call, allowDouglas Gregor2009-06-261-28/+69
| | | | | | | | deduction from pointer and pointer-to-member types to work even in the presence of a qualification conversion (C++ [temp.deduct.type]p3 bullet 2). llvm-svn: 74354
* Template argument deduction is no longer responsible for checkingDouglas Gregor2009-06-261-32/+100
| | | | | | | | | | | | | non-dependent parameter types. Instead, class template partial specializations perform a final check of all of the instantiated arguments. This model is cleaner, and works better for function templates where the "final check" occurs during overload resolution. Also, cope with cv-qualifiers when the parameter type was originally a reference type, so that the deduced argument can be more qualified than the transformed argument. llvm-svn: 74323
* Improve template argument deduction for reference parameters whenDouglas Gregor2009-06-261-4/+42
| | | | | | | deducing template arguments from a function call. Plus, add a bunch of tests. llvm-svn: 74301
* Implicit instantiation for function template specializations.Douglas Gregor2009-06-261-0/+4
| | | | | | | | | For a FunctionDecl that has been instantiated due to template argument deduction, we now store the primary template from which it was instantiated and the deduced template arguments. From this information, we can instantiate the body of the function template. llvm-svn: 74232
* Improved semantic analysis and AST respresentation for functionDouglas Gregor2009-06-251-0/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | templates. For example, this now type-checks (but does not instantiate the body of deref<int>): template<typename T> T& deref(T* t) { return *t; } void test(int *ip) { int &ir = deref(ip); } Specific changes/additions: * Template argument deduction from a call to a function template. * Instantiation of a function template specializations (just the declarations) from the template arguments deduced from a call. * FunctionTemplateDecls are stored directly in declaration contexts and found via name lookup (all forms), rather than finding the FunctionDecl and then realizing it is a template. This is responsible for most of the churn, since some of the core declaration matching and lookup code assumes that all functions are FunctionDecls. llvm-svn: 74213
* Check in a new template argument list builder that should work better for ↵Anders Carlsson2009-06-231-4/+4
| | | | | | variadic templates. llvm-svn: 73937
* Some cleanups suggested by ChrisDouglas Gregor2009-06-181-15/+15
| | | | llvm-svn: 73713
* First step toward fixing <rdar://problem/6613046> refactor clang objc type ↵Steve Naroff2009-06-171-1/+1
| | | | | | | | | | | | representation. Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType). This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). No functionality change. llvm-svn: 73649
* Support dependent extended vector types and template instantiationDouglas Gregor2009-06-171-0/+8
| | | | | | thereof. Patch by Anders Johnsen! llvm-svn: 73641
* Since integral template arguments can't have dependent types we don't need ↵Anders Carlsson2009-06-161-32/+9
| | | | | | an extra pass to set the right APSInt bit width/signedness. llvm-svn: 73580
* Make DeduceNonTypeTemplateArgument take an APSInt instead of an APInt.Anders Carlsson2009-06-161-14/+9
| | | | llvm-svn: 73574
* Add a new 'Pack' argument kind to TemplateArgument. This is not yet used.Anders Carlsson2009-06-151-0/+6
| | | | llvm-svn: 73391
* Introduce a SFINAE "trap" that keeps track of the number of errorsDouglas Gregor2009-06-141-0/+4
| | | | | | | | | | that were suppressed due to SFINAE. By checking whether any errors occur at the end of template argument deduction, we avoid the possibility of suppressing an error (due to SFINAE) and then recovering so well that template argument deduction never detects that there was a problem. Thanks to Eli for the push in this direction. llvm-svn: 73336
* Remove a bunch of unnecessary template argument deduction code that wasDouglas Gregor2009-06-131-159/+15
| | | | | | obviously written by someone who didn't read C++ [temp.class.spec]. llvm-svn: 73276
* When some template parameters of a class template partialDouglas Gregor2009-06-131-0/+175
| | | | | | | specialization cannot be deduced, produce a warning noting that the affected class template partial specialization will never be used. llvm-svn: 73274
* Address comments from Doug - Add a Sema::SemaRef.BuildBlockPointerType and ↵Anders Carlsson2009-06-121-0/+2
| | | | | | use it. llvm-svn: 73264
* It looks like we've finished off matching of class template partial ↵Douglas Gregor2009-06-121-2/+8
| | | | | | specializations; add comments and update the C++ status page llvm-svn: 73263
* Improve template argument deduction to keep track of why templateDouglas Gregor2009-06-121-189/+346
| | | | | | | | | | | | | | | | argument deduction failed. For example, given template<typename T> struct is_same<T, T> { ... }; template argument deduction will fail for is_same<int, float>, and now reports enough information Right now, we don't do anything with this extra information, but it can be used for informative diagnostics that say, e.g., "template argument deduction failed because T was deduced to 'int' in one context and 'float' in another". llvm-svn: 73237
* Deducation and instantiation of block types.Anders Carlsson2009-06-121-0/+15
| | | | llvm-svn: 73232
* Once we have deduced the template arguments of a class templateDouglas Gregor2009-06-111-27/+153
| | | | | | | | | | | | partial specialization, substitute those template arguments back into the template arguments of the class template partial specialization to see if the results still match the original template arguments. This code is more general than it needs to be, since we don't yet diagnose C++ [temp.class.spec]p9. However, it's likely to be needed for function templates. llvm-svn: 73196
* Template argument deduction for member pointers.Douglas Gregor2009-06-101-0/+39
| | | | | | | Also, introduced some of the framework for performing instantiation as part of template argument deduction. llvm-svn: 73175
* Implement template argument deduction for class templateDouglas Gregor2009-06-091-0/+102
| | | | | | | | specialization types. As the example shows, we can now compute the length of a type-list using a template metaprogram and class template partial specialization. llvm-svn: 73136
* Address comments from Doug.Anders Carlsson2009-06-081-3/+10
| | | | llvm-svn: 73077
* Document the template argument deduction patterns that Anders' patch supportsDouglas Gregor2009-06-081-0/+3
| | | | llvm-svn: 73071
* Template argument deduction for function types.Anders Carlsson2009-06-081-0/+31
| | | | llvm-svn: 73070
* Make TemplateArgumentListBuilder take an ASTContext (because we're probably ↵Anders Carlsson2009-06-051-1/+1
| | | | | | going to need it later). Move push_back to the .cpp file. If the passed in template argument is a type, assert that it's canonical. llvm-svn: 72918
OpenPOWER on IntegriCloud