[PATCH] D86130: [AST] Fix a crash on mangling a binding decl from a DeclRefExpr.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 19 00:13:53 PDT 2020
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5b797eb5b4db: [AST] Fix a crash on mangling a binding decl from a DeclRefExpr. (authored by hokein).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86130/new/
https://reviews.llvm.org/D86130
Files:
clang/lib/AST/ItaniumMangle.cpp
clang/test/CodeGenCXX/mangle.cpp
Index: clang/test/CodeGenCXX/mangle.cpp
===================================================================
--- clang/test/CodeGenCXX/mangle.cpp
+++ clang/test/CodeGenCXX/mangle.cpp
@@ -1138,3 +1138,20 @@
// CHECK-LABEL: @_ZN6test581AC1INS_5StateEEET_MNS_8identityIS3_E4typeEFbvE
void fn1() { A(a, &State::m_fn1); }
}
+
+namespace test59 {
+ // verify no crash.
+ template<typename T>
+ void f(T g) {
+ auto [e] = g;
+ [](decltype(e)) {};
+ }
+}
+
+namespace test60 {
+ struct X { int i, j; };
+ auto [a,b] = X{1,2};
+ template<typename T> void f(decltype(a + T())) {}
+ // CHECK-LABEL: @_ZN6test601fIiEEvDTplL_ZNS_1aEEcvT__EE
+ template void f<int>(int);
+}
Index: clang/lib/AST/ItaniumMangle.cpp
===================================================================
--- clang/lib/AST/ItaniumMangle.cpp
+++ clang/lib/AST/ItaniumMangle.cpp
@@ -657,6 +657,8 @@
mangleName(FD);
else if (const MSGuidDecl *GuidD = dyn_cast<MSGuidDecl>(GD.getDecl()))
mangleName(GuidD);
+ else if (const BindingDecl *BD = dyn_cast<BindingDecl>(GD.getDecl()))
+ mangleName(BD);
else
llvm_unreachable("unexpected kind of global decl");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86130.286490.patch
Type: text/x-patch
Size: 1161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200819/08914941/attachment.bin>
More information about the cfe-commits
mailing list