[clang-tools-extra] [clangd] Resolve the dependent type from its single instantiation. Take 1 (PR #71279)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 4 04:24:34 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff cd6022916bff1d6fab007b554810b631549ba43c d73a8e2ee683e6812c21cb1de7363b14565a96d1 -- clang-tools-extra/clangd/HeuristicResolver.cpp clang-tools-extra/clangd/unittests/XRefsTests.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clangd/HeuristicResolver.cpp b/clang-tools-extra/clangd/HeuristicResolver.cpp
index d3dced9b3253..96b9afa7d8ea 100644
--- a/clang-tools-extra/clangd/HeuristicResolver.cpp
+++ b/clang-tools-extra/clangd/HeuristicResolver.cpp
@@ -56,7 +56,8 @@ const Type *resolveDeclsToType(const std::vector<const NamedDecl *> &Decls,
// dependent one. Its associated type will then be extracted.
struct InstantiatedDeclVisitor : RecursiveASTVisitor<InstantiatedDeclVisitor> {
- InstantiatedDeclVisitor(NamedDecl *DependentDecl) : DependentDecl(DependentDecl) {}
+ InstantiatedDeclVisitor(NamedDecl *DependentDecl)
+ : DependentDecl(DependentDecl) {}
bool shouldVisitTemplateInstantiations() const { return true; }
@@ -64,8 +65,7 @@ struct InstantiatedDeclVisitor : RecursiveASTVisitor<InstantiatedDeclVisitor> {
bool shouldVisitImplicitCode() const { return true; }
- template <typename D>
- bool onDeclVisited(D *MaybeInstantiated) {
+ template <typename D> bool onDeclVisited(D *MaybeInstantiated) {
if (MaybeInstantiated->getDeclContext()->isDependentContext())
return true;
auto *Dependent = dyn_cast<D>(DependentDecl);
@@ -82,13 +82,9 @@ struct InstantiatedDeclVisitor : RecursiveASTVisitor<InstantiatedDeclVisitor> {
return false;
}
- bool VisitFieldDecl(FieldDecl *FD) {
- return onDeclVisited(FD);
- }
+ bool VisitFieldDecl(FieldDecl *FD) { return onDeclVisited(FD); }
- bool VisitVarDecl(VarDecl *VD) {
- return onDeclVisited(VD);
- }
+ bool VisitVarDecl(VarDecl *VD) { return onDeclVisited(VD); }
NamedDecl *DependentDecl;
QualType DeducedType;
``````````
</details>
https://github.com/llvm/llvm-project/pull/71279
More information about the cfe-commits
mailing list