@@ -67,7 +67,7 @@ ASTVisitor(
67
67
// ASTContext::setTraversalScope is being (erroneously)
68
68
// used somewhere
69
69
MRDOCS_ASSERT (context_.getTraversalScope () ==
70
- std::vector <Decl*>{context_.getTranslationUnitDecl ()});
70
+ ArrayRef <Decl *>{context_.getTranslationUnitDecl ()});
71
71
}
72
72
73
73
void
@@ -466,7 +466,7 @@ generateUSR(Decl const* D) const
466
466
if (auto * FD = dyn_cast<FunctionDecl>(Templated);
467
467
FD && FD->getTrailingRequiresClause ())
468
468
{
469
- Expr const * RC = FD->getTrailingRequiresClause ();
469
+ Expr const * RC = FD->getTrailingRequiresClause (). ConstraintExpr ;
470
470
RC = SubstituteConstraintExpressionWithoutSatisfaction (
471
471
sema_, cast<NamedDecl>(Described ? Described : Templated), RC);
472
472
if (!RC)
@@ -897,7 +897,7 @@ populate(
897
897
MRDOCS_SYMBOL_TRACE (RT, context_);
898
898
I.ReturnType = toTypeInfo (RT);
899
899
900
- if (auto * TRC = D->getTrailingRequiresClause ())
900
+ if (auto * TRC = D->getTrailingRequiresClause (). ConstraintExpr )
901
901
{
902
902
populate (I.Requires , TRC);
903
903
}
@@ -1214,7 +1214,7 @@ populate(
1214
1214
NamespaceAliasDecl const * D)
1215
1215
{
1216
1216
NamedDecl const * Aliased = D->getAliasedNamespace ();
1217
- NestedNameSpecifier const * NNS = D->getQualifier ();
1217
+ NestedNameSpecifier NNS = D->getQualifier ();
1218
1218
I.AliasedSymbol = toNameInfo (Aliased, {}, NNS);
1219
1219
}
1220
1220
@@ -1478,7 +1478,7 @@ populate(
1478
1478
}
1479
1479
if (TypeConstraint const * TC = P->getTypeConstraint ())
1480
1480
{
1481
- NestedNameSpecifier const * NNS =
1481
+ NestedNameSpecifier NNS =
1482
1482
TC->getNestedNameSpecifierLoc ().getNestedNameSpecifier ();
1483
1483
std::optional<ASTTemplateArgumentListInfo const *> TArgs;
1484
1484
if (TC->hasExplicitTemplateArgs ())
@@ -2009,63 +2009,45 @@ toTypeInfo(QualType const qt, TraversalMode const mode)
2009
2009
return Builder.result ();
2010
2010
}
2011
2011
2012
- Polymorphic<NameInfo>
2013
- ASTVisitor::
2014
- toNameInfo (
2015
- NestedNameSpecifier const * NNS)
2012
+ Polymorphic<NameInfo> ASTVisitor::toNameInfo (NestedNameSpecifier NNS)
2016
2013
{
2017
- if (!NNS)
2018
- {
2019
- return std::nullopt ;
2020
- }
2021
2014
MRDOCS_SYMBOL_TRACE (NNS, context_);
2022
-
2023
2015
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 );
2028
2022
Builder.Visit (T);
2029
- I = Builder.result ();
2023
+ return Builder.result ();
2030
2024
}
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 ();
2040
2028
I->Name = ND->getIdentifier ()->getName ();
2041
- I->Prefix = toNameInfo (NNS-> getPrefix () );
2029
+ I->Prefix = toNameInfo (Prefix );
2042
2030
Decl const * ID = getInstantiatedFrom (ND);
2043
2031
if (Info* info = findOrTraverse (const_cast <Decl*>(ID)))
2044
2032
{
2045
2033
I->id = info->id ;
2046
2034
}
2035
+ return I;
2047
2036
}
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 ;
2058
2041
}
2059
- return I ;
2042
+ MRDOCS_UNREACHABLE () ;
2060
2043
}
2061
2044
2062
2045
template <class TArgRange >
2063
2046
Polymorphic<NameInfo>
2064
2047
ASTVisitor::
2065
- toNameInfo (
2066
- DeclarationName const Name,
2048
+ toNameInfo (DeclarationName const Name,
2067
2049
std::optional<TArgRange> TArgs,
2068
- NestedNameSpecifier const * NNS)
2050
+ NestedNameSpecifier NNS)
2069
2051
{
2070
2052
if (Name.isEmpty ())
2071
2053
{
@@ -2082,10 +2064,7 @@ toNameInfo(
2082
2064
I = Polymorphic<NameInfo>();
2083
2065
}
2084
2066
I->Name = extractName (Name);
2085
- if (NNS)
2086
- {
2087
- I->Prefix = toNameInfo (NNS);
2088
- }
2067
+ I->Prefix = toNameInfo (NNS);
2089
2068
return I;
2090
2069
}
2091
2070
@@ -2095,7 +2074,7 @@ ASTVisitor::
2095
2074
toNameInfo (
2096
2075
Decl const * D,
2097
2076
std::optional<TArgRange> TArgs,
2098
- NestedNameSpecifier const * NNS)
2077
+ NestedNameSpecifier NNS)
2099
2078
{
2100
2079
auto const * ND = dyn_cast_if_present<NamedDecl>(D);
2101
2080
if (!ND)
@@ -2123,7 +2102,7 @@ ASTVisitor::
2123
2102
toNameInfo<llvm::ArrayRef<clang::TemplateArgument>>(
2124
2103
Decl const * D,
2125
2104
std::optional<llvm::ArrayRef<clang::TemplateArgument>> TArgs,
2126
- NestedNameSpecifier const * NNS);
2105
+ NestedNameSpecifier NNS);
2127
2106
2128
2107
Polymorphic<TArg>
2129
2108
ASTVisitor::
@@ -2659,12 +2638,6 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co
2659
2638
MRDOCS_SYMBOL_TRACE (T, context_);
2660
2639
MRDOCS_ASSERT (!T.isNull ());
2661
2640
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
-
2668
2641
// If the type is a dependent name type and dependent names are allowed,
2669
2642
// extract the identifier and the qualifier's type
2670
2643
SFINAETemplateInfo SFINAE;
@@ -2673,7 +2646,7 @@ ASTVisitor::getSFINAETemplateInfo(QualType T, bool const AllowDependentNames) co
2673
2646
{
2674
2647
SFINAE.Member = DNT->getIdentifier ();
2675
2648
MRDOCS_SYMBOL_TRACE (SFINAE.Member , context_);
2676
- T = QualType (DNT->getQualifier ()-> getAsType (), 0 );
2649
+ T = QualType (DNT->getQualifier (). getAsType (), 0 );
2677
2650
MRDOCS_SYMBOL_TRACE (T, context_);
2678
2651
}
2679
2652
if (!T.getTypePtrOrNull ())
0 commit comments