Mercurial > hg > CbC > CbC_llvm
diff clang-tools-extra/clangd/FindTarget.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
line wrap: on
line diff
--- a/clang-tools-extra/clangd/FindTarget.cpp Wed Nov 09 17:47:54 2022 +0900 +++ b/clang-tools-extra/clangd/FindTarget.cpp Fri Aug 18 09:04:13 2023 +0900 @@ -288,7 +288,7 @@ for (const DesignatedInitExpr::Designator &D : llvm::reverse(DIE->designators())) if (D.isFieldDesignator()) { - Outer.add(D.getField(), Flags); + Outer.add(D.getFieldDecl(), Flags); // We don't know which designator was intended, we assume the outer. break; } @@ -347,6 +347,10 @@ void VisitCXXDeleteExpr(const CXXDeleteExpr *CDE) { Outer.add(CDE->getOperatorDelete(), Flags); } + void + VisitCXXRewrittenBinaryOperator(const CXXRewrittenBinaryOperator *RBO) { + Outer.add(RBO->getDecomposedForm().InnerBinOp, Flags); + } }; Visitor(*this, Flags).Visit(S); } @@ -704,8 +708,23 @@ {OCID->getClassInterface()}}); Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(), OCID->getCategoryNameLoc(), + /*IsDecl=*/false, + {OCID->getCategoryDecl()}}); + Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(), + OCID->getCategoryNameLoc(), /*IsDecl=*/true, - {OCID->getCategoryDecl()}}); + {OCID}}); + } + + void VisitObjCImplementationDecl(const ObjCImplementationDecl *OIMD) { + Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(), + OIMD->getLocation(), + /*IsDecl=*/false, + {OIMD->getClassInterface()}}); + Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(), + OIMD->getLocation(), + /*IsDecl=*/true, + {OIMD}}); } }; @@ -808,7 +827,7 @@ Refs.push_back(ReferenceLoc{NestedNameSpecifierLoc(), D.getFieldLoc(), /*IsDecl=*/false, - {D.getField()}}); + {D.getFieldDecl()}}); } } @@ -1044,6 +1063,17 @@ return RecursiveASTVisitor::TraverseConstructorInitializer(Init); } + bool TraverseTypeConstraint(const TypeConstraint *TC) { + // We want to handle all ConceptReferences but RAV is missing a + // polymorphic Visit or Traverse method for it, so we handle + // TypeConstraints specially here. + Out(ReferenceLoc{TC->getNestedNameSpecifierLoc(), + TC->getConceptNameLoc(), + /*IsDecl=*/false, + {TC->getNamedConcept()}}); + return RecursiveASTVisitor::TraverseTypeConstraint(TC); + } + private: /// Obtain information about a reference directly defined in \p N. Does not /// recurse into child nodes, e.g. do not expect references for constructor