diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-02-21 20:05:19 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-02-21 20:05:19 +0000 |
commit | b2bc2e67520df0417fc5287de92e3cebd3060cfd (patch) | |
tree | 8eb5c1796680a77e020f0559a51e302b8a4616e4 /clang/lib/Sema/SemaTemplateDeduction.cpp | |
parent | bda17491c4885ed37235c1e8afcfe75de479cd3b (diff) | |
download | bcm5719-llvm-b2bc2e67520df0417fc5287de92e3cebd3060cfd.tar.gz bcm5719-llvm-b2bc2e67520df0417fc5287de92e3cebd3060cfd.zip |
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.
llvm-svn: 126139
Diffstat (limited to 'clang/lib/Sema/SemaTemplateDeduction.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index bd0a618283b..139fafb346f 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -3004,12 +3004,12 @@ Sema::DeduceAutoType(QualType Type, Expr *Init, QualType &Result) { LocalInstantiationScope InstScope(*this); // Build template<class TemplParam> void Func(FuncParam); - NamedDecl *TemplParam - = TemplateTypeParmDecl::Create(Context, 0, Loc, 0, 0, 0, false, false); - TemplateParameterList *TemplateParams - = TemplateParameterList::Create(Context, Loc, Loc, &TemplParam, 1, Loc); - QualType TemplArg = Context.getTemplateTypeParmType(0, 0, false); + TemplateTypeParmDecl TemplParam(0, Loc, 0, false, TemplArg, false); + NamedDecl *TemplParamPtr = &TemplParam; + FixedSizeTemplateParameterList<1> TemplateParams(Loc, Loc, &TemplParamPtr, + Loc); + QualType FuncParam = SubstituteAutoTransform(*this, TemplArg).TransformType(Type); @@ -3018,13 +3018,13 @@ Sema::DeduceAutoType(QualType Type, Expr *Init, QualType &Result) { Deduced.resize(1); QualType InitType = Init->getType(); unsigned TDF = 0; - if (AdjustFunctionParmAndArgTypesForDeduction(*this, TemplateParams, + if (AdjustFunctionParmAndArgTypesForDeduction(*this, &TemplateParams, FuncParam, InitType, Init, TDF)) return false; TemplateDeductionInfo Info(Context, Loc); - if (::DeduceTemplateArguments(*this, TemplateParams, + if (::DeduceTemplateArguments(*this, &TemplateParams, FuncParam, InitType, Info, Deduced, TDF)) return false; |