Skip to content

Commit f5e834a

Browse files
cleanup: Replace saveOccurrence -> saveReference (#144)
1 parent 5796298 commit f5e834a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

indexer/Indexer.cc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -404,14 +404,12 @@ void TuIndexer::saveNestedNameSpecifierLoc(
404404

405405
auto tryEmit = [this](clang::NestedNameSpecifierLoc nameSpecLoc,
406406
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());
410412
}
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());
415413
};
416414

417415
while (nameSpecLoc.hasQualifier()) {
@@ -628,7 +626,7 @@ void TuIndexer::saveDeclRefExpr(const clang::DeclRefExpr &declRefExpr) {
628626
// ^ getLocation()
629627
// ^^^^^^ getSourceRange()
630628
// ^ getExprLoc()
631-
this->saveOccurrence(optSymbol.value(), declRefExpr.getLocation());
629+
this->saveReference(optSymbol.value(), declRefExpr.getLocation());
632630
// ^ TODO: Add read-write access to the symbol role here
633631
}
634632

0 commit comments

Comments
 (0)