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.
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.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits