mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 03:56:16 +08:00
[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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user