summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/Quality.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clangd/Quality.cpp')
-rw-r--r--clang-tools-extra/clangd/Quality.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang-tools-extra/clangd/Quality.cpp b/clang-tools-extra/clangd/Quality.cpp
index 6ab05293274..bd25256904c 100644
--- a/clang-tools-extra/clangd/Quality.cpp
+++ b/clang-tools-extra/clangd/Quality.cpp
@@ -9,6 +9,7 @@
#include "Quality.h"
#include "AST.h"
#include "FileDistance.h"
+#include "SourceCode.h"
#include "URI.h"
#include "index/Symbol.h"
#include "clang/AST/ASTContext.h"
@@ -42,8 +43,7 @@ static bool isReserved(llvm::StringRef Name) {
static bool hasDeclInMainFile(const Decl &D) {
auto &SourceMgr = D.getASTContext().getSourceManager();
for (auto *Redecl : D.redecls()) {
- auto Loc = SourceMgr.getSpellingLoc(Redecl->getLocation());
- if (SourceMgr.isWrittenInMainFile(Loc))
+ if (isInsideMainFile(Redecl->getLocation(), SourceMgr))
return true;
}
return false;
@@ -53,8 +53,7 @@ static bool hasUsingDeclInMainFile(const CodeCompletionResult &R) {
const auto &Context = R.Declaration->getASTContext();
const auto &SourceMgr = Context.getSourceManager();
if (R.ShadowDecl) {
- const auto Loc = SourceMgr.getExpansionLoc(R.ShadowDecl->getLocation());
- if (SourceMgr.isWrittenInMainFile(Loc))
+ if (isInsideMainFile(R.ShadowDecl->getLocation(), SourceMgr))
return true;
}
return false;
OpenPOWER on IntegriCloud