================
@@ -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
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to