diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-05 18:58:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-05 18:58:31 +0000 |
commit | a7fc901a2e39bfe55bfcff5934b2d9fdf9656491 (patch) | |
tree | f6b1e6428fb15d6d480a43252cffba3607577fd7 /lib/Sema/TreeTransform.h | |
parent | cbf40f913aa2aa5de6e0540fed209405d00a2c69 (diff) |
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
Diffstat (limited to 'lib/Sema/TreeTransform.h')
-rw-r--r-- | lib/Sema/TreeTransform.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 919f2c879c..d15f91a745 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2123,12 +2123,18 @@ public: } case TemplateArgument::Template: - llvm_unreachable("Unsupported pack expansion of templates"); + return TemplateArgumentLoc(TemplateArgument( + Pattern.getArgument().getAsTemplate(), + true), + Pattern.getTemplateQualifierRange(), + Pattern.getTemplateNameLoc(), + EllipsisLoc); case TemplateArgument::Null: case TemplateArgument::Integral: case TemplateArgument::Declaration: case TemplateArgument::Pack: + case TemplateArgument::TemplateExpansion: llvm_unreachable("Pack expansion pattern has no parameter packs"); case TemplateArgument::Type: @@ -2531,7 +2537,11 @@ void TreeTransform<Derived>::InventTemplateArgumentLoc( case TemplateArgument::Template: Output = TemplateArgumentLoc(Arg, SourceRange(), Loc); break; - + + case TemplateArgument::TemplateExpansion: + Output = TemplateArgumentLoc(Arg, SourceRange(), Loc, Loc); + break; + case TemplateArgument::Expression: Output = TemplateArgumentLoc(Arg, Arg.getAsExpr()); break; @@ -2600,7 +2610,10 @@ bool TreeTransform<Derived>::TransformTemplateArgument( Input.getTemplateNameLoc()); return false; } - + + case TemplateArgument::TemplateExpansion: + llvm_unreachable("Caller should expand pack expansions"); + case TemplateArgument::Expression: { // Template argument expressions are not potentially evaluated. EnterExpressionEvaluationContext Unevaluated(getSema(), |