[clang] [WIP][clang] Fix std::tm etc. mangling on Solaris (PR #106353)

Rainer Orth via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 02:54:26 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)) {
----------------
rorth wrote:

Will do: I'm pretty ignorant of C++ actually...

https://github.com/llvm/llvm-project/pull/106353


More information about the cfe-commits mailing list