@@ -67,7 +67,7 @@ ASTVisitor(
6767 // ASTContext::setTraversalScope is being (erroneously)
6868 // used somewhere
6969 MRDOCS_ASSERT (context_.getTraversalScope () ==
70- std::vector <Decl*>{context_.getTranslationUnitDecl ()});
70+ ArrayRef <Decl *>{context_.getTranslationUnitDecl ()});
7171}
7272
7373void
@@ -466,7 +466,7 @@ generateUSR(Decl const* D) const
466466 if (auto * FD = dyn_cast<FunctionDecl>(Templated);
467467 FD && FD->getTrailingRequiresClause ())
468468 {
469- Expr const * RC = FD->getTrailingRequiresClause ();
469+ Expr const * RC = FD->getTrailingRequiresClause (). ConstraintExpr ;
470470 RC = SubstituteConstraintExpressionWithoutSatisfaction (
471471 sema_, cast<NamedDecl>(Described ? Described : Templated), RC);
472472 if (!RC)
@@ -897,7 +897,7 @@ populate(
897897 MRDOCS_SYMBOL_TRACE (RT, context_);
898898 I.ReturnType = toTypeInfo (RT);
899899
900- if (auto * TRC = D->getTrailingRequiresClause ())
900+ if (auto * TRC = D->getTrailingRequiresClause (). ConstraintExpr )
901901 {
902902 populate (I.Requires , TRC);
903903 }
@@ -1214,7 +1214,7 @@ populate(
12141214 NamespaceAliasDecl const * D)
12151215{
12161216 NamedDecl const * Aliased = D->getAliasedNamespace ();
1217- NestedNameSpecifier const * NNS = D->getQualifier ();
1217+ NestedNameSpecifier NNS = D->getQualifier ();
12181218 I.AliasedSymbol = toNameInfo (Aliased, {}, NNS);
12191219}
12201220
@@ -1478,7 +1478,7 @@ populate(
14781478 }
14791479 if (TypeConstraint const * TC = P->getTypeConstraint ())
14801480 {
1481- NestedNameSpecifier const * NNS =
1481+ NestedNameSpecifier NNS =
14821482 TC->getNestedNameSpecifierLoc ().getNestedNameSpecifier ();
14831483 std::optional<ASTTemplateArgumentListInfo const *> TArgs;
14841484 if (TC->hasExplicitTemplateArgs ())
@@ -2009,63 +2009,45 @@ toTypeInfo(QualType const qt, TraversalMode const mode)
20092009 return Builder.result ();
20102010}
20112011
2012- Polymorphic<NameInfo>
2013- ASTVisitor::
2014- toNameInfo (
2015- NestedNameSpecifier const * NNS)
2012+ Polymorphic<NameInfo> ASTVisitor::toNameInfo (NestedNameSpecifier NNS)
20162013{
2017- if (!NNS)
2018- {
2019- return std::nullopt ;
2020- }
20212014 MRDOCS_SYMBOL_TRACE (NNS, context_);
2022-
20232015 ScopeExitRestore scope (mode_, Dependency);
2024- Polymorphic<NameInfo> I = std::nullopt ;
2025- if (Type const * T = NNS->getAsType ())
2026- {
2027- NameInfoBuilder Builder (*this , NNS->getPrefix ());
2016+ switch (NNS.getKind ()) {
2017+ case NestedNameSpecifier::Kind::Null:
2018+ return std::nullopt ;
2019+ case NestedNameSpecifier::Kind::Type: {
2020+ const Type *T = NNS.getAsType ();
2021+ NameInfoBuilder Builder (*this );
20282022 Builder.Visit (T);
2029- I = Builder.result ();
2023+ return Builder.result ();
20302024 }
2031- else if (IdentifierInfo const * II = NNS->getAsIdentifier ())
2032- {
2033- I = Polymorphic<NameInfo>();
2034- I->Name = II->getName ();
2035- I->Prefix = toNameInfo (NNS->getPrefix ());
2036- }
2037- else if (NamespaceDecl const * ND = NNS->getAsNamespace ())
2038- {
2039- I = Polymorphic<NameInfo>();
2025+ case NestedNameSpecifier::Kind::Namespace: {
2026+ auto I = Polymorphic<NameInfo>();
2027+ auto [ND, Prefix] = NNS.getAsNamespaceAndPrefix ();
20402028 I->Name = ND->getIdentifier ()->getName ();
2041- I->Prefix = toNameInfo (NNS-> getPrefix () );
2029+ I->Prefix = toNameInfo (Prefix );
20422030 Decl const * ID = getInstantiatedFrom (ND);
20432031 if (Info* info = findOrTraverse (const_cast <Decl*>(ID)))
20442032 {
20452033 I->id = info->id ;
20462034 }
2035+ return I;
20472036 }
2048- else if (NamespaceAliasDecl const * NAD = NNS->getAsNamespaceAlias ())
2049- {
2050- I = Polymorphic<NameInfo>();
2051- I->Name = NAD->getIdentifier ()->getName ();
2052- I->Prefix = toNameInfo (NNS->getPrefix ());
2053- Decl const * ID = getInstantiatedFrom (NAD);
2054- if (Info* info = findOrTraverse (const_cast <Decl*>(ID)))
2055- {
2056- I->id = info->id ;
2057- }
2037+ case NestedNameSpecifier::Kind::Global:
2038+ case NestedNameSpecifier::Kind::MicrosoftSuper:
2039+ // FIXME: Unimplemented.
2040+ return std::nullopt ;
20582041 }
2059- return I ;
2042+ MRDOCS_UNREACHABLE () ;
20602043}
20612044
20622045template <class TArgRange >
20632046Polymorphic<NameInfo>
20642047ASTVisitor::
2065- toNameInfo (
2066- DeclarationName const Name,
2048+ toNameInfo (DeclarationName const Name,
20672049 std::optional<TArgRange> TArgs,
2068- NestedNameSpecifier const * NNS)
2050+ NestedNameSpecifier NNS)
20692051{
20702052 if (Name.isEmpty ())
20712053 {
@@ -2082,10 +2064,7 @@ toNameInfo(
20822064 I = Polymorphic<NameInfo>();
20832065 }
20842066 I->Name = extractName (Name);
2085- if (NNS)
2086- {
2087- I->Prefix = toNameInfo (NNS);
2088- }
2067+ I->Prefix = toNameInfo (NNS);
20892068 return I;
20902069}
20912070
@@ -2095,7 +2074,7 @@ ASTVisitor::
20952074toNameInfo (
20962075 Decl const * D,
20972076 std::optional<TArgRange> TArgs,
2098- NestedNameSpecifier const * NNS)
2077+ NestedNameSpecifier NNS)
20992078{
21002079 auto const * ND = dyn_cast_if_present<NamedDecl>(D);
21012080 if (!ND)
@@ -2123,7 +2102,7 @@ ASTVisitor::
21232102toNameInfo<llvm::ArrayRef<clang::TemplateArgument>>(
21242103 Decl const * D,
21252104 std::optional<llvm::ArrayRef<clang::TemplateArgument>> TArgs,
2126- NestedNameSpecifier const * NNS);
2105+ NestedNameSpecifier NNS);
21272106
21282107Polymorphic<TArg>
21292108ASTVisitor::
@@ -2659,12 +2638,6 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co
26592638 MRDOCS_SYMBOL_TRACE (T, context_);
26602639 MRDOCS_ASSERT (!T.isNull ());
26612640
2662- // If the type is an elaborated type, get the named type
2663- if (auto * ET = T->getAs <ElaboratedType>())
2664- {
2665- T = ET->getNamedType ();
2666- }
2667-
26682641 // If the type is a dependent name type and dependent names are allowed,
26692642 // extract the identifier and the qualifier's type
26702643 SFINAETemplateInfo SFINAE;
@@ -2673,7 +2646,7 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co
26732646 {
26742647 SFINAE.Member = DNT->getIdentifier ();
26752648 MRDOCS_SYMBOL_TRACE (SFINAE.Member , context_);
2676- T = QualType (DNT->getQualifier ()-> getAsType (), 0 );
2649+ T = QualType (DNT->getQualifier (). getAsType (), 0 );
26772650 MRDOCS_SYMBOL_TRACE (T, context_);
26782651 }
26792652 if (!T.getTypePtrOrNull ())
0 commit comments