[clangd] Remove reundant use of getSpellingLoc()

getFileLoc() is guaranteed to return a file loc, and getSpellingLoc()
on a file loc is a no-op.

Differential Revision: https://reviews.llvm.org/D146377
This commit is contained in:
Nathan Ridge
2023-03-19 04:04:13 -04:00
parent 2d373e4dc7
commit 57bfe25574
2 changed files with 4 additions and 4 deletions

View File

@@ -223,8 +223,8 @@ std::string getSymbolDetail(ASTContext &Ctx, const NamedDecl &ND) {
std::optional<DocumentSymbol> declToSym(ASTContext &Ctx, const NamedDecl &ND) {
auto &SM = Ctx.getSourceManager();
SourceLocation BeginLoc = SM.getSpellingLoc(SM.getFileLoc(ND.getBeginLoc()));
SourceLocation EndLoc = SM.getSpellingLoc(SM.getFileLoc(ND.getEndLoc()));
SourceLocation BeginLoc = SM.getFileLoc(ND.getBeginLoc());
SourceLocation EndLoc = SM.getFileLoc(ND.getEndLoc());
const auto SymbolRange =
toHalfOpenFileRange(SM, Ctx.getLangOpts(), {BeginLoc, EndLoc});
if (!SymbolRange)

View File

@@ -1611,8 +1611,8 @@ declToHierarchyItem(const NamedDecl &ND, llvm::StringRef TUPath) {
ASTContext &Ctx = ND.getASTContext();
auto &SM = Ctx.getSourceManager();
SourceLocation NameLoc = nameLocation(ND, Ctx.getSourceManager());
SourceLocation BeginLoc = SM.getSpellingLoc(SM.getFileLoc(ND.getBeginLoc()));
SourceLocation EndLoc = SM.getSpellingLoc(SM.getFileLoc(ND.getEndLoc()));
SourceLocation BeginLoc = SM.getFileLoc(ND.getBeginLoc());
SourceLocation EndLoc = SM.getFileLoc(ND.getEndLoc());
const auto DeclRange =
toHalfOpenFileRange(SM, Ctx.getLangOpts(), {BeginLoc, EndLoc});
if (!DeclRange)