Skip to content

Commit

Permalink
[v0.0.3] Another try to fix apple behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
DronCode committed Mar 20, 2024
1 parent 0811548 commit c1b41c6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion LLVM/source/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,20 @@ namespace rg3::llvm
clang::NamedDecl* parentDecl = nullptr;
if (pDeclContext->isNamespace())
{
#ifdef __APPLE__
bool bAllowed = true;

// v0.0.3 workaround: I hate macOS for this. __1 inside namespace is an awful practice. So, I'm fixing that by this shitty fix, sorry :(
// !!! Pls, fix me later !!!
if (auto* pNamespaceDecl = ::llvm::dyn_cast<clang::NamespaceDecl>(pDeclContext))
{
bAllowed = pNamespaceDecl->getNameAsString() != "__1";
}

parentDecl = bAllowed ? clang::NamespaceDecl::castFromDeclContext(pDeclContext) : nullptr;
#else
parentDecl = clang::NamespaceDecl::castFromDeclContext(pDeclContext);
#endif
}
else if (pDeclContext->isRecord())
{
Expand All @@ -184,6 +197,6 @@ namespace rg3::llvm
return parentName + "::" + pDecl->getNameAsString();
}

return pDecl->getNameAsString();;
return pDecl->getNameAsString();
}
}

0 comments on commit c1b41c6

Please sign in to comment.