[PATCH] D99407: [clang][ItaniumMangle] Check SizeExpr for DependentSizedArrayType (PR49478)
Tommy Chiang via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 26 03:58:43 PDT 2021
oToToT updated this revision to Diff 333526.
oToToT added a comment.
Remove redundant whitespace in comment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99407/new/
https://reviews.llvm.org/D99407
Files:
clang/lib/AST/ItaniumMangle.cpp
clang/test/AST/ast-dump-array-json.cpp
Index: clang/test/AST/ast-dump-array-json.cpp
===================================================================
--- /dev/null
+++ clang/test/AST/ast-dump-array-json.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump=json -ast-dump-filter Test %s | FileCheck %s
+
+template<unsigned... N> struct A { static const int Test[]; };
+template<unsigned... N> const int A<N...>::Test[] = { N... };
+
+// CHECK: "mangledName": "_ZN1A4TestE",
+// CHECK: "mangledName": "_ZN1A4TestE",
Index: clang/lib/AST/ItaniumMangle.cpp
===================================================================
--- clang/lib/AST/ItaniumMangle.cpp
+++ clang/lib/AST/ItaniumMangle.cpp
@@ -3204,7 +3204,11 @@
}
void CXXNameMangler::mangleType(const DependentSizedArrayType *T) {
Out << 'A';
- mangleExpression(T->getSizeExpr());
+ // A DependentSizedArrayType might not have the size expression as below.
+ //
+ // template<int ...N> int arr[] = {N...};
+ if (T->getSizeExpr())
+ mangleExpression(T->getSizeExpr());
Out << '_';
mangleType(T->getElementType());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99407.333526.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210326/fde3fd5d/attachment.bin>
More information about the cfe-commits
mailing list