Skip to content

Commit 4cd79a3

Browse files
committed
fix: getParent supports transparent namespaces
1 parent a0f694d commit 4cd79a3

10 files changed

+2113
-737
lines changed

src/lib/AST/ClangHelpers.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ getParent(Decl const* D)
225225
case Decl::CXXRecord:
226226
// we treat anonymous unions as "transparent"
227227
if (auto const* RD = cast<CXXRecordDecl>(D);
228+
RD &&
228229
RD->isAnonymousStructOrUnion())
229230
{
230231
break;
@@ -235,6 +236,14 @@ getParent(Decl const* D)
235236
case Decl::Enum:
236237
case Decl::ClassTemplateSpecialization:
237238
case Decl::ClassTemplatePartialSpecialization:
239+
// we treat anonymous namespaces as "transparent"
240+
if (auto const* ND = dyn_cast<NamespaceDecl>(D);
241+
ND &&
242+
(ND->isInlineNamespace() ||
243+
ND->isAnonymousNamespace()))
244+
{
245+
break;
246+
}
238247
return D;
239248
// we consider all other DeclContexts to be "transparent"
240249
default:

0 commit comments

Comments
 (0)