File tree Expand file tree Collapse file tree 4 files changed +7
-47
lines changed Expand file tree Collapse file tree 4 files changed +7
-47
lines changed Original file line number Diff line number Diff line change @@ -1040,16 +1040,11 @@ class ExplicitReferenceCollector
10401040 if (auto *S = N.get <Stmt>())
10411041 return refInStmt (S, Resolver);
10421042 if (auto *NNSL = N.get <NestedNameSpecifierLoc>()) {
1043+ if (auto TL = NNSL->getAsTypeLoc ())
1044+ return refInTypeLoc (NNSL->getAsTypeLoc (), Resolver);
10431045 // (!) 'DeclRelation::Alias' ensures we do not lose namespace aliases.
1044- NestedNameSpecifierLoc Qualifier;
1045- SourceLocation NameLoc;
1046- if (auto TL = NNSL->getAsTypeLoc ()) {
1047- Qualifier = TL.getPrefix ();
1048- NameLoc = TL.getNonPrefixBeginLoc ();
1049- } else {
1050- Qualifier = NNSL->getAsNamespaceAndPrefix ().Prefix ;
1051- NameLoc = NNSL->getLocalBeginLoc ();
1052- }
1046+ NestedNameSpecifierLoc Qualifier = NNSL->getAsNamespaceAndPrefix ().Prefix ;
1047+ SourceLocation NameLoc = NNSL->getLocalBeginLoc ();
10531048 return {
10541049 ReferenceLoc{Qualifier, NameLoc, false ,
10551050 explicitReferenceTargets (
Original file line number Diff line number Diff line change @@ -361,6 +361,9 @@ class NestedNameSpecifierLoc {
361361 // / Retrieve the source range covering just the last part of
362362 // / this nested-name-specifier, not including the prefix.
363363 // /
364+ // / Note that this is the source range of this NestedNameSpecifier chunk,
365+ // and for a type this includes the prefix of that type.
366+ // /
364367 // / For example, if this instance refers to a nested-name-specifier
365368 // / \c \::std::vector<int>::, the returned source range would cover
366369 // / from "vector" to the last '::'.
Original file line number Diff line number Diff line change @@ -198,11 +198,6 @@ class TypeLoc {
198198 // / "foo::bar". Returns null if this type represents an unqualified-id.
199199 NestedNameSpecifierLoc getPrefix () const ;
200200
201- // / This returns the position of the type after any elaboration, such as the
202- // / 'struct' keyword, and name qualifiers. This will the 'template' keyword if
203- // / present, or the name location otherwise.
204- SourceLocation getNonPrefixBeginLoc () const ;
205-
206201 // / This returns the position of the type after any elaboration, such as the
207202 // / 'struct' keyword. This may be the position of the name qualifiers,
208203 // / 'template' keyword, or the name location otherwise.
Original file line number Diff line number Diff line change @@ -494,39 +494,6 @@ NestedNameSpecifierLoc TypeLoc::getPrefix() const {
494494 }
495495}
496496
497- SourceLocation TypeLoc::getNonPrefixBeginLoc () const {
498- switch (getTypeLocClass ()) {
499- case TypeLoc::TemplateSpecialization: {
500- auto TL = castAs<TemplateSpecializationTypeLoc>();
501- SourceLocation Loc = TL.getTemplateKeywordLoc ();
502- if (!Loc.isValid ())
503- Loc = TL.getTemplateNameLoc ();
504- return Loc;
505- }
506- case TypeLoc::DeducedTemplateSpecialization: {
507- auto TL = castAs<DeducedTemplateSpecializationTypeLoc>();
508- SourceLocation Loc = TL.getTemplateKeywordLoc ();
509- if (!Loc.isValid ())
510- Loc = TL.getTemplateNameLoc ();
511- return Loc;
512- }
513- case TypeLoc::DependentName:
514- return castAs<DependentNameTypeLoc>().getNameLoc ();
515- case TypeLoc::Enum:
516- case TypeLoc::Record:
517- case TypeLoc::InjectedClassName:
518- return castAs<TagTypeLoc>().getNameLoc ();
519- case TypeLoc::Typedef:
520- return castAs<TypedefTypeLoc>().getNameLoc ();
521- case TypeLoc::UnresolvedUsing:
522- return castAs<UnresolvedUsingTypeLoc>().getNameLoc ();
523- case TypeLoc::Using:
524- return castAs<UsingTypeLoc>().getNameLoc ();
525- default :
526- return getBeginLoc ();
527- }
528- }
529-
530497SourceLocation TypeLoc::getNonElaboratedBeginLoc () const {
531498 // For elaborated types (e.g. `struct a::A`) we want the portion after the
532499 // `struct` but including the namespace qualifier, `a::`.
You can’t perform that action at this time.
0 commit comments