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 c1b41c6 commit a35a482
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions LLVM/source/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,21 @@ namespace rg3::llvm

if (!pDeclContext->isNamespace() && !pDeclContext->isRecord()) {
// We aren't namespace or record (struct, class)
#ifdef __APPLE__
// v0.0.3 workaround: will fix later
if (pDecl->getNameAsString() == "__1")
{
return {};
}
#endif

return pDecl->getNameAsString();
}

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 @@ -194,6 +189,14 @@ namespace rg3::llvm

if (!parentName.empty())
{
#ifdef __APPLE__
// v0.0.3 workaround: will fix later
if (pDecl->getNameAsString() == "__1")
{
return parentName;
}
#endif

return parentName + "::" + pDecl->getNameAsString();
}

Expand Down

0 comments on commit a35a482

Please sign in to comment.