From b55fdf8c6f4bd50dc930f7b89a5e2a394447d712 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 15 Dec 2010 17:38:57 +0000 Subject: [PATCH] Move the work-in-progress implementation of variadic templates to its own file in Sema. No functionality change. llvm-svn: 121869 --- clang/lib/Sema/CMakeLists.txt | 1 + clang/lib/Sema/SemaTemplate.cpp | 29 ---------------- clang/lib/Sema/SemaTemplateVariadic.cpp | 46 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 clang/lib/Sema/SemaTemplateVariadic.cpp diff --git a/clang/lib/Sema/CMakeLists.txt b/clang/lib/Sema/CMakeLists.txt index c220e90c1292..af9c2f4c4536 100644 --- a/clang/lib/Sema/CMakeLists.txt +++ b/clang/lib/Sema/CMakeLists.txt @@ -33,6 +33,7 @@ add_clang_library(clangSema SemaTemplateDeduction.cpp SemaTemplateInstantiate.cpp SemaTemplateInstantiateDecl.cpp + SemaTemplateVariadic.cpp SemaType.cpp TargetAttributesSema.cpp ) diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 088e0193a599..4b8c455731a1 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -5961,32 +5961,3 @@ Sema::getTemplateArgumentBindingsText(const TemplateParameterList *Params, return Result; } -bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc, - TypeSourceInfo *T, - UnexpandedParameterPackContext UPPC) { - // C++0x [temp.variadic]p5: - // An appearance of a name of a parameter pack that is not expanded is - // ill-formed. - if (!T->getType()->containsUnexpandedParameterPack()) - return false; - - // FIXME: Provide the names and locations of the unexpanded parameter packs. - Diag(Loc, diag::err_unexpanded_parameter_pack) - << (int)UPPC << T->getTypeLoc().getSourceRange(); - return true; -} - -bool Sema::DiagnoseUnexpandedParameterPack(Expr *E, - UnexpandedParameterPackContext UPPC) { - // C++0x [temp.variadic]p5: - // An appearance of a name of a parameter pack that is not expanded is - // ill-formed. - if (!E->containsUnexpandedParameterPack()) - return false; - - // FIXME: Provide the names and locations of the unexpanded parameter packs. - Diag(E->getSourceRange().getBegin(), diag::err_unexpanded_parameter_pack) - << (int)UPPC << E->getSourceRange(); - return true; -} - diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp new file mode 100644 index 000000000000..42b868f574d5 --- /dev/null +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -0,0 +1,46 @@ +//===------- SemaTemplateVariadic.cpp - C++ Variadic Templates ------------===/ +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +//===----------------------------------------------------------------------===/ +// +// This file implements semantic analysis for C++0x variadic templates. +//===----------------------------------------------------------------------===/ + +#include "clang/Sema/Sema.h" +#include "clang/Sema/SemaInternal.h" +#include "clang/AST/Expr.h" +#include "clang/AST/TypeLoc.h" + +using namespace clang; + +bool Sema::DiagnoseUnexpandedParameterPack(SourceLocation Loc, + TypeSourceInfo *T, + UnexpandedParameterPackContext UPPC) { + // C++0x [temp.variadic]p5: + // An appearance of a name of a parameter pack that is not expanded is + // ill-formed. + if (!T->getType()->containsUnexpandedParameterPack()) + return false; + + // FIXME: Provide the names and locations of the unexpanded parameter packs. + Diag(Loc, diag::err_unexpanded_parameter_pack) + << (int)UPPC << T->getTypeLoc().getSourceRange(); + return true; +} + +bool Sema::DiagnoseUnexpandedParameterPack(Expr *E, + UnexpandedParameterPackContext UPPC) { + // C++0x [temp.variadic]p5: + // An appearance of a name of a parameter pack that is not expanded is + // ill-formed. + if (!E->containsUnexpandedParameterPack()) + return false; + + // FIXME: Provide the names and locations of the unexpanded parameter packs. + Diag(E->getSourceRange().getBegin(), diag::err_unexpanded_parameter_pack) + << (int)UPPC << E->getSourceRange(); + return true; +}