History log of /external/clang/lib/Sema/SemaTemplateDeduction.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2521813d45e0af47b27673a095329ee33932d49c 06-Aug-2013 Larisse Voufo <lvoufo@google.com> A bit of clean up based on peer's feedback...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187784 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ef4579cda09b73e3d4d98af48201da25adc29326 06-Aug-2013 Larisse Voufo <lvoufo@google.com> Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187762 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4384712b3a0aedd7c68d6abdb0407850f7b46c8b 20-Jul-2013 Larisse Voufo <lvoufo@google.com> FIXME fix: improving diagnostics for template arguments deduction of class templates and explicit specializations
This patch essentially removes all the FIXMEs following calls to DeduceTemplateArguments() that want to keep track of deduction failure info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186730 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
8c5d4078bb40642847164e7613828262d32db973 20-Jul-2013 Larisse Voufo <lvoufo@google.com> Revert "Use function overloading instead of template specialization for diagnosis of bad template argument deductions."

This reverts commit a730f548325756d050d4caaa28fcbffdae8dfe95.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186729 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a730f548325756d050d4caaa28fcbffdae8dfe95 20-Jul-2013 Larisse Voufo <lvoufo@google.com> Use function overloading instead of template specialization for diagnosis of bad template argument deductions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186727 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
70d214f864987a06b27a92a2bd59df50037815f5 08-Jul-2013 Craig Topper <craig.topper@gmail.com> Introduce a typedef for the type of NewlyDeducedPacks to avoid repeating the small size of the inner SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
cb9186e45c01dcf372d0ff708006daf194bf7d68 08-Jul-2013 Craig Topper <craig.topper@gmail.com> Remove 'else' after 'return'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d82c0910f40d70a6a8beff66d854a53c1cdc44c6 08-Jul-2013 Craig Topper <craig.topper@gmail.com> Function argument formatting fixes. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185786 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1310aaca223be5001d58ba9c73fa03d484fd4582 08-Jul-2013 Craig Topper <craig.topper@gmail.com> Function argument formatting fixes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185785 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ee0a47998ca7db5d31291a397aca38219d3dfd7d 05-Jul-2013 Craig Topper <craig.topper@gmail.com> Add typedefs for Densemaps containing SmallVectors to avoid repeating the SmallVector size when creating iterators for the DenseMap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185682 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
305e5b4268685aa97d6338fe4362d1b73246cbe9 04-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Part of PR15673: If a function template has a default argument in which
substitution failed, report that as a substitution failure rather than
pretending that there was no default argument.

The test cases in PR15673 have exposed some pre-existing poor diagnostics here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
60e141e1f87211ca831de6821003d80fe20a06f3 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement most of N3638 (return type deduction for normal functions).
Missing (somewhat ironically) is support for the new deduction rules
in lambda functions, plus PCH support for return type patching.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
df6217ec356f1e8f440ea7222be3603c011a295d 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Simplify slightly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9b1317531d376738fd6631291b0a04109c76a63b 30-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> When deducing an 'auto' type, don't modify the type-as-written.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
dc7a4f5d7a7e3b60d4dc4a80338d7a2728540998 30-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't treat a non-deduced 'auto' type as being type-dependent. Instead, there
are now two distinct canonical 'AutoType's: one is the undeduced 'auto'
placeholder type, and the other is a deduced-but-dependent type. All
deduced-to-a-non-dependent-type cases are still non-canonical.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a2c3646c35dd09d21b74826240aa916545b1873f 26-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++1y decltype(auto).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
092140a434366007a611c0a1a73fb6a4e8ff7f5e 17-Apr-2013 Douglas Gregor <dgregor@apple.com> Fix PR15291: noreturn adjustment in overload resolution for function templates, from Alexander Zinenko!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179680 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0918989f0eed08870e50418df97d1486d977d773 08-Mar-2013 Jordan Rose <jordan_rose@apple.com> Sema: Preserve attributes on parameters in instantiated function templates.

This was causing correctness issues for ARC and the static analyzer when a
function template has "consumed" Objective-C object parameters (i.e.
parameters that will be released by the function before returning).

The fix is threefold:
(1) Actually copy over the attributes from old ParmVarDecls to new ones.
(2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes,
which it was doing anyway. This allows us to pass an ExtProtoInfo
instead of a plain ExtInfo and several flags.
(3) Drop param attributes as part of StripImplicitInstantiation, which is
used when an implicit instantiation is followed by an explicit one.

<rdar://problem/12685622>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176728 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
bea522ff43a3f11c7a2bc7949119dbb9fce19e39 08-Mar-2013 Jordan Rose <jordan_rose@apple.com> ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.

No (intended) functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176726 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
29805ca6d278b4d9563adfee67f2478f0fecdcfc 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Improve 'failed template argument deduction' diagnostic for the case where we
have a direct mismatch between some component of the template and some
component of the argument. The diagnostic now says what the mismatch was, but
doesn't yet say which part of the template doesn't match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174039 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0efa62f2096f28a610ac2ea8d2651448a7ec89c7 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Replace "failed template argument deduction" diagnostic with something useful
in the one case where we've already factored out a reason code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174036 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
89cf425f1136f8d24a64ed94450e488b6794dfa4 23-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Use 'const Decl *' throughout code completion in Sema


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
22eaced5cac3cf0522c953f593419fc6cf184aaf 18-Jan-2013 Douglas Gregor <dgregor@apple.com> Once we've collected the template arguments for a
partially-substituted parameter pack in a template, forget about the
partially-substituted parameter pack: it is now completed. Fixes
<rdar://problem/12176336>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172859 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
80ad52f327b532bded5c5b0ee38779d841c6cd35 02-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> s/CPlusPlus0x/CPlusPlus11/g


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
030a6644f253818b81b4d8a7fc1770c0a3d35474 06-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix http://stackoverflow.com/questions/13521163

Don't require that, during template deduction, a template specialization type
as a function parameter has at least as many template arguments as one used in
a function argument (not even if the argument has been resolved to an exact
type); the additional parameters might be provided by default template
arguments in the template. We don't need this check, since we now implement
[temp.deduct.call]p4 with an additional check after deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169475 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
55fc873017f10f6f566b182b70f6fc22aefa3464 04-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
49193c7b0a2deb0f4d1f7e8a44f46bd278f523d6 14-Nov-2012 NAKAMURA Takumi <geek4civic@gmail.com> SemaTemplateDeduction.cpp: Prune two obsolete descriptions. [-Wdocumentation]

* getMostSpecialized()

/// \param Index if non-NULL and the result of this function is non-nULL,
/// receives the index corresponding to the resulting function template
/// specialization.

* DeduceTemplateArguments()

/// \param Name the name of the function being called. This is only significant
/// when the function template is a conversion function template, in which
/// case this routine will also perform template argument deduction based on
/// the function to which

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
910515bc02872bd680e422f75079534d00093bc5 07-Nov-2012 Richard Trieu <rtrieu@google.com> When template deduction fails on a derived class, try a template deduction on
the base class. If the base class deduction succeeds, use those results. If
it fails, keep using the results from the derived class template deduction.

This prevents an assertion later where the type of deduction failure doesn't
match up with the template deduction info.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167550 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
70a01898008a90007866f15c4d9d53ba00b0d203 07-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Fix assertion failure with auto and nested initializer list; PR14272.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d7a6b1640e565487d163023a6a2e83f55476ae96 26-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix the AST representation for non-type template arguments to encode
enough information so we can mangle them correctly in cases involving
dependent parameter types. (This specifically impacts cases involving
null pointers and cases involving parameters of reference type.)
Fix the mangler to use this information instead of trying to scavenge
it out of the parameter declaration.

<rdar://problem/12296776>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164656 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
407c8470d50be8edaae7ed39a3139adf35af2921 20-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix a small FIXME involving template partial ordering and
member function templates with an rvalue ref qualifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164267 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9cef0064da0fe93cf60cc351d28ddf2e95fba0b3 20-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Fix function template partial ordering rules for static vs. non-static
functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
93e4599196654907dad3bd476013ad05d36ce604 19-Sep-2012 Craig Topper <craig.topper@gmail.com> Remove Context argument from TemplateDeductionInfo constructor. It was no longer needed after the unused Context member was removed in r164104.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ae19fbba559d8199d1f2b7154863180b0ae22ac7 13-Sep-2012 Douglas Gregor <dgregor@apple.com> Don't perform template argument deduction against invalid templates;
it's likely to lead to a crash later on. Fixes PR12933 /
<rdar://problem/11525335>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163838 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6964b3f80ce1ba489e7e25e7cd58062699af9b0c 07-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR9023: A template template parameter whose template parameter list contains an
unexpanded parameter pack is a pack expansion. Thus, as with a non-type template
parameter which is a pack expansion, it needs to be expanded early into a fixed
list of template parameters.

Since the expanded list of template parameters is not itself a parameter pack,
it is permitted to appear before the end of the template parameter list, so also
remove that restriction (for both template template parameter pack expansions and
non-type template parameter pack expansions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
70517ca5c07c4b41ff8662b94ee22047b0299f8c 23-Aug-2012 Dmitri Gribenko <gribozavr@gmail.com> Fix a bunch of -Wdocumentation warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a8eaf008e92759142982f7b40720b2b2674bd663 23-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix undefined behavior: member function calls where 'this' is a null pointer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b251302dd52249c49ba6527fcd013396deef22cf 18-Jul-2012 Douglas Gregor <dgregor@apple.com> When performing the deduced/actual argument type check for C++
[temp.deduct.call]p4 under Objective-C++ ARC, make sure to adjust the
qualifiers to introduce the implicit strong lifetime when
needed. Fixes <rdar://problem/11825671>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160412 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7e54fb5fcc7d7b8e843501652cf7c19cea6c4c57 16-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13365: Fix code which was trying to treat an array of DeducedTemplateArgument
as an array of its base class TemplateArgument. Switch the const
TemplateArgument* parameters of InstantiatingTemplate's constructors to
ArrayRef<TemplateArgument> to prevent this from happening again in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6098381c29c2693832aa81ef046cf21a49729436 09-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13136:

* When substituting a reference to a non-type template parameter pack where the
corresponding argument is a pack expansion, transform into an expression
which contains an unexpanded parameter pack rather than into an expression
which contains a pack expansion. This causes the SubstNonTypeTemplateParmExpr
to be inside the PackExpansionExpr, rather than outside, so the expression
still looks like a pack expansion and can be deduced.

* Teach MarkUsedTemplateParameters that we can deduce a reference to a template
parameter if it's wrapped in a SubstNonTypeTemplateParmExpr (such nodes are
added during alias template substitution).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159922 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5a343d7856e5de04fd92b6192e94becddf541e3e 08-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13243: When deducing a non-type template parameter which is specified as an
expression, skip over any SubstNonTypeTemplateParmExprs which alias templates
may have inserted before checking for a DeclRefExpr referring to a non-type
template parameter declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
8ad6c8696a23f410398fc126929b107404c59a95 08-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13293: Defer deduction of an auto type with a dependent declarator, such as "auto (*f)(T t)".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159908 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
16ae9de07730832945204877d752db7f1c070962 22-Jun-2012 James Dennett <jdennett@google.com> Documentation cleanup: making \param docs match the code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
40ae6666dd7a458f2d213370922a38be13f003c4 22-Jun-2012 James Dennett <jdennett@google.com> Diagnostics cleanup: Fixing \params to match the code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158981 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1dfbd92c83699820bfaa352e83083124e34fc9dc 14-Jun-2012 James Dennett <jdennett@google.com> Still more Doxygen documentation fixes:
* Escape #, < and @ symbols where Doxygen would try to interpret them;
* Fix several function param documentation where names had got out of sync;
* Delete param documentation referring to parameters that no longer exist.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158472 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
855243789cb44799c03f4c7216d3d6308805f549 07-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Plug a long standing memory leak in TemplateArgument.

The integral APSInt value is now stored in a decomposed form and the backing
store for large values is allocated via the ASTContext. This way its not
leaked as TemplateArguments are never destructed when they are allocated in
the ASTContext. Since the integral data is immutable it is now shared between
instances, making copying TemplateArguments a trivial operation.

Currently getting the integral data out of a TemplateArgument requires creating
a new APSInt object. This is cheap when the value is small but can be expensive
if it's not. If this turns out to be an issue a more efficient accessor could
be added.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158150 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d10099e5c8238fa0327f03921cf2e3c8975c881e 04-May-2012 Douglas Gregor <dgregor@apple.com> Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()
off PartialDiagnostic. PartialDiagnostic is rather heavyweight for
something that is in the critical path and is rarely used. So, switch
over to an abstract-class-based callback mechanism that delays most of
the work until a diagnostic is actually produced. Good for ~11k code
size reduction in the compiler and 1% speedup in -fsyntax-only on the
code in <rdar://problem/11004361>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156176 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
cefc3afac14d29de5aba7810cc8fe6c858949e9d 16-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
in the declaration of a non-static member function after the
(optional) cv-qualifier-seq, which in practice means in the exception
specification and late-specified return type.

The new scheme here used to manage 'this' outside of a member function
scope is more general than the Scope-based mechanism previously used
for non-static data member initializers and late-parsesd attributes,
because it can also handle the cv-qualifiers on the member
function. Note, however, that a separate pass is required for static
member functions to determine whether 'this' was used, because we
might not know that we have a static function until after declaration
matching.

Finally, this introduces name mangling for 'this' and for the implicit
'this', which is intended to match GCC's mangling. Independent
verification for the new mangling test case would be appreciated.

Fixes PR10036 and PR12450.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d2008e2c80d6c9282044ec873a937a17a0f33579 07-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement support for null non-type template arguments for non-type
template parameters of pointer, pointer-to-member, or nullptr_t
type in C++11. Fixes PR9700 / <rdar://problem/11193097>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d280389b42bb55cd8969eae181dc3ff9f05e9aaf 04-Apr-2012 Douglas Gregor <dgregor@apple.com> When performing template argument deduction for an initializer list,
be sure to perform the argument type adjustments in
[temp.deduct.call]p2, e.g., array decay.

And, when performing these deductions in the context of 'auto', make
sure that we're deducing the P' in std::initializer_list<P'> rather
than the whole initializer list.

Together, this makes code like

for( auto s : {"Deferred", "New", "Open", "Review"}) { }

work properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4b911e6536ed77524c3cef572cb0f6c8d9079e2e 15-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Support deducing template arguments from nested initializer lists. PR12119.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
860d9b780b54f56cd27e16620196d213385d31f7 12-Mar-2012 Douglas Gregor <dgregor@apple.com> C++11 [temp.deduct.call]p6 tweak: when given a set of overlaoded
functions that includes an explicit template argument list, perform
an inner deduction against each of the function templates in that list
and, if successful, use the result of that deduction for the outer
template argument deduction. Fixes PR11713.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).

