[PATCH] D125925: Add an option to fill container for ref
Utkarsh Saxena via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 18 13:12:58 PDT 2022
usaxena95 created this revision.
usaxena95 added a reviewer: kadircet.
Herald added a subscriber: arphaman.
Herald added a project: All.
usaxena95 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
This allows index implementations to fill container details when required specially when computing containerID is expensive.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D125925
Files:
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/index/Index.h
Index: clang-tools-extra/clangd/index/Index.h
===================================================================
--- clang-tools-extra/clangd/index/Index.h
+++ clang-tools-extra/clangd/index/Index.h
@@ -72,6 +72,8 @@
/// choose to return less than this, e.g. it tries to avoid returning stale
/// results.
llvm::Optional<uint32_t> Limit;
+ /// If set, populates the SymbolID for the container of the reference.
+ bool WantContainer;
};
struct RelationsRequest {
Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -2112,6 +2112,7 @@
// FIXME: Consider also using AST information when feasible.
RefsRequest Request;
Request.IDs.insert(*ID);
+ Request.WantContainer = true;
// We could restrict more specifically to calls by introducing a new RefKind,
// but non-call references (such as address-of-function) can still be
// interesting as they can indicate indirect calls.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125925.430487.patch
Type: text/x-patch
Size: 1046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220518/bdb319c4/attachment.bin>
More information about the cfe-commits
mailing list