From: Douglas Gregor Date: Tue, 4 Jan 2011 18:56:13 +0000 (+0000) Subject: Implement name mangling for sizeof...(pack), to silence the last of X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e774c4efb24403049f9235c6ce08506cbb8c82a;p=clang Implement name mangling for sizeof...(pack), to silence the last of the switch-enum warnings. Test is forthcoming, once I've dealt with some template argument deduction issues. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122820 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 834ef4e569..0969b8716f 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -2048,6 +2048,28 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) { Out << "sp"; mangleExpression(cast(E)->getPattern()); break; + + case Expr::SizeOfPackExprClass: { + // FIXME: Variadic templates missing mangling for function parameter packs? + Out << "sZ"; + const NamedDecl *Pack = cast(E)->getPack(); + if (const TemplateTypeParmDecl *TTP = dyn_cast(Pack)) + mangleTemplateParameter(TTP->getIndex()); + else if (const NonTypeTemplateParmDecl *NTTP + = dyn_cast(Pack)) + mangleTemplateParameter(NTTP->getIndex()); + else if (const TemplateTemplateParmDecl *TempTP + = dyn_cast(Pack)) + mangleTemplateParameter(TempTP->getIndex()); + else { + // FIXME: This case isn't handled by the Itanium C++ ABI + Diagnostic &Diags = Context.getDiags(); + unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error, + "cannot mangle sizeof...(function parameter pack)"); + Diags.Report(DiagID); + return; + } + } } }