@@ -404,14 +404,12 @@ void TuIndexer::saveNestedNameSpecifierLoc(
404
404
405
405
auto tryEmit = [this ](clang::NestedNameSpecifierLoc nameSpecLoc,
406
406
const clang::NamedDecl &namedDecl) {
407
- auto optSymbol = this ->symbolFormatter .getNamedDeclSymbol (namedDecl);
408
- if (!optSymbol.has_value ()) {
409
- return ;
407
+ if (auto optSymbol = this ->symbolFormatter .getNamedDeclSymbol (namedDecl)) {
408
+ // Don't use nameSpecLoc.getLocalSourceRange() as that may give
409
+ // two MacroID SourceLocations, in case the NestedNameSpecifier
410
+ // arises from a macro expansion.
411
+ this ->saveReference (*optSymbol, nameSpecLoc.getLocalBeginLoc ());
410
412
}
411
- // Don't use nameSpecLoc.getLocalSourceRange() as that may give
412
- // two MacroID SourceLocations, in case the NestedNameSpecifier
413
- // arises from a macro expansion.
414
- this ->saveOccurrence (optSymbol.value (), nameSpecLoc.getLocalBeginLoc ());
415
413
};
416
414
417
415
while (nameSpecLoc.hasQualifier ()) {
@@ -628,7 +626,7 @@ void TuIndexer::saveDeclRefExpr(const clang::DeclRefExpr &declRefExpr) {
628
626
// ^ getLocation()
629
627
// ^^^^^^ getSourceRange()
630
628
// ^ getExprLoc()
631
- this ->saveOccurrence (optSymbol.value (), declRefExpr.getLocation ());
629
+ this ->saveReference (optSymbol.value (), declRefExpr.getLocation ());
632
630
// ^ TODO: Add read-write access to the symbol role here
633
631
}
634
632
0 commit comments