The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
fc55a8290a3e81111c0a373e1a04b09dd7da0b98 11-Mar-2012 Douglas Gregor <dgregor@apple.com> When template argument deduction is ignoring qualifiers, perform deep
structural comparison of non-dependent types. Otherwise, we end up
rejecting cases where the non-dependent types don't match due to
qualifiers in, e.g., a pointee type. Fixes PR12132.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152529 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
13a140caba448a66ffcc5ff0d32a87d6e4f4ad3f 25-Feb-2012 Ahmed Charles <ace2001ac@gmail.com> ArrayRef'ize various functions in the AST/Parser/Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
341785ec52f87c0803ba52dc88faac4e136f8593 22-Feb-2012 Bill Wendling <isanbard@gmail.com> More ArrayRef-ification of methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151152 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4fe5be028b723fedc28bb33be96cde1ab2574ee6 22-Feb-2012 Bill Wendling <isanbard@gmail.com> ArrayRef-icize the function arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
dfca6f53ab97d28d43e3fa2564209df08f3d282c 13-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce support for template instantiation of lambda
expressions. This is mostly a simple refact, splitting the main "start
a lambda expression" function into smaller chunks that are driven
either from the parser (Sema::ActOnLambdaExpr) or during AST
transformation (TreeTransform::TransformLambdaExpr). A few minor
interesting points:

- Added new entry points for TreeTransform, so that we can
explicitly establish the link between the lambda closure type in the
template and the lambda closure type in the instantiation.
- Added a bit into LambdaExpr specifying whether it had an explicit
result type or not. We should have had this anyway.

This code is 'lightly' tested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150417 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
eefb3d5b49c844347f212073a7e975b8118fe8e9 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Track whether a function type has a trailing return type as type sugar. Use this
to pretty-print such function types better, and to fix a case where we were not
instantiating templates in lexical order. In passing, move the Variadic bit from
Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits.
Also ensure that we always substitute the return type of a function when
substituting explicitly-specified arguments, since that can cause us to bail
out with a SFINAE error before we hit a hard error in parameter substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150241 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
59a839c5a4eecfeb495fc64224f6a949d1c5b2da 08-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make sure template argument deduction is consistently performed in an unevaluated context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
013b3668b67c8cb3ad2ee516c5607a3eba11829f 30-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> SmallBitVectorize the deduced parameter set.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b832f6dea893f25b40500a04781286236281cb20 23-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Minor fixups for auto deduction of initializer lists.

Fix some review comments.
Add a test for deduction when std::initializer_list isn't available yet.
Fix redundant error messages. This fixes and outstanding FIXME too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
3026348bd4c13a0f83b59839f64065e0fcbea253 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
74fe66181db91d45d48f57abe325ea487e32ddbc 20-Jan-2012 Benjamin Kramer <benny.kra@googlemail.com> Replace a dubious use of SmallVectorImpl with a proper copy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148549 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
62b7cfb73e202051e7ab0dad42ba213acd0dec7e 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Auto deduction support for std::initializer_list, including for-range support. This means you can now write:

for (int i : {1, 4, 512, 23, 251}) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
84760e3a5d885ab19b5d11aafe78dfdfe2911e3a 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Template argument deduction for std::initializer_list arguments from initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148352 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
bb95e51a3668c50133b989467cd44ba4d8a42e8a 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Rename the first of 11 DeduceTemplateArguments overloads.

There are 5 functions of this name in Sema, and 6 more static helpers in
SemaTemplateDeduction.cpp. The Sema functions have jobs like "deduce for
function call", "deduce for taking the address", etc. The static helpers
have jobs like "deduce by comparing two types", "deduce by comparing two
lists of types", "deduce by comparing two template arguments", etc.
The fact that they all are called the same and only differ in two of their
6 or more arguments makes the code using them very hard to read.

Here I rename the one function that concerns me most at the moment, but
as a matter of cleanup, the others will eventually be renamed as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6fc9e1d98205649e4d0f741d194d288a45995a62 17-Jan-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce a static Sema::MarkDeducedTemplateParameters() that only depends
on an ASTContext.

This is a step towards making clang_getCursorCompletionString not depend on Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148277 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6efd4c55a1a481d92966a91141c03e8145234cf6 23-Nov-2011 Richard Trieu <rtrieu@google.com> Add feature to diagnostics that will provide more information on function
pointer mismatch. Cases covered are: initialization, assignment, and function
arguments. Additional text will give the extra information about the nature
of the mismatch: different classes for member functions, wrong number of
parameters, different parameter type, different return type, and function
qualifier mismatch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145114 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
32509f1e60451d86e9fbc473b6e853ba10b5fd1e 15-Nov-2011 John McCall <rjmccall@apple.com> Resolve placeholder expressions before trying to deduce
'auto'. Introduce a convenience method to make this a bit
easier, and use it elsewhere.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144605 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5fad9b8362c62e230f6603d86ec7d1747e74c737 12-Oct-2011 Douglas Gregor <dgregor@apple.com> When we determine that a function template specialization produced as
part of template argument deduction is ill-formed, we mark it as
invalid and treat it as a deduction failure. If we happen to find that
specialization again, treat it as a deduction failure rather than
silently building a call to the declaration.

Fixes PR11117, a marvelous bug where deduction failed after creating
an invalid specialization, causing overload resolution to pick a
different candidate. Then we performed a similar overload resolution
later, and happily picked the invalid specialization to
call... resulting in a silent link failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d8f5b333f96b4e8018ff3a0d0db62d9e78eb6bdd 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Per the note in C++0x [temp.deduct.call]p4, don't attempt template
argument deduction against a function parameter that has no deducible
template parameters in it. Fixes PR8598.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b001de7458d17c17e6d8b8034c7cfcefd3b70c00 07-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.

Thanks to Jeffrey Yasskin for the thorough review!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141330 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
eb2d1f1c88836bd5382e5d7aa8f6b85148a88b27 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Removing a bunch of dead returns/breaks after llvm_unreachables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
af130823cbac5c02f7fe57a5733ee511f5a3ac98 22-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't allow template argument deduction to deduce a placeholder type,
ever. Fixes PR10939.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140304 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
2cae1e216c12c7574f5ac59cb0844d22bed9401d 30-Aug-2011 Douglas Gregor <dgregor@apple.com> Fix a typo when determining whether to strip cv-qualifiers during template argument deduction

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
da8b24961acfbeff47f585109b7559ba60e574cb 26-Jul-2011 Douglas Gregor <dgregor@apple.com> Objective-C++ ARC: When performing template argument deduction for a
lifetime-qualified template parameter, ensure that the deduced
template argument is a lifetime type. Fixes <rdar://problem/9828157>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136078 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
18e0461ad72dcf6ec93cd3b1df7bf1b5a30b10b7 18-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Accept no-return stripping conversions for pointer type arguments after
deducing template parameter types. Recently Clang began enforcing the
more strict checking that the argument type and the deduced function
parameter type (after substitution) match, but that only consideres
qualification conversions.

One problem with this patch is that we check noreturn conversions and
qualification conversions independently. If a valid conversion would
require *both*, perhaps interleaved with each other, it will be
rejected. If this actually occurs (I'm not yet sure it does) and is in
fact a problem (I'm not yet sure it is), there is a FIXME to implement
more intelligent conversion checking.

However, this step at least allows Clang to resume accepting valid code
we're seeing in the wild.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e559ca1672ecef59345a928af0a6809b09282d2c 18-Jun-2011 Douglas Gregor <dgregor@apple.com> Objective-ARC++: infer template type arguments of
ownership-unqualified retainable object type as __strong. This allows
us to write, e.g.,

std::vector<id>

and we'll infer that the vector's element types have __strong
ownership semantics, which is far nicer than requiring:

std::vector<__strong id>

Note that we allow one to override the ownership qualifier of a
substituted template type parameter, e.g., given

template<typename T>
struct X {
typedef __weak T type;
};

X<id> is treated the same as X<__strong id>. At instantiation type,
the __weak in "__weak T" overrides the (inferred or specified)
__strong on the template argument type, so that we can still provide
metaprogramming transformations.

This is part of <rdar://problem/9595486>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133303 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c99f0ec89fd9782cfafd14d7b1b0a80151eab24a 17-Jun-2011 Douglas Gregor <dgregor@apple.com> Fix refactoro, silencing an MSVC warning. Thanks, Francois.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9a636e8403287af0d4db8fe5bf49dee719f5b754 17-Jun-2011 Douglas Gregor <dgregor@apple.com> Extend the deduced/actual argument type checking of C++
[temp.deduct.call]p4 to the deduction performed for 'auto', finishing
the fix for PR9233.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b7edc4f372f1abe6c422ea711a99f9906a7464da 17-Jun-2011 Douglas Gregor <dgregor@apple.com> Factor the checking of the deduced argument type against the actual
argument type for C++ [temp.deduct.call]p4 out of
Sema::FinishTemplateArgumentDeduction(). No functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
dbfb371e297794e827ad2e5b33b45fafbfc46b29 16-Jun-2011 Douglas Gregor <dgregor@apple.com> Implement the consistency checking for C++ [temp.deduct.call]p3, which
checks that the deduced argument type for a function call matches the
actual argument type provided. The only place we've found where the
consistency checking should actually cause template argument deduction
failure is due to qualifier differences that don't fall into the realm
of qualification conversions (which are *not* checked when we
initially perform deduction). However, we're performing the full
checking as specified in the standard to ensure that no other cases
exist.

Fixes PR9233 / <rdar://problem/9039590>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f85e193739c953358c865005855253af4f68a497 16-Jun-2011 John McCall <rjmccall@apple.com> Automatic Reference Counting.

Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4ac01401b1ec602a1f58c217544d3dcb5fcbd7f1 15-Jun-2011 Douglas Gregor <dgregor@apple.com> Eliminate a 'default' case in template argument deduction, where we
were just punting on template argument deduction for a number of type
nodes. Most of them, obviously, didn't matter.

As a consequence of this, make extended vector types (via the
ext_vector_type attribute) actually work properly for several
important cases:
- If the attribute appears in a type-id (i.e, not attached to a
typedef), actually build a proper vector type
- Build ExtVectorType whenever the size is constant; previously, we
were building DependentSizedExtVectorType when the size was constant
but the type was dependent, which makes no sense at all.
- Teach template argument deduction to handle
ExtVectorType/DependentSizedExtVectorType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
bf60a8c1de6397bc6b940c841dc74febb32ba568 15-Jun-2011 Douglas Gregor <dgregor@apple.com> Eliminate an unnecessary include. FIXMEs -=1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f15748a28c8443eef2924ef83689c358c661e9c5 03-Jun-2011 Douglas Gregor <dgregor@apple.com> When performing template argument deduction given a function argument
of incomplete array type, attempt to complete the array type. This was
made much easier by Chandler's addition of RequireCompleteExprType(),
which I've tweaked (slightly) to improve the consistency of the
DeclRefExpr. Fixes PR7985.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
8735b294a257a07ca158c28094d7324f0adf889a 03-Jun-2011 Douglas Gregor <dgregor@apple.com> When checking the instantiation of a default template argument against
the template parameter, perform the checking as a "specified" template
argument rather than a "deduced" template argument; the latter implies
stricter type checking that is not permitted for default template
arguments.

Also, cleanup our handling of substitution of explicit template
arguments for a function template. We were actually performing some
substitution of default arguments at this point!

Fixes PR10069.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132529 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ca63c200346c0ca9e00194ec6e34a5a7b0ed9321 25-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9625e44c0252485277a340746ed8ac950686156f 22-May-2011 Douglas Gregor <dgregor@apple.com> It's considered poor form to create references to the overloaded
function type. Educate template argument deduction thusly, fixing
PR9974 / <rdar://problem/9479155>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4fb86f8c4585e53c21c847ad3de9e3b2de123cd9 01-May-2011 Chandler Carruth <chandlerc@gmail.com> Re-applies the patch first applied way back in r106099, with
accompanying fixes to make it work today.

The core of this patch is to provide a link from a TemplateTypeParmType
back to the TemplateTypeParmDecl node which declared it. This in turn
provides much more precise information about the type, where it came
from, and how it functions for AST consumers.

To make the patch work almost a year after its first attempt, it needed
serialization support, and it now retains the old getName() interface.
Finally, it requires us to not attempt to instantiate the type in an
unsupported friend decl -- specifically those coming from template
friend decls but which refer to a specific type through a dependent
name.

A cleaner representation of the last item would be to build
FriendTemplateDecl nodes for these, storing their template parameters
etc, and to perform proper instantation of them like any other template
declaration. They can still be flagged as unsupported for the purpose of
access checking, etc.

This passed an asserts-enabled bootstrap for me, and the reduced test
case mentioned in the original review thread no longer causes issues,
likely fixed at somewhere amidst the 24k revisions that have elapsed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130628 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
769d0cc72b1831785596d0e76f327bdb887823be 30-Apr-2011 Douglas Gregor <dgregor@apple.com> When comparing parameters of reference-to-qualified type during
partial ordering of function templates, use a simple superset
relationship rather than the convertibility-implying
isMoreQualifiedThan/compatibilyIncludes relationship. Fixes partial
ordering between references and address-space-qualified references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
61d0b6baf47cf411f6c0f6ddb4acffcfeec724f1 28-Apr-2011 Douglas Gregor <dgregor@apple.com> More cleanup of template argument deduction and its handling of
non-CVR qualifiers. We can now properly match address-space--qualified
references during template argument deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130365 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a459cc26f6c895ae48742a36203f753cea8b3e91 28-Apr-2011 Douglas Gregor <dgregor@apple.com> Clean up the handling of non-CVR qualifiers in template argument
deduction. The good news is that address spaces are a lot less broken
in this regard than I'd expected.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a085da86242c9b8e3466f8cf6f4397e9f248fd20 17-Mar-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a reference-to-void type). Don't crash if it does.
Also fix an issue where type source information for the resulting type was being lost.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127811 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
344577e6b58f42d18dc8118c8903b49a85dc005e 06-Mar-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed TypedefDecl and TemplateTypeParameter source range.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127119 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5453d93ab8668f2d9d0bc02182695b02d207e32d 06-Mar-2011 Douglas Gregor <dgregor@apple.com> When performing template argument deduction for a non-reference
conversion function when we're binding the result to a reference, drop
cv-qualifiers on the type we're referring to, since we should be
deducing a type that can be adjusted (via cv-qualification) to the
requested type. Fixes PR9336, and the remaining Boost.Assign failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
67714230a191bc3c01f33378f34f34ef377991a6 03-Mar-2011 Douglas Gregor <dgregor@apple.com> When we use the default template arguments of a template template
parameter, save the instantiated default template arguments along with
the explicitly-specified template argument list. That way, we prefer
the default template template arguments corresponding to the template
template parameter rather than those of its template template argument.

This addresses the likely direction of C++ core issue 150, and fixes
PR9353/<rdar://problem/9069136>, bringing us closer to the behavior of
EDG and GCC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126920 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b6744efecba58792cce20d2d7b9ee39927c5422e 02-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into template
template arguments. I believe that this is the last place in the AST
where we were storing a source range for a nested-name-specifier
rather than a proper nested-name-specifier location structure. (Yay!)

There is still a lot of cleanup to do in the TreeTransform, which
doesn't take advantage of nested-name-specifiers with source-location
information everywhere it could.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
483b9f3bc05c5409e2c6643f1c9d91e21c8ff9d2 21-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Tweaks to C++0x deduced auto type support:
* Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema
* Temporary template parameter list for auto deduction is now allocated on the stack.
* Deduced 'auto' types are now uniqued.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
34b41d939a1328f484511c6002ba2456db879a29 20-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement the C++0x deduced 'auto' feature.

This fixes PR 8738, 9060 and 9132.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126069 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1be8eec3ddd2a23c19b453c2639226174eb5d4a8 19-Feb-2011 Douglas Gregor <dgregor@apple.com> Handle the resolution of a reference to a function template (which
includes explicitly-specified template arguments) to a function
template specialization in cases where no deduction is performed or
deduction fails. Patch by Faisal Vali, fixes PR7505!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126048 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
dfbb02a16ac8c764b5ba1742450513d6212d2f9f 27-Jan-2011 NAKAMURA Takumi <geek4civic@gmail.com> Fix whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124364 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0099530a2288df7c2140dd8992b7310b9f6930a9 27-Jan-2011 NAKAMURA Takumi <geek4civic@gmail.com> 7bit-ize.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124363 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e3c7a7ca66c02567543dbb5ec493818e00e8b177 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this: tentative parsing and template argument deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124295 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c938c1668b4fd12af154e965dd935a89e4801a70 26-Jan-2011 Douglas Gregor <dgregor@apple.com> Rvalue references for *this:

- 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124281 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
73b3cf6503f72f054288cf474e1a8c8ae56383c2 25-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the rvalue-reference deduction transformation (from T&& ->
T) when taking the address of an overloaded function or matching a
specialization to a template (C++0x [temp.deduct.type]p10). Fixes
PR9044.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124197 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b939a1987318f802fd25f89e15ae7d2423161cac 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement core issue 1164, which concerns the partial ordering of
f(T&) and f(T&&).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123981 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
2ad746aeb90e86cea7afaf552a02ae3f3b5ec859 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the special template argument deduction rule for T&& in a
call (C++0x [temp.deduct.call]p3).

As part of this, start improving the reference-binding implementation
used in the computation of implicit conversion sequences (for overload
resolution) to reflect C++0x semantics. It still needs more work and
testing, of course.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6952f1e4256c5b43aee5e98cea4e9b663bd1d413 19-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for non-type template parameter packs whose type is
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
62c28c831bbf207cc36e683e7c321fc33bf8928c 18-Jan-2011 John McCall <rjmccall@apple.com> Generalize some operations on qualifiers. QualType::getQualifiers() and
::getCVRQualifiers() now look through array types, like all the other
standard queries. Also, make a 'split' variant of getUnqualifiedType().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
dec0984fce504a39a7f085774fb67cfd9957be58 18-Jan-2011 Jeffrey Yasskin <jyasskin@google.com> Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123719 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9da95e6eefc4b0ca25e18bdab1b703f5c185deab 16-Jan-2011 Douglas Gregor <dgregor@apple.com> Tweak the partial ordering rules for function templates to prefer a
non-variadic function template over a variadic one. This matches GCC
and the intent of the C++0x wording, in a way that I think is likely
to be acceptable to the committee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123581 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
67fd1251aad51bb80d050b7fa5e506fef0ec8e02 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123470 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0bc15d92bf98cd01e7904d7fca9895dacc237618 14-Jan-2011 Douglas Gregor <dgregor@apple.com> Fix a few warnings stemming from my inability to properly fill out
switch() statements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
203e6a322ae29d577acafcb1572a57ec16e1e730 12-Jan-2011 Douglas Gregor <dgregor@apple.com> Add TemplateArgument::CreatePackCopy() to create a new parameter pack
in ASTContext-allocated memory, copying the provided template
arguments. Use this new routine where we can. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
77d6bb9e223496aa5288294f34e7225d1f65dddc 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement partial ordering of class template partial specializations
and function templates that contain variadic templates. This involves
three small-ish changes:

(1) When transforming a pack expansion, if the transformed argument
still contains unexpanded parameter packs, build a pack
expansion. This can happen during the substitution that occurs into
class template partial specialiation template arguments during
partial ordering.

(2) When performing template argument deduction where the argument
is a pack expansion, match against the pattern of that pack
expansion.

(3) When performing template argument deduction against a non-pack
parameter, or a non-expansion template argument, deduction fails if
the argument itself is a pack expansion (C++0x
[temp.deduct.type]p22).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5c7bf42ef16dc767615bed10f3b7b3c1265314e1 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement C++ [temp.func.order]p5 more directly, by passing down the
number of explicit call arguments. This actually fixes an erroneous
test for [temp.deduct.partial]p11, where we were considering
parameters corresponding to arguments beyond those that were
explicitly provided.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7d5c0c1273bdc1cb3dff1cb5a62d07b1439e82c7 11-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the last bullet of [temp.deduct.type]p5 and part of the last
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123210 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
3cae5c9a79bfd2e27eb44c32b13dfacd2ce5c66f 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement more of C++0x [temp.arg.explicit]p9, allowing extension of
pack expansions in template argument lists and function parameter
lists. The implementation of this paragraph should be complete
*except* for cases where we're substituting into one of the unexpanded
packs in a pack expansion; that's a general issue I haven't solved yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0216f8121df32b320cab659d5b703fee50cdfda5 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Repent for my copy-and-paste sins, factoring out the code that forms
argument packs from a set of deduced arguments, then checks that those
argument packs match previously-deduced argument packs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123182 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5429385919a2b6fb3708635b967221705f4b1daf 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Factor out the code to set up template argument deduction for a set of
template argument packs. This also ensures that explicitly-specified
template arguments get properly represented in those cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d3731198193eee92796ddeb493973b7a598b003e 10-Jan-2011 Douglas Gregor <dgregor@apple.com> Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123163 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
12c9c00024a01819e3a70ef6d951d32efaeb9312 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement substitution of a function parameter pack for its set of
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');
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123000 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a009b59fc2c550a229b9146aabda8e33fe3a7771 07-Jan-2011 Douglas Gregor <dgregor@apple.com> Factor out the template transformation of a sequence of function
parameters into parameter types, so that substitution of
explicitly-specified function template arguments uses the same
path. This enables the use of explicitly-specified function template
arguments with variadic templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122986 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f5c65ffbd7374b6c8d9f1e361041578640cab320 06-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement template argument deduction from a call to a function
template whose last parameter is a parameter pack. This allows us to
form a call to, e.g.,

template<typename ...Args1, typename ...Args2>
void f(std::pair<Args1, Args2> ...pairs);

given zero or more instances of "pair".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0bbacf8d2b3c7a5f19f292f3201e371836445502 06-Jan-2011 Douglas Gregor <dgregor@apple.com> Fast-path an arity check when performing template argument deduction that compares two parameter-type-lists. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
603cfb4da2f7ba08a1c3452c2fbf70585b8e7621 06-Jan-2011 Douglas Gregor <dgregor@apple.com> Initial implementation of function parameter packs. This implementation allows:

1) Declaration of function parameter packs
2) Instantiation of function parameter packs within function types.
3) Template argument deduction of function parameter packs when
matching two function types.

We're missing all of the important template-instantiation logic for
function template definitions, along with template argument deduction
from the argument list of a function call, so don't even think of
trying to use these for real yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122926 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
135ffa7375fb5802b92f42774e02d0e6e4c78e5b 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Propagate the "deduced from array bound" bit when comparing deduced
template argument packs. Plus, remove a FIXME that I fixed yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d53e16abd1dcaa2942d5183f48e7f63d0e75b35a 05-Jan-2011 Douglas Gregor <dgregor@apple.com> When we're converting deduced template arguments to the type of the
corresponding template parameter, make sure that prior converted
template arguments are available for substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122902 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a7fc901a2e39bfe55bfcff5934b2d9fdf9656491 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Replace the representation of template template argument pack
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122896 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ba68eca7582a62e3e2ff4b0eba1b2b73a6b80895 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Add semantic analysis for the creation of and an AST representation
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122890 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
2fdc5e8199e1e239620f2faae88997153703e16f 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Many of the built-in operator candidates introduced into overload
resolution require that the pointed-to type be an object type, but we
weren't filtering out non-object types. Do so, fixing PR7851.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a8311be2b85171e41cc82de12cdb43eaa026ce6e 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Eliminate some completely useless code that attempted to perform some
conversions on the substituted non-type template arguments of a class
template partial specialization. C++ [temp.class.spec]p8 actually
prohibits all of the cases where this code would have fired.

Hey, it's better than having to deal with variadic templates here!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
54c53cca105ed595e12fecf04e415c3712bda936 05-Jan-2011 Douglas Gregor <dgregor@apple.com> Improve our handling of non-type template parameters in partial
specializations. We weren't dealing with any of the cases where the
type of the non-type template argument differs from the type of the
corresponding template parameter in the primary template. We would
think that the template parameter in the partial specialization was
not deducible (and warn about it, incorrectly), then fail to convert a
deduced parameter to the type of the template parameter in the partial
specialization (which may involve truncation, among other
things). Fixes PR8905.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122851 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5471cbc0bdbe9d6711907a8c5251daed0155c306 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Remove an unnecessary FIXME for variadic templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122848 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
033a3cad525e5b221ba035ffc3e0abfa1241d90e 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Minor cleanups for template argument deduction in the presence of
variadic templates. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122847 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b9a7d6fb53f2b76df2ef832146a1edb4cb01b9f6 04-Jan-2011 Douglas Gregor <dgregor@apple.com> Improve the checking of deduced template arguments stored within template argument packs when finishing template argument deduction for a function template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122843 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
be230c36e32142cbdcdbe9c97511d097beeecbab 03-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement support for pack expansions whose pattern is a non-type
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.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122751 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6e4e17de3df88ead7eaf51b3503a6be1718438c0 24-Dec-2010 Douglas Gregor <dgregor@apple.com> Fix a thinko in a helper routine for template argument deduction that
caused an assertion when dealing with non-type template parameter
packs. Add some tests for deduction and instantiation of non-type
template parameter packs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122534 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ea6c96f63a45b4ffdcdf9824a9cf31a32825c0f6 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement the part of C++0x [temp.arg.explicit]p3 that pertains to
parameter packs. In particular, a parameter pack not otherwise deduced
is deduced to an empty parameter pack.

The C++0x wording here is a bit unfortunate; this should really only
apply to function templates, and it mentions "trailing" parameter
packs, which doesn't really make sense in the context of function
templates. Will file a core issue separately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7b976ece336d209977b25b5c28ee09c2d2146e6a 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement the rest of C++0x [temp.deduct.type]p9, which specifies that
the presence of a pack expansion anywhere except at the end of a
template-argument-list causes the entire template-argument-list to be
a non-deduced context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122461 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
34c2f8c8a16226f757947bf08c5f799d99c9ac1e 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Be paranoid about NULL size expressions in dependently-sized array types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0d80abc3b7fb0dca26fb6b272d2c3484f86fb7e7 23-Dec-2010 Douglas Gregor <dgregor@apple.com> Unify the consistency checking for deduced template arguments into a
single routine. Extend that routine to handle consistency
checking for template argument packs, so that we can compare the
deduced packs for template parameter packs across different pack
expansions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e02e26293cf8e3bad1059b39cea75c6582896da6 22-Dec-2010 Douglas Gregor <dgregor@apple.com> Implement template argument deduction for pack expansions whose
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122439 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0972c867e72171f24052d7b6d307020c065f8a66 22-Dec-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction where the argument is a
dependent template specialization type, the number of template
arguments need not match precisely. Rather than checking the number of
arguments eagerly (which does not consider argument packs), let the
deduction routine for template argument lists cope with too many/too
few arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
20a55e2515ce89ddf9993941f9b5d0f3a6c91b4f 22-Dec-2010 Douglas Gregor <dgregor@apple.com> Implicitly expand argument packs when performing template argument
deduction. Unify all of the looping over template arguments for
deduction purposes into a single place, where argument pack expansion
occurs; this is also the hook for deducing from pack expansions, which
itself is not yet implemented.

For now, at least we can handle a basic "count" metafunction written
with variadics. See the new test for the formulation that works.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
87dd697dcc8ecb64df73ae64d61b8c80ff0c157c 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Clean up the handling of template argument packs, especially in the
area of printing template arguments. The functionality changes here
are limited to cases of variadic templates that aren't yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122250 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7536dd5e6c99584481b7dab68b7e7d8df9c54054 20-Dec-2010 Douglas Gregor <dgregor@apple.com> Introduce a new type, PackExpansionType, to capture types that are
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122223 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
49f4e1cbd839da27ff4814b4ea6d85a79f786cbd 10-Dec-2010 John McCall <rjmccall@apple.com> It's kindof silly that ExtQuals has an ASTContext&, and we can use that
space better. Remove this reference. To make that work, change some APIs
(most importantly, getDesugaredType()) to take an ASTContext& if they
need to return a QualType. Simultaneously, diminish the need to return a
QualType by introducing some useful APIs on SplitQualType, which is
just a std::pair<const Type *, Qualifiers>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121478 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9f71a8f4c7a182a5236da9e747d57cc1d1bd24c2 07-Dec-2010 Jay Foad <jay.foad@gmail.com> PR5207: Change APInt methods trunc(), sext(), zext(), sextOrTrunc() and
zextOrTrunc(), and APSInt methods extend(), extOrTrunc() and new method
trunc(), to be const and to return a new value instead of modifying the
object in place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7eb0a9eb0cde8444b97f9c5b713d9be7a6f1e607 24-Nov-2010 John McCall <rjmccall@apple.com> Switch a lot of call-sites over to using the new value-kind calculations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120084 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
8d706ecf488c4f548c4f8cf0aa08ea82a4d6a5ba 15-Nov-2010 Douglas Gregor <dgregor@apple.com> Implement C++0x [temp.func.order]p3 (aka DR532) properly. In
particular, we only add the implement object parameter type if only
one of the function templates is a non-static member function
template.

Moreover, since this DR differs from existing practice in C++98/03,
this commit implements the existing practice (which ignores the
first parameter of the function template that is not the non-static
member function template) in C++98/03 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
77bc572138543ef97ebec137522b763d6a6ee909 13-Nov-2010 Douglas Gregor <dgregor@apple.com> Implement C++ [over.match.funcs]p4 as it concerns partial ordering of
function templates. Fixes PR8130.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118944 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
910f8008fea79120489a53593fe971b0b8a4a740 08-Nov-2010 Douglas Gregor <dgregor@apple.com> Remove broken support for variadic templates, along with the various
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118385 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
2c4792c731690dbbcbe69dd0625977adffc2961a 06-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> When determining which template partial specialization is more specialized,
make sure to setup the instantiation stack. Fixes rdar://8620775 & http://llvm.org/PR8234

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118314 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
053105d58552c600a2e56473592212a9bddafcd4 02-Nov-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction against a template-id,
only keep deduction results for successful deductions, so that they
can be compared against each other. Fixes PR8462, from Richard Smith!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117983 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
3fa5cae9b3812cab9fab6c042c3329bb70a3d046 26-Oct-2010 John McCall <rjmccall@apple.com> No really, we don't have a retain/release system for statements/expressions
anymore.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117357 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9b623639378d53a675921ddfa7316034d571881e 13-Oct-2010 Douglas Gregor <dgregor@apple.com> Introduce support for emitting diagnostics (warnings + their notes)
that are suppressed during template argument deduction. This change
queues diagnostics computed during template argument deduction. Then,
if the resulting function template specialization or partial
specialization is chosen by overload resolution or partial ordering
(respectively), we will emit the queued diagnostics at that point.

This addresses most of PR6784. However, the check for unnamed/local
template arguments (which existed before this change) is still only
skin-deep, and needs to be extended to look deeper into types. It must
be improved to finish PR6784.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116373 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
df41f18936693f7c62e457eefb9fad5b2d2fe3cd 12-Oct-2010 John McCall <rjmccall@apple.com> Enter the context of the declared function template when performing
deduction and the final substitution, but not while substituting the
explicit template arguments. Fixes rdar://problem/8537391



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116332 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
3273b0cea879c7af345d6bf98502bbf73fc4fde1 12-Oct-2010 Douglas Gregor <dgregor@apple.com> When finalizing a function template specialization following template
argument deduction, make sure to check the correctness of deduced template
type arguments (which we had previously skipped) along with other
kinds of template arguments. This fixes part of PR6784, but we're
still swallowing the extension warning about unnamed/local template
arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116327 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
fbb6fad63acac2bef36cfa13e0706fa3e2a1ed7d 29-Sep-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction of a function template
against a function type, be sure to check the type of the resulting
function template specialization against the desired function type
after substituting the deduced/defaulted template arguments. Fixes PR8196.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115086 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
75f21af57f3dce1577d6c27bbe7bb45b49ced732 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Perform the function-to-pointer adjustment during template argument
deduction where the parameter is a function reference, function
pointer, or member function pointer and the argument is an overloaded
function. Fixes <rdar://problem/8360106>, a template argument
deduction issue found by Boost.Filesystem.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
cd05e81e2e2640a0a0097658c660afc6c8a9f4fd 29-Aug-2010 John McCall <rjmccall@apple.com> When perform exact-qualifier-match template argument deduction,
properly account for the possibility that certain opaque types
might be more qualified than they appear. Fixes PR7708.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112390 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9c72c6088d591ace8503b842d39448c2040f3033 27-Aug-2010 John McCall <rjmccall@apple.com> Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic
form.

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
2a7fb27913999d132cf9e10e03dc5271faa2e9d3 25-Aug-2010 John McCall <rjmccall@apple.com> Move more stuff out of Sema.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7cd088e519d7e6caa4c4c12db52e0e4ae35d25c2 24-Aug-2010 John McCall <rjmccall@apple.com> Struggle mightily against header inclusion in Sema.h.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111904 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
19510856727e0e14a3696b2a72c35163bff2a71f 20-Aug-2010 John McCall <rjmccall@apple.com> Another step in the process of making the parser depend on Sema:
- move DeclSpec &c into the Sema library
- move ParseAST into the Parse library
Reflect this change in a thousand different includes.
Reflect this change in the link orders.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111667 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e4f26e54d81fb1987333132fe34cd927e62c803c 19-Aug-2010 John McCall <rjmccall@apple.com> When deducing the element type of an array, ignore qualifiers if
the context allows us to ignore qualifiers on the array type itself.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111486 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e737f5041a36d0befb39ffeed8d50ba15916d3da 12-Aug-2010 Douglas Gregor <dgregor@apple.com> Move Sema's headers into include/clang/Sema, renaming a few along the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
caadc127fef2a5ce5dddae0d3ac6a582c285baff 06-Aug-2010 Douglas Gregor <dgregor@apple.com> Remove some incorrect assertions when deduction template arguments in
a template-argument-list. When template template parameters are
involved, we won't already have checked the template-argument-list (it
may not be known yet!). Fixes PR7807.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
57e97786433e70197a089360228d8f0d82e3ad4c 05-Aug-2010 John McCall <rjmccall@apple.com> TDK_InconsistentQuals is really totally different from TDK_Inconsistent.
Rename it to TDK_Underqualified to avoid this sort of confusion and give it
its own diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110318 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
db0bc4706c4bda8e9166f40b5c7cfda656100818 05-Aug-2010 John McCall <rjmccall@apple.com> Permit template argument deduction to add qualifiers within ObjC object
pointers like it can with normal and member pointers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110313 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
fa869547eb1cab12d7e0c0dfa8ba594e336b9b32 05-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Preserve calling convention etc. across template instantiations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110304 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
33500955d731c73717af52088b7fc0e7a85681e7 11-Jun-2010 John McCall <rjmccall@apple.com> Split DependentNameType into two types. DependentNameType represents the
case of an elaborated-type-specifier like 'typename A<T>::foo', and
DependentTemplateSpecializationType represents the case of an
elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc
representation of a DependentTST conveniently exactly matches that of an
ElaboratedType wrapping a TST.

Kill off the explicit rebuild methods for RebuildInCurrentInstantiation;
the standard implementations work fine because the nested name specifier
is computable in the newly-entered context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c12c5bba6ceb6acd4e51e7a0fc03257da9cfd44e 15-May-2010 John McCall <rjmccall@apple.com> Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
one of {primitive-id, primitive-Class, user-defined @class}
with
a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared). ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet. Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c0008349f233e70e3ffabe7b31eab5d9859bc25f 13-May-2010 John McCall <rjmccall@apple.com> When performing template argument deduction, match Objective C pointers
against pointer patterns.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103706 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
fe52c91dcd1ecda90b579f789baf70f7a992e3c9 09-May-2010 Douglas Gregor <dgregor@apple.com> Be more careful about picking a template parameter when we fail to substitute explicit template arguments into a function template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103369 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ec20f46740a59758b12c22108002395bcf5b6f9b 08-May-2010 Douglas Gregor <dgregor@apple.com> When printing an overload candidate that failed due to SFINAE, print a
specific message that includes the template arguments, e.g.,

test/SemaTemplate/overload-candidates.cpp:27:20: note: candidate template
ignored: substitution failure [with T = int *]
typename T::type get_type(const T&); // expected-note{{candidate ...
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103348 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f1a8445036a2d047c7165d4170e3058cdeaba6eb 08-May-2010 Douglas Gregor <dgregor@apple.com> Improve overload-candidate diagnostic for a function template that
failed because the explicitly-specified template arguments did not
match its template parameters, e.g.,

test/SemaTemplate/overload-candidates.cpp:18:8: note: candidate
template
ignored: invalid explicitly-specified argument for template
parameter 'I'
void get(const T&);
^
test/SemaTemplate/overload-candidates.cpp:20:8: note: candidate
template
ignored: invalid explicitly-specified argument for 1st template
parameter
void get(const T&);
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103344 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
516e6e09821a61e8975c787e189949723249e7c5 29-Apr-2010 Douglas Gregor <dgregor@apple.com> When performing partial ordering of class template partial
specializations, substitute the deduced template arguments and check
the resulting substitution before concluding that template argument
deduction succeeds. This marvelous little fix makes a bunch of
Boost.Spirit tests start working.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102601 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
31dce8f606c5ff4a51db67caa24ac3312ccea3f3 29-Apr-2010 Douglas Gregor <dgregor@apple.com> For template argument deduction from class template partial
specializations, separate out the deduction part from the checking and
substitution of the deduced arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
96db310ab7ca59e1890ddef25a3701bc2909d20f 29-Apr-2010 John McCall <rjmccall@apple.com> Access-check during template argument deduction from the context of the
template decl itself, not its context. Testcase to follow; fixes selfhost.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f5813826802c2e76cdc13cae834ebfd4518d74a6 29-Apr-2010 John McCall <rjmccall@apple.com> Properly switch into the declaring scope of a template when performing
template argument deduction or (more importantly) the final substitution
required by such deduction. Makes access control magically work in these
cases.

Fixes PR6967.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d4598a2cc7576c06f69d3cf64d0e2c9783ddf529 28-Apr-2010 Douglas Gregor <dgregor@apple.com> When instantiating a function template specialization following
template argument deduction, use the lexical declaration context as
the owner for friend function templates. Fixes 2 failures in
Boost.Graph.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
31f17ecbef57b5679c017c375db330546b7b5145 27-Apr-2010 John McCall <rjmccall@apple.com> Make the InjectedClassNameType the canonical type of the current instantiation
of a class template or class template partial specialization. That is to
say, in
template <class T> class A { ... };
or
template <class T> class B<const T*> { ... };
make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType
when written inside the appropriate context. This allows us to track the
current instantiation appropriately even inside AST routines. It also allows
us to compute a DeclContext for a type much more efficiently, at some extra
cost every time we write a template specialization (which can be optimized,
but I've left it simple in this patch).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102407 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4714c12a1ab759156b78be8f109ea4c12213af57 31-Mar-2010 Douglas Gregor <dgregor@apple.com> Rename TypenameType to DependentNameType in anticipation of some
refactoring work in this area.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
02024a9f0d8e6c898de276193af604c42ee41269 28-Mar-2010 Douglas Gregor <dgregor@apple.com> After performing template argument deduction for a function template,
check deduced non-type template arguments and template template
arguments against the template parameters for which they were deduced,
performing conversions as appropriate so that deduced template
arguments get the same treatment as explicitly-specified template
arguments. This is the bulk of PR6723.

Also keep track of whether deduction of a non-type template argument
came from an array bound (vs. anywhere else). With this information,
we enforce C++ [temp.deduct.type]p17, which requires exact type
matches when deduction deduces a non-type template argument from
something that is not an array bound.

Finally, when in a SFINAE context, translate the "zero sized
arrays are an extension" extension diagnostic into a hard error (for
better standard conformance), which was a minor part of PR6723.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9d0e441036de0faa59d8039ce0c9967bda112c7f 26-Mar-2010 Douglas Gregor <dgregor@apple.com> When deducing an integral template argument for a non-type template
parameter, keep the integral value exactly as it was in the source
code rather than trying to convert it to the type of the non-type
template parameter (which may still be dependent!). The value will
then be converted to the appropriate type once we check the resulting
template arguments. Fixes PR6707.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99611 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
2b0749a4f8965d0205bf77322db150c13c39e3be 25-Mar-2010 Douglas Gregor <dgregor@apple.com> Improve our handling of local instantiation scopes in two related ways:

- When substituting template arguments as part of template argument
deduction, introduce a new local instantiation scope.
- When substituting into a function prototype type, introduce a new
"temporary" local instantiation scope that merges with its outer
scope but also keeps track of any additions it makes, removing
them when we exit that scope.

Fixes PR6700, where we were getting too much mixing of local
instantiation scopes due to template argument deduction that
substituted results into function types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99509 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
3cb0ebd5f76abcb776f7cb4062bd79e3268c0dc4 10-Mar-2010 John McCall <rjmccall@apple.com> Create a new InjectedClassNameType to represent bare-word references to the
injected class name of a class template or class template partial specialization.
This is a non-canonical type; the canonical type is still a template
specialization type. This becomes the TypeForDecl of the pattern declaration,
which cleans up some amount of code (and complicates some other parts, but
whatever).

Fixes PR6326 and probably a few others, primarily by re-establishing a few
invariants about TypeLoc sizes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98134 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ad5e73887052193afda72db8efcb812bd083a4a8 02-Mar-2010 John McCall <rjmccall@apple.com> Split out types that are non-canonical unless dependent as their own
category. Use this in a few places to eliminate unnecessary TST cases and
do some future-proofing. Provide terrible manglings for typeof. Mangle
decltype with some hope of accuracy.

Our manglings for some of the cases covered in the testcase are different
from gcc's, which I've raised as an issue with the ABI list.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5769d6195087229770d7ac90449443e026c47103 09-Feb-2010 John McCall <rjmccall@apple.com> Thread a source location into the template-argument deduction routines. There
may be some other places that could take advantage of this new information,
but I haven't really looked yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95600 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a7ef13024e4cc3dfb75e3bc1695371b39d9a5240 07-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Require a complete type before examining base classes during template argument
deduction. This requires refactoring the deduction to have access to the Sema
object instead of merely the ASTContext. Still leaves something to be desired
due to poor source location.

Fixes PR6257 and half of PR6259.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
7bb12da2b0749eeebb21854c77877736969e59f2 02-Feb-2010 John McCall <rjmccall@apple.com> Extract a common base class between UnresolvedLookupExpr and
UnresolvedMemberExpr and employ it in a few places where it's useful.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95072 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
eff92135d32039c9874dc356f3e93143af6069c1 02-Feb-2010 John McCall <rjmccall@apple.com> Implement C++ [temp.deduct.call]p6, template argument deduction for overloaded
arguments. Fix a bug where incomplete explicit specializations were being
passed through as legitimate. Fix a bug where the absence of an explicit
specialization in an overload set was causing overall deduction to fail.

Fixes PR6191.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95052 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c373d48502ca7683ab55385f5bd624d778eb288d 27-Jan-2010 John McCall <rjmccall@apple.com> Implement access control for overloaded functions. Suppress access control
diagnostics in "early" lookups, such as during typename checks and when building
unresolved lookup expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94647 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c781f9cd854f3d5d1c826f4a13382c6abca4cff7 14-Jan-2010 Douglas Gregor <dgregor@apple.com> After dyn_cast'ing, it generally makes sense to check the *output* of
the dyn_cast against NULL rather than the *input*. Fixes PR6025.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93435 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9e68871f1e99e7e1536f16d5364fd5e2a352e9c4 11-Jan-2010 Douglas Gregor <dgregor@apple.com> When resolving a single function template specialization to a
function, be sure to adjust the resulting argument type to a pointer
(if necessary). Fixes PR5910 and PR5949.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93178 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
48026d26fb58e413544874eead5491b1452e2ebf 11-Jan-2010 Douglas Gregor <dgregor@apple.com> Implement name lookup for conversion function template specializations
(C++ [temp.mem]p5-6), which involves template argument deduction based
on the type named, e.g., given

struct X { template<typename T> operator T*(); } x;

when we call

x.operator int*();

we perform template argument deduction to determine that T=int. This
template argument deduction is needed for template specialization and
explicit instantiation, e.g.,

template<> X::operator float*() { /* ... */ }

and when calling or otherwise naming a conversion function (as in the
first example).

This fixes PR5742 and PR5762, although there's some remaining ugliness
that's causing out-of-line definitions of conversion function
templates to fail. I'll look into that separately.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93162 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
442471309fa97348f849687a6a8ef4acc3bc2c1f 04-Jan-2010 Douglas Gregor <dgregor@apple.com> Make sure to use ASTContext::getAs*ArrayType() when decomposing array
types. Fixes APFloat.cpp compilation failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e724246b9f655801bd96b727daf9dddc44beef4d 30-Dec-2009 Chandler Carruth <chandlerc@gmail.com> More fixes to the handling of CVR-comparisons on array types. Adds a method to
QualType to get CVR-qualifiers through array types, and switches the primary
comparison methods to use it. This may allow simplifying some of the callers of
getUnqualifiedArrayType.

Also fix the normalizing of CV-qualification during template deduction to
normalize through arrays and allow a more qualified deduced array type. This
fixes PR5911.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92289 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
28e318cc6008c2bc008f0caee70dc736a03d6289 29-Dec-2009 Chandler Carruth <chandlerc@gmail.com> Correctly refer to element CVR qualifications when determining if a type is
more or less cv-qualified than another during implicit conversion and overload
resolution ([basic.type.qualifier] p5). Factors the logic out of template
deduction and into the ASTContext so it can be shared.

This fixes several aspects of PR5542, but not all of them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92248 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f5f7d864f5067d1ea4bff7fcf41b53a43b7b48ba 29-Dec-2009 Anders Carlsson <andersca@mac.com> Get rid of FixedWidthIntType, as suggested by Chris and Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92246 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4b52e25f3b05ab0f9d2492276a52323a50a84fb7 22-Dec-2009 Douglas Gregor <dgregor@apple.com> When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91852 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c78a69dd901f200de958063997946119e366e4d2 21-Dec-2009 Douglas Gregor <dgregor@apple.com> Introduce an assertion to ensure that template argument deduction does
not deduce an "overload" type. Such a deduction indicates a failure in
semantic analysis (e.g., PR5811) that currently isn't caught until
code-generation time. This assertions makes it clearer that this
particular issue is a semantic-analysis problem, not a code-gen problem.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ed97649e9574b9d854fa4d6109c9333ae0993554 04-Dec-2009 John McCall <rjmccall@apple.com> Fix "using typename" and the instantiation of non-dependent using declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90614 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
85b4521e34dcd4a0a4a1f0819e1123128e5a3125 28-Nov-2009 Benjamin Kramer <benny.kra@googlemail.com> Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90044 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
51ffb0c9d43b2d3fd210e51ecdd67ba5d1790d70 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement support for default template arguments of function templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89874 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d5532b6cfff2977e0c59fa6ead7f7973984a620d 23-Nov-2009 John McCall <rjmccall@apple.com> Encapsulate "an array of TemplateArgumentLocs and two angle bracket locations" into
a new class. Use it pervasively throughout Sema.

My fingers hurt.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89638 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a4923eb7c4b04d360cb2747641a5e92818edf804 16-Nov-2009 Douglas Gregor <dgregor@apple.com> First part of changes to eliminate problems with cv-qualifiers and
sugared types. The basic problem is that our qualifier accessors
(getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at
the current QualType and not at any qualifiers that come from sugared
types, meaning that we won't see these qualifiers through, e.g.,
typedefs:

typedef const int CInt;
typedef CInt Self;

Self.isConstQualified() currently returns false!

Various bugs (e.g., PR5383) have cropped up all over the front end due
to such problems. I'm addressing this problem by splitting each
qualifier accessor into two versions:

- the "local" version only returns qualifiers on this particular
QualType instance
- the "normal" version that will eventually combine qualifiers from this
QualType instance with the qualifiers on the canonical type to
produce the full set of qualifiers.

This commit adds the local versions and switches a few callers from
the "normal" version (e.g., isConstQualified) over to the "local"
version (e.g., isLocalConstQualified) when that is the right thing to
do, e.g., because we're printing or serializing the qualifiers. Also,
switch a bunch of

Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType()

expressions over to

Context.hasSameUnqualifiedType(T1, T2)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
fd47648b5d351ff6d1a3e886e1c3d10712ba4675 14-Nov-2009 Douglas Gregor <dgregor@apple.com> Revert r88718, which does NOT solve the constructor-template-as-copy-constructor issue. Big thanks to John for finding this

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88724 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
15755cb8399afa702575a21915daf2f6e56b5ac1 14-Nov-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction of a non-type template parameter from a
template argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88722 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
cad84b7c12564ff37feb66d6d004bb609bea8788 14-Nov-2009 Douglas Gregor <dgregor@apple.com> A constructor template cannot be instantiated to a copy
constructor. Make sure that such declarations can never be formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88718 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
db0d4b751e83b8841b8f48f913f17e50467f13d4 12-Nov-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction for template template parameters. This
permits, among other things, ripping apart and reconstructing
templates via partial specialization:

template<typename T>
struct DeepRemoveConst { typedef T type; };

template<typename T>
struct DeepRemoveConst<const T> {
typedef typename DeepRemoveConst<T>::type type;
};

template<template<typename> class TT, typename T>
struct DeepRemoveConst<TT<T> > {
typedef TT<typename DeepRemoveConst<T>::type> type;
};

Also, fix a longstanding thinko in the code handling partial ordering
of class template partial specializations. We were performing the
second deduction without clearing out the results of the first
deduction. It's amazing we got through so much code with such a
horrendous error :(



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
788cd06cf8e868a67158aafec5de3a1f408d14f3 11-Nov-2009 Douglas Gregor <dgregor@apple.com> Introduce a new representation for template template
parameters. Rather than storing them as either declarations (for the
non-dependent case) or expressions (for the dependent case), we now
(always) store them as TemplateNames.

The primary change here is to add a new kind of TemplateArgument,
which stores a TemplateName. However, making that change ripples to
every switch on a TemplateArgument's kind, also affecting
TemplateArgumentLocInfo/TemplateArgumentLoc, default template
arguments for template template parameters, type-checking of template
template arguments, etc.

This change is light on testing. It should fix several pre-existing
problems with template template parameters, such as:
- the inability to use dependent template names as template template
arguments
- template template parameter default arguments cannot be
instantiation

However, there are enough pieces missing that more implementation is
required before we can adequately test template template parameters.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
833ca991c1bfc967f0995974ca86f66ba1f666b5 29-Oct-2009 John McCall <rjmccall@apple.com> Track source information for template arguments and template specialization
types. Preserve it through template instantiation. Preserve it through PCH,
although TSTs themselves aren't serializable, so that's pretty much meaningless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ed9c0f90b7e0811c209b95e39fe07c211c531285 29-Oct-2009 Douglas Gregor <dgregor@apple.com> Implement support for semantic checking and template instantiation of
class template partial specializations of member templates. Also,
fixes a silly little bug in the marking of "used" template parameters
in member templates. Fixes PR5236.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85447 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9994a34f6cf842721ba7723edc0b9036229fe387 25-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Audit the code for places where it is assumed that every base specifier refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e27ec8ad56dbf1efb2de004b90fbbb86f740e3f1 24-Oct-2009 John McCall <rjmccall@apple.com> Store the builtin types as CanQualTypes. Expand a bit on the CanQual API,
but also remove some methods that cause ambiguities, and generally
make CanQual<blah> more analogous to QualType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
467b27b9a24bdc823218ad1ad0e37673b6cc1e83 22-Oct-2009 John McCall <rjmccall@apple.com> Canonicality is a property of qualified types, not unqualified types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84891 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4a5c15f75f76b95e1c2ceb6fa2737dcadd5f4be1 01-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction in the case where the parameter
type is a template-id (e.g., basic_ostream<CharT, Traits>) and the
argument type is a class that has a derived class matching the
parameter type. Previously, we were giving up on template argument
deduction too early.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83177 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d5a423b279e787e9fdd8309fe52cb515388c54ea 25-Sep-2009 Douglas Gregor <dgregor@apple.com> WIP implementation of explicit instantiation of function templates,
member functions of class template specializations, and static data
members. The mechanics are (mostly) present, but the semantic analysis
is very weak.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82789 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b9aa6b214c8fbc3e081dde575eef1f0913d48bdc 25-Sep-2009 Douglas Gregor <dgregor@apple.com> WIP implementation of explicit function template specialization. This
first implementation recognizes when a function declaration is an
explicit function template specialization (based on the presence of a
template<> header), performs template argument deduction + ambiguity
resolution to determine which template is being specialized, and hooks

There are many caveats here:
- We completely and totally drop any explicitly-specified template
arguments on the floor
- We don't diagnose any of the extra semantic things that we should
diagnose.
- I haven't looked to see that we're getting the right linkage for
explicit specializations

On a happy note, this silences a bunch of errors that show up in
libstdc++'s <iostream>, although Clang still can't get through the
entire header.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82728 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0953e767ff7817f97b3ab20896b229891eeff45b 24-Sep-2009 John McCall <rjmccall@apple.com> Refactor the representation of qualifiers to bring ExtQualType out of the
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82705 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
183700f494ec9b6701b6efe82bcb25f4c79ba561 22-Sep-2009 John McCall <rjmccall@apple.com> Change all the Type::getAsFoo() methods to specializations of Type::getAs().
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.

The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82501 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
63f07c55d58951574afe9bbb9f7cb3f92eecdd9b 19-Sep-2009 Douglas Gregor <dgregor@apple.com> Make the construction of the code-completion string for a function
template smarter, by taking into account which function template
parameters are deducible from the call arguments. For example,

template<typename RandomAccessIterator>
void sort(RandomAccessIterator first, RandomAccessIterator last);

will have a code-completion string like

sort({RandomAccessIterator first}, {RandomAccessIterator last})

since the template argument for its template parameter is
deducible. On the other hand,

template<class X, class Y>
X* dyn_cast(Y *Val);

will have a code-completion string like

dyn_cast<{class X}>({Y *Val})

since the template type parameter X is not deducible from the function
call.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82306 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f882574cf640d5c8355965e1c486f9d8d8ffcf47 15-Sep-2009 Douglas Gregor <dgregor@apple.com> Add an assertion and a test case, in a fruitless attempt to track down an existing bug

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9eea08ba72f8b1e7faf38e43376b9157fc4a2af2 15-Sep-2009 Douglas Gregor <dgregor@apple.com> Slightly improved template argument deduction for use in partial
ordering, along with another test case for partial ordering of partial
specializations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81869 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
bf4ea56cdc376cef5a12abf6bf18dc34805c2226 15-Sep-2009 Douglas Gregor <dgregor@apple.com> Implement partial ordering of class template partial specializations
(C++ [temp.class.order]).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81866 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e73bb60de3c7c60453a86e097fc428d1cd367a42 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Refactor MarkDeductedTemplateParameters into
MarkUsedTemplateParameters, which is able to mark template parameters
used within non-deduced contexts as well as deduced contexts. Use this
to finish the implementation of [temp.deduct.partial]p11.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1282029f3d37f482bbba3c38ea9da17a78d11d40 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Tighten up checking of non-dependent arguments as part of template
argument deduction. This fixes the new test case (since partial
ordering does not have a "verify the results of deduction" step), and
will allow failed template argument deductions to return more quickly
for, e.g., matching class template partial specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
8a51491d936d8c50480f3c3ca6647be12a7ad51f 14-Sep-2009 Douglas Gregor <dgregor@apple.com> Implement partial ordering of function template specializations
(C++ [temp.func.order]).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
357bbd022c1d340c8e255aea7a684ddb34bc76e5 28-Aug-2009 Douglas Gregor <dgregor@apple.com> Tighten up the conversion from a single-level template argument list
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
ce3ff2bd3a3386dbc209d3cba4b8769173b274c1 26-Aug-2009 John McCall <rjmccall@apple.com> Clarify the difference between substitution and instantiation by renaming
functions that don't instantiate definitions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80037 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
65ec1fda479688d143fe2403242cd9c730c800a1 22-Aug-2009 Douglas Gregor <dgregor@apple.com> Implement conversion function templates, along with the ability to use
template argument deduction from a conversion function (C++
[temp.deduct.conv]) with implicit conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d497206844a894a0557e927adf29b34fe960dffd 08-Aug-2009 Anders Carlsson <andersca@mac.com> Get rid of Stmt::Clone now that we can reference count statements instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78452 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6217b80b7a1379b74cced1c076338262c3c980b3 29-Jul-2009 Ted Kremenek <kremenek@apple.com> Change uses of:
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f290e0db835a619014538c41ed552696efc0e977 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Fix the problems with template argument deduction and array types for
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
b084a05b3546137c71bed3cdf469b85e56deac75 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Canonicalize the types produced by template argument deduction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76777 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9e9fae4b8af47c15696da4ea3c30102e3a035179 22-Jul-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction for array types, so that a parameter

const T

can be matched with, e.g.,

volatile int [5]




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76773 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c15cb2af27514ecc879daba9aa01389c5203685d 18-Jul-2009 Steve Naroff <snaroff@apple.com> Remove ObjCQualifiedInterfaceType:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76321 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
97fbaa2a38804268a024f1a104b43fcf8b4411b0 18-Jul-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its place.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
35366a67baa970c287c714c957cf78a4131cf60d 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
5cad1f74469d4d8b4fc51fe53a7837778aeb6107 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76139 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
808825cd08704d1cccef605f8cd3ef83c93eac78 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76132 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1a1a6e2bd4c5aefd7fd643cf25915f9623a02e59 16-Jul-2009 Ted Kremenek <kremenek@apple.com> Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
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>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76098 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
83314aa1cf61ed2458a8a20c83b2d4708192d5dc 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Implement template argument deduction when taking the address of a
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75044 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
8fdc3c49e3c8178222a35b16426dc5a08a0efb6d 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction from a call has improved a bit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
de0cb8b6c15c756e14b0716bebd40f4ce48ee717 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction from a call. In particular,
implement C++ [temp.deduct.call]p3b3, which allows a template-id
parameter to match a derived class of the argument, while deducing
template arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
cca9e9674a5e50a283185d8e9d8a5c3414eb008e 02-Jul-2009 Douglas Gregor <dgregor@apple.com> Keep track of more information within the template instantiation stack, e.g.,
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
16134c62ef3d146e0dd0c76aafb906ff12c0a15d 01-Jul-2009 Douglas Gregor <dgregor@apple.com> Cope with explicitly-specified function template arguments when there
are fewer template arguments than there are template parameters for
that function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
6db8ed4498b83fe9336e3855a4ba1a298b04ee00 01-Jul-2009 Douglas Gregor <dgregor@apple.com> When explicit template arguments are provided for a function call,
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74576 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
127102b5196ffe04bdb70fd553fe62c265ab10a9 29-Jun-2009 Douglas Gregor <dgregor@apple.com> Keep track of function template specializations, to eliminate
redundant, implicit instantiations of function templates and provide a
place where we can hang function template specializations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74454 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4112877d1043d0b937f5abcf043bc7fa48138f05 27-Jun-2009 Douglas Gregor <dgregor@apple.com> Set the rest of the flags we need to perform template argument
deduction using a base class of the argument type. No actual
functionality change; this is just a hook.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74356 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
508f1c889b9833903ea394034fe0246d3a57a32d 27-Jun-2009 Douglas Gregor <dgregor@apple.com> During template argument deduction from a function call, allow
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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74354 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f670c8cfa58b4c224eb8fb566130dc47844dd3de 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction is no longer responsible for checking
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
500d331eade2f5070b66ba51d777224f9fda6e1d 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction for reference parameters when
deducing template arguments from a function call. Plus, add a bunch of
tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
1637be727f2a0434c1ed7aa385ea1c18328b0ccd 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Implicit instantiation for function template specializations.

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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e53060fa78ad7e98352049f72787bdb7543e2a48 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improved semantic analysis and AST respresentation for function
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
fb25052736439d72a557cddd41dfb927bcb3d3e5 23-Jun-2009 Anders Carlsson <andersca@mac.com> Check in a new template argument list builder that should work better for variadic templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73937 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f6ddb737cb882ffbf0b75a9abd50b930cc2b9068 18-Jun-2009 Douglas Gregor <dgregor@apple.com> Some cleanups suggested by Chris

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73713 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d1b3c2dd5bc1f3103bee6137957aa7c5f8f2f0bc 18-Jun-2009 Steve Naroff <snaroff@apple.com> First step toward fixing <rdar://problem/6613046> refactor clang objc type 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73649 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9cdda0cf8528e3d595be9bfa002f0450074beb4d 17-Jun-2009 Douglas Gregor <dgregor@apple.com> Support dependent extended vector types and template instantiation
thereof. Patch by Anders Johnsen!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
25af1ed6ffa46a333886264299be98a838097b34 17-Jun-2009 Anders Carlsson <andersca@mac.com> Since integral template arguments can't have dependent types we don't need an extra pass to set the right APSInt bit width/signedness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73580 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
335e24a194f2000086d298b800d6169ebc5a7ee6 17-Jun-2009 Anders Carlsson <andersca@mac.com> Make DeduceNonTypeTemplateArgument take an APSInt instead of an APInt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73574 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d01b1da213aeb71fd40ff7fb78a194613cc1ece7 15-Jun-2009 Anders Carlsson <andersca@mac.com> Add a new 'Pack' argument kind to TemplateArgument. This is not yet used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73391 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
bb2604122f4186b6f666481f699b27c7e7a95790 14-Jun-2009 Douglas Gregor <dgregor@apple.com> Introduce a SFINAE "trap" that keeps track of the number of errors
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73336 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c9e5d25ea33616c896a2ce5fbd6d68186eaddc5c 13-Jun-2009 Douglas Gregor <dgregor@apple.com> Remove a bunch of unnecessary template argument deduction code that was
obviously written by someone who didn't read C++ [temp.class.spec].


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73276 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
031a5880e19d06624551aed9d74594356f4f9db1 13-Jun-2009 Douglas Gregor <dgregor@apple.com> When some template parameters of a class template partial
specialization cannot be deduced, produce a warning noting that the
affected class template partial specialization will never be used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9a917e4fac79aba20fbd25983c78396475078918 13-Jun-2009 Anders Carlsson <andersca@mac.com> Address comments from Doug - Add a Sema::SemaRef.BuildBlockPointerType and use it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73264 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
c1efb3faefa7d42f974fe384dfd45e5127f8afa6 13-Jun-2009 Douglas Gregor <dgregor@apple.com> It looks like we've finished off matching of class template partial specializations; add comments and update the C++ status page

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73263 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
f67875d5addf36b951ad37fb04509ab2b572c88a 12-Jun-2009 Douglas Gregor <dgregor@apple.com> Improve template argument deduction to keep track of why template
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".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73237 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
859ba504e754436e1ccf81f50800e5d2ea647447 12-Jun-2009 Anders Carlsson <andersca@mac.com> Deducation and instantiation of block types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
02cbbd2d945e466174bee536758e5a2e6a1c0ea2 11-Jun-2009 Douglas Gregor <dgregor@apple.com> Once we have deduced the template arguments of a class template
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
637a4097f61b09d6ccf619298d9d121fafa044e4 11-Jun-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction for member pointers.

Also, introduced some of the framework for performing instantiation as
part of template argument deduction.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73175 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d708c72e3e5186662fb0045d2bd666bfd93a013d 09-Jun-2009 Douglas Gregor <dgregor@apple.com> Implement template argument deduction for class template
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73136 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
994b6cb65c9daba2128366bc4c64be6dbf953528 08-Jun-2009 Anders Carlsson <andersca@mac.com> Address comments from Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73077 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0fce0ae7d60bed52e36c87194922b7aecce78b83 08-Jun-2009 Douglas Gregor <dgregor@apple.com> Document the template argument deduction patterns that Anders' patch supports

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73071 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
a27fad59dc760252af025ef6a86d31bb7d11a44a 08-Jun-2009 Anders Carlsson <andersca@mac.com> Template argument deduction for function types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73070 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
9ba41645892da0000fe8a7832b80208f44dafeda 05-Jun-2009 Anders Carlsson <andersca@mac.com> Make TemplateArgumentListBuilder take an ASTContext (because we're probably 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72918 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
e9c904b082ac3299831704a69066b86ab0f78bec 05-Jun-2009 Anders Carlsson <andersca@mac.com> Make the TemplateArgumentList take a TemplateArgumentListBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72917 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
199d99192fbcca9f043596c40ead4afab4999dba 05-Jun-2009 Douglas Gregor <dgregor@apple.com> Several improvements to template argument deduction:
- Once we have deduced template arguments for a class template partial
specialization, we use exactly those template arguments for instantiating
the definition of the class template partial specialization.
- Added template argument deduction for non-type template parameters.
- Added template argument deduction for dependently-sized array types.

With these changes, we can now implement, e.g., the remove_reference
type trait. Also, Daniel's Ackermann template metaprogram now compiles
properly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72909 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
4d6fb501ffc0568ca5ca7266005e96a6f1273845 04-Jun-2009 Anders Carlsson <andersca@mac.com> Template argument deduction for incomplete and constant array types. Doug, please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72844 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
d560d5025a0e5b1942d99d5f39005337b03a64c2 04-Jun-2009 Douglas Gregor <dgregor@apple.com> Template argument deduction for references

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp
0b9247f129401b4849682b2e2bcdea8fc977068a 04-Jun-2009 Douglas Gregor <dgregor@apple.com> When performing template argument deduction, ensure that multiple
deductions of the same template parameter are equivalent. This allows
us to implement the is_same type trait (!).

Also, move template argument deduction into its own file and update a
few build systems with this change (grrrr).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72819 91177308-0d34-0410-b5e6-96231b3b80d8
/external/clang/lib/Sema/SemaTemplateDeduction.cpp