@@ -864,7 +864,7 @@ class ASTVisitor
864
864
865
865
std::unique_ptr<NameInfo>
866
866
buildNameInfo (
867
- const NamedDecl* ND ,
867
+ const Decl* D ,
868
868
ExtractMode extract_mode = ExtractMode::IndirectDependency);
869
869
870
870
@@ -3428,7 +3428,7 @@ class TypeInfoBuilder
3428
3428
if (NNS)
3429
3429
Name->Prefix = V.buildNameInfo (NNS);
3430
3430
else
3431
- Name->Prefix = V.buildNameInfo (D );
3431
+ Name->Prefix = V.buildNameInfo (V. getParentDecl (D) );
3432
3432
3433
3433
V.buildTemplateArgs (Name->TemplateArgs , *TArgs);
3434
3434
I->Name = std::move (Name);
@@ -3442,7 +3442,7 @@ class TypeInfoBuilder
3442
3442
if (NNS)
3443
3443
Name->Prefix = V.buildNameInfo (NNS);
3444
3444
else
3445
- Name->Prefix = V.buildNameInfo (D );
3445
+ Name->Prefix = V.buildNameInfo (V. getParentDecl (D) );
3446
3446
I->Name = std::move (Name);
3447
3447
}
3448
3448
*Inner = std::move (I);
@@ -3565,7 +3565,7 @@ class NameInfoBuilder
3565
3565
if (NNS)
3566
3566
Result->Prefix = V.buildNameInfo (NNS);
3567
3567
else
3568
- Result->Prefix = V.buildNameInfo (D );
3568
+ Result->Prefix = V.buildNameInfo (V. getParentDecl (D) );
3569
3569
}
3570
3570
};
3571
3571
@@ -3597,35 +3597,35 @@ buildNameInfo(
3597
3597
I = std::make_unique<NameInfo>();
3598
3598
I->Name = ND->getIdentifier ()->getName ();
3599
3599
getDependencyID (ND, I->id );
3600
- I->Prefix = buildNameInfo (ND , extract_mode);
3600
+ I->Prefix = buildNameInfo (getParentDecl (ND) , extract_mode);
3601
3601
}
3602
- else if (const NamespaceAliasDecl* ND = NNS->getAsNamespaceAlias ())
3602
+ else if (const NamespaceAliasDecl* NAD = NNS->getAsNamespaceAlias ())
3603
3603
{
3604
3604
I = std::make_unique<NameInfo>();
3605
- I->Name = ND->getIdentifier ()->getName ();
3606
- getDependencyID (ND->getNamespace (), I->id );
3607
- I->Prefix = buildNameInfo (ND->getNamespace (), extract_mode);
3605
+ I->Name = NAD->getIdentifier ()->getName ();
3606
+ const NamespaceDecl* ND = NAD->getNamespace ();
3607
+ // KRYSTIAN FIXME: this should use the SymbolID of the namespace alias
3608
+ // once we add an Info kind to represent them
3609
+ getDependencyID (ND, I->id );
3610
+ I->Prefix = buildNameInfo (getParentDecl (ND), extract_mode);
3608
3611
}
3609
3612
return I;
3610
3613
}
3611
3614
3612
3615
std::unique_ptr<NameInfo>
3613
3616
ASTVisitor::
3614
3617
buildNameInfo (
3615
- const NamedDecl* ND ,
3618
+ const Decl* D ,
3616
3619
ExtractMode extract_mode)
3617
3620
{
3618
- if (! ND)
3619
- return nullptr ;
3620
- const NamedDecl* PD = dyn_cast_if_present<
3621
- NamedDecl>(getParentDecl (ND));
3622
- if (! PD || PD->getKind () == Decl::TranslationUnit)
3621
+ const auto * ND = dyn_cast_if_present<NamedDecl>(D);
3622
+ if (! ND || ND->getKind () == Decl::TranslationUnit)
3623
3623
return nullptr ;
3624
3624
auto I = std::make_unique<NameInfo>();
3625
- if (const IdentifierInfo* II = PD ->getIdentifier ())
3625
+ if (const IdentifierInfo* II = ND ->getIdentifier ())
3626
3626
I->Name = II->getName ();
3627
- getDependencyID (getInstantiatedFrom (PD ), I->id );
3628
- I->Prefix = buildNameInfo (PD , extract_mode);
3627
+ getDependencyID (getInstantiatedFrom (D ), I->id );
3628
+ I->Prefix = buildNameInfo (getParentDecl (D) , extract_mode);
3629
3629
return I;
3630
3630
}
3631
3631
0 commit comments