[Lldb-commits] [clang-tools-extra] [clang] [lldb] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)

Andrey Ali Khan Bolshakov via lldb-commits lldb-commits at lists.llvm.org
Sat Jan 20 03:55:49 PST 2024


================
@@ -6472,7 +6494,20 @@ void CXXNameMangler::mangleValueInTemplateArg(QualType T, const APValue &V,
       Out << "plcvPcad";
       Kind = Offset;
     } else {
-      if (!V.getLValuePath().empty() || V.isLValueOnePastTheEnd()) {
+      // 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));
+      }
+
----------------
bolshakov-a wrote:

This concerns ABI changes which are actually present in Clang since ver. 12. I think, they have been introduced [here](https://github.com/llvm/llvm-project/commit/6c365cd31e323d2d075573edd927e4f7fb5ec01c#diff-8a63be2ffd0742a4ce78d229b1bad68c62dd0b95e39d7f9a378bb52ad3f4a0b7R5011). The changes in this PR are to avoid regression. The test `CodeGenCXX/clang-abi-compat.cpp` fails if they are removed.

https://github.com/llvm/llvm-project/pull/78041


More information about the lldb-commits mailing list