diff options
author | John McCall <rjmccall@apple.com> | 2009-10-29 18:45:58 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2009-10-29 18:45:58 +0000 |
commit | 828bff2079b6a91ecd7ed5b842c59527d7682789 (patch) | |
tree | 8a8388f7b4d1b260e6b197d49b5fb5d39e19549a /lib/Sema/SemaTemplate.cpp | |
parent | fd2300e1ee0eab6c51862a92d3f3c72540b36b23 (diff) |
A few TemplateArgumentLoc clean-ups. Try to remember the Expr for a declaration.
Provide an API for getting the SourceRange of a TAL and use it judiciously.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index a2883fa980..fb5eef2760 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -1425,7 +1425,8 @@ bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, // We have a template type parameter but the template argument // is not a type. - Diag(AL.getLocation(), diag::err_template_arg_must_be_type); + SourceRange SR = AL.getSourceRange(); + Diag(SR.getBegin(), diag::err_template_arg_must_be_type) << SR; Diag(Param->getLocation(), diag::note_template_param_here); return true; @@ -1558,8 +1559,8 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, break; // FIXME: Subst default argument - // FIXME: preserve source information - Arg = TemplateArgumentLoc(TemplateArgument(TempParm->getDefaultArgument())); + Arg = TemplateArgumentLoc(TemplateArgument(TempParm->getDefaultArgument()), + TempParm->getDefaultArgument()); } } else { // Retrieve the template argument produced by the user. @@ -1646,11 +1647,12 @@ bool Sema::CheckTemplateArgumentList(TemplateDecl *Template, // We warn specifically about this case, since it can be rather // confusing for users. QualType T = Arg.getArgument().getAsType(); + SourceRange SR = Arg.getSourceRange(); if (T->isFunctionType()) - Diag(Arg.getLocation(), diag::err_template_arg_nontype_ambig) - << T; + Diag(SR.getBegin(), diag::err_template_arg_nontype_ambig) + << SR << T; else - Diag(Arg.getLocation(), diag::err_template_arg_must_be_expr); + Diag(SR.getBegin(), diag::err_template_arg_must_be_expr) << SR; Diag((*Param)->getLocation(), diag::note_template_param_here); Invalid = true; break; |