summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateVariadic.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-19 21:32:01 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-19 21:32:01 +0000
commit476e3029ec4df254ce2b56579bf937c24e120faf (patch)
treefff985e49f3e7b1575199850036663de380df0d3 /clang/lib/Sema/SemaTemplateVariadic.cpp
parent54bce44895424fa1fce1a5f70d9ec79f9ca70fa3 (diff)
downloadbcm5719-llvm-476e3029ec4df254ce2b56579bf937c24e120faf.tar.gz
bcm5719-llvm-476e3029ec4df254ce2b56579bf937c24e120faf.zip
Implement basic support for the use of variadic templates and blocks
together. In particular: - Handle the use of captured parameter pack names within blocks (BlockDeclRefExpr understands parameter packs now) - Handle the declaration and expansion of parameter packs within a block's parameter list, e.g., ^(Args ...args) { ... }) - Handle instantiation of blocks where the return type was not explicitly specified. (unrelated, but necessary for my tests). Together, these fixes should make blocks and variadic templates work reasonably well together. Note that BlockDeclRefExpr is still broken w.r.t. its computation of type and value dependence, which will still cause problems for blocks in templates. llvm-svn: 123849
Diffstat (limited to 'clang/lib/Sema/SemaTemplateVariadic.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateVariadic.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp
index 38a777efb17..3f76d9f6e31 100644
--- a/clang/lib/Sema/SemaTemplateVariadic.cpp
+++ b/clang/lib/Sema/SemaTemplateVariadic.cpp
@@ -64,7 +64,7 @@ namespace {
return true;
}
- /// \brief Record occurrences of (FIXME: function and) non-type template
+ /// \brief Record occurrences of function and non-type template
/// parameter packs in an expression.
bool VisitDeclRefExpr(DeclRefExpr *E) {
if (E->getDecl()->isParameterPack())
@@ -73,6 +73,15 @@ namespace {
return true;
}
+ // \brief Record occurrences of function and non-type template parameter
+ // packs in a block-captured expression.
+ bool VisitBlockDeclRefExpr(BlockDeclRefExpr *E) {
+ if (E->getDecl()->isParameterPack())
+ Unexpanded.push_back(std::make_pair(E->getDecl(), E->getLocation()));
+
+ return true;
+ }
+
/// \brief Record occurrences of template template parameter packs.
bool TraverseTemplateName(TemplateName Template) {
if (TemplateTemplateParmDecl *TTP
OpenPOWER on IntegriCloud