[clang] [WIP][clang] Fix std::tm etc. mangling on Solaris (PR #106353)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 02:41:02 PDT 2024
================
@@ -6953,6 +6954,27 @@ bool CXXNameMangler::mangleStandardSubstitution(const NamedDecl *ND) {
return false;
}
+ if (getASTContext().getTargetInfo().getTriple().isOSSolaris()) {
+ if (const RecordDecl *RD = dyn_cast<RecordDecl>(ND)) {
+ if (!isStdNamespace(Context.getEffectiveDeclContext(RD)))
+ return false;
+
+ // Issue #33114: Need non-standard mangling of std::tm etc. for
+ // Solaris ABI compatibility.
+ static std::set<StringRef> types{"div_t", "ldiv_t", "lconv", "tm"};
+
+ // <substitution> ::= tm # ::std::tm, same for the others
+ if (const IdentifierInfo *II = RD->getIdentifier()) {
+ StringRef type = II->getName();
+ if (types.count(type)) {
----------------
cor3ntin wrote:
```suggestion
if (llvm::is_contained({"div_t", "ldiv_t", "lconv", "tm"}, type)) {
```
using a std::set is a bit overkill here
https://github.com/llvm/llvm-project/pull/106353
More information about the cfe-commits
mailing list