[ItaniumMangle] Correctly mangle BuiltinTemplateDecls
A BuiltinTemplateDecl has no underlying templated decl and as such they cannot be relied upon for mangling. The ItaniumMangler had some bugs here which lead to crashes. This fixes PR28519. llvm-svn: 275190
This commit is contained in:
parent
3b0a9934fa
commit
6d2b60a2be
|
@ -910,6 +910,8 @@ void CXXNameMangler::mangleUnscopedTemplateName(
|
|||
assert(!AdditionalAbiTags &&
|
||||
"template template param cannot have abi tags");
|
||||
mangleTemplateParameter(TTP->getIndex());
|
||||
} else if (isa<BuiltinTemplateDecl>(ND)) {
|
||||
mangleUnscopedName(ND, AdditionalAbiTags);
|
||||
} else {
|
||||
mangleUnscopedName(ND->getTemplatedDecl(), AdditionalAbiTags);
|
||||
}
|
||||
|
@ -1715,7 +1717,10 @@ void CXXNameMangler::mangleTemplatePrefix(const TemplateDecl *ND,
|
|||
mangleTemplateParameter(TTP->getIndex());
|
||||
} else {
|
||||
manglePrefix(getEffectiveDeclContext(ND), NoFunction);
|
||||
mangleUnqualifiedName(ND->getTemplatedDecl(), nullptr);
|
||||
if (isa<BuiltinTemplateDecl>(ND))
|
||||
mangleUnqualifiedName(ND, nullptr);
|
||||
else
|
||||
mangleUnqualifiedName(ND->getTemplatedDecl(), nullptr);
|
||||
}
|
||||
|
||||
addSubstitution(ND);
|
||||
|
|
|
@ -201,3 +201,14 @@ namespace test14 {
|
|||
|
||||
int call(bool b) { return inl<void>(b); }
|
||||
}
|
||||
|
||||
namespace std {
|
||||
template <class _Tp, _Tp...> struct integer_sequence {};
|
||||
}
|
||||
|
||||
namespace test15 {
|
||||
template <int N>
|
||||
__make_integer_seq<std::integer_sequence, int, N> make() {}
|
||||
template __make_integer_seq<std::integer_sequence, int, 5> make<5>();
|
||||
// CHECK: define weak_odr void @_ZN6test154makeILi5EEE18__make_integer_seqISt16integer_sequenceiXT_EEv(
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue