diff options
author | Erich Keane <ekeane@nvidia.com> | 2024-01-24 07:11:33 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 07:11:33 -0800 |
commit | 7d1982f62bfc9ec897d8dc8837100c6c2f2de156 (patch) | |
tree | 9307b92512e984bca262fb76436439ada0fa64ee /clang/lib/AST/ItaniumMangle.cpp | |
parent | aaa93ce7323332d8290b8f563d4d71689c1094c5 (diff) | |
download | llvm-7d1982f62bfc9ec897d8dc8837100c6c2f2de156.zip llvm-7d1982f62bfc9ec897d8dc8837100c6c2f2de156.tar.gz llvm-7d1982f62bfc9ec897d8dc8837100c6c2f2de156.tar.bz2 |
Revert "[c++20] P1907R1: Support for generalized non-type template arguments of scalar type."revert-78041-p1907r1
Diffstat (limited to 'clang/lib/AST/ItaniumMangle.cpp')
-rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 40b1e08..f78265df 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -4833,23 +4833,9 @@ recurse: E = cast<CXXStdInitializerListExpr>(E)->getSubExpr(); goto recurse; - case Expr::SubstNonTypeTemplateParmExprClass: { - // Mangle a substituted parameter the same way we mangle the template - // argument. - auto *SNTTPE = cast<SubstNonTypeTemplateParmExpr>(E); - if (auto *CE = dyn_cast<ConstantExpr>(SNTTPE->getReplacement())) { - // Pull out the constant value and mangle it as a template argument. - QualType ParamType = SNTTPE->getParameterType(Context.getASTContext()); - assert(CE->hasAPValueResult() && "expected the NTTP to have an APValue"); - mangleValueInTemplateArg(ParamType, CE->getAPValueResult(), false, - /*NeedExactType=*/true); - break; - } - // The remaining cases all happen to be substituted with expressions that - // mangle the same as a corresponding template argument anyway. + case Expr::SubstNonTypeTemplateParmExprClass: E = cast<SubstNonTypeTemplateParmExpr>(E)->getReplacement(); goto recurse; - } case Expr::UserDefinedLiteralClass: // We follow g++'s approach of mangling a UDL as a call to the literal @@ -6078,11 +6064,6 @@ void CXXNameMangler::mangleTemplateArg(TemplateArgument A, bool NeedExactType) { mangleNullPointer(A.getNullPtrType()); break; } - case TemplateArgument::StructuralValue: - mangleValueInTemplateArg(A.getStructuralValueType(), - A.getAsStructuralValue(), - /*TopLevel=*/true, NeedExactType); - break; case TemplateArgument::Pack: { // <template-arg> ::= J <template-arg>* E Out << 'J'; @@ -6491,20 +6472,7 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue &V, Out << "plcvPcad"; Kind = Offset; } else { - // Clang 11 and before mangled an array subject to array-to-pointer decay - // as if it were the declaration itself. - bool IsArrayToPointerDecayMangledAsDecl = false; - if (TopLevel && Ctx.getLangOpts().getClangABICompat() <= - LangOptions::ClangABI::Ver11) { - QualType BType = B.getType(); - IsArrayToPointerDecayMangledAsDecl = - BType->isArrayType() && V.getLValuePath().size() == 1 && - V.getLValuePath()[0].getAsArrayIndex() == 0 && - Ctx.hasSimilarType(T, Ctx.getDecayedType(BType)); - } - - if ((!V.getLValuePath().empty() || V.isLValueOnePastTheEnd()) && - !IsArrayToPointerDecayMangledAsDecl) { + if (!V.getLValuePath().empty() || V.isLValueOnePastTheEnd()) { NotPrimaryExpr(); // A final conversion to the template parameter's type is usually // folded into the 'so' mangling, but we can't do that for 'void*' |