summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index/SymbolCollector.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-03-08 09:54:37 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-03-08 09:54:37 +0000
commit017cc6c190e2d22f23fba4c178934f6e4e03db0c (patch)
treedfcfc09dedfea1c3781786ac9f64b26d5880ddb6 /clang-tools-extra/clangd/index/SymbolCollector.cpp
parent7ec1ec10c97fd299169ecc2b8dca58a4f7959438 (diff)
downloadbcm5719-llvm-017cc6c190e2d22f23fba4c178934f6e4e03db0c.tar.gz
bcm5719-llvm-017cc6c190e2d22f23fba4c178934f6e4e03db0c.zip
[clangd] Make sure constructors do not reference class
Reviewers: gribozavr Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58815 llvm-svn: 355679
Diffstat (limited to 'clang-tools-extra/clangd/index/SymbolCollector.cpp')
-rw-r--r--clang-tools-extra/clangd/index/SymbolCollector.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/index/SymbolCollector.cpp b/clang-tools-extra/clangd/index/SymbolCollector.cpp
index 686b67b2dfb..7fae0795d17 100644
--- a/clang-tools-extra/clangd/index/SymbolCollector.cpp
+++ b/clang-tools-extra/clangd/index/SymbolCollector.cpp
@@ -211,7 +211,7 @@ getTokenLocation(SourceLocation TokLoc, const SourceManager &SM,
// the first seen declaration as canonical declaration is not a good enough
// heuristic.
bool isPreferredDeclaration(const NamedDecl &ND, index::SymbolRoleSet Roles) {
- const auto& SM = ND.getASTContext().getSourceManager();
+ const auto &SM = ND.getASTContext().getSourceManager();
return (Roles & static_cast<unsigned>(index::SymbolRole::Definition)) &&
isa<TagDecl>(&ND) &&
!SM.isWrittenInMainFile(SM.getExpansionLoc(ND.getLocation()));
@@ -305,6 +305,10 @@ bool SymbolCollector::handleDeclOccurence(
Decl::FriendObjectKind::FOK_None) &&
!(Roles & static_cast<unsigned>(index::SymbolRole::Definition)))
return true;
+ // Skip non-semantic references, we should start processing these when we
+ // decide to implement renaming with index support.
+ if ((Roles & static_cast<unsigned>(index::SymbolRole::NameReference)))
+ return true;
// A declaration created for a friend declaration should not be used as the
// canonical declaration in the index. Use OrigD instead, unless we've already
// picked a replacement for D
OpenPOWER on IntegriCloud