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 834ef4e..0969b87 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -2048,6 +2048,28 @@
Out << "sp";
mangleExpression(cast<PackExpansionExpr>(E)->getPattern());
break;
+
+ case Expr::SizeOfPackExprClass: {
+ // FIXME: Variadic templates missing mangling for function parameter packs?
+ Out << "sZ";
+ const NamedDecl *Pack = cast<SizeOfPackExpr>(E)->getPack();
+ if (const TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(Pack))
+ mangleTemplateParameter(TTP->getIndex());
+ else if (const NonTypeTemplateParmDecl *NTTP
+ = dyn_cast<NonTypeTemplateParmDecl>(Pack))
+ mangleTemplateParameter(NTTP->getIndex());
+ else if (const TemplateTemplateParmDecl *TempTP
+ = dyn_cast<TemplateTemplateParmDecl>(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;
+ }
+ }
}
}