[c++20][clangd] Simplify code using the new ConceptReference
nodes.
Directly traverse `ConceptReference`s in FindTarget.cpp. There is no need for the extra logic for `AutoTypeLoc`s in SemanticHightlighting.cpp as the concept information is stored in a `ConceptReference` which is now traversed. Differential Revision: https://reviews.llvm.org/D159268
This commit is contained in:
parent
34a35a8b24
commit
c39dcd2c2b
@ -742,13 +742,6 @@ llvm::SmallVector<ReferenceLoc> refInStmt(const Stmt *S,
|
|||||||
// FIXME: handle more complicated cases: more ObjC, designated initializers.
|
// FIXME: handle more complicated cases: more ObjC, designated initializers.
|
||||||
llvm::SmallVector<ReferenceLoc> Refs;
|
llvm::SmallVector<ReferenceLoc> Refs;
|
||||||
|
|
||||||
void VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E) {
|
|
||||||
Refs.push_back(ReferenceLoc{E->getNestedNameSpecifierLoc(),
|
|
||||||
E->getConceptNameLoc(),
|
|
||||||
/*IsDecl=*/false,
|
|
||||||
{E->getNamedConcept()}});
|
|
||||||
}
|
|
||||||
|
|
||||||
void VisitDeclRefExpr(const DeclRefExpr *E) {
|
void VisitDeclRefExpr(const DeclRefExpr *E) {
|
||||||
Refs.push_back(ReferenceLoc{E->getQualifierLoc(),
|
Refs.push_back(ReferenceLoc{E->getQualifierLoc(),
|
||||||
E->getNameInfo().getLoc(),
|
E->getNameInfo().getLoc(),
|
||||||
@ -1063,15 +1056,12 @@ public:
|
|||||||
return RecursiveASTVisitor::TraverseConstructorInitializer(Init);
|
return RecursiveASTVisitor::TraverseConstructorInitializer(Init);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TraverseTypeConstraint(const TypeConstraint *TC) {
|
bool VisitConceptReference(ConceptReference *ConceptRef) {
|
||||||
// We want to handle all ConceptReferences but RAV is missing a
|
Out(ReferenceLoc{ConceptRef->getNestedNameSpecifierLoc(),
|
||||||
// polymorphic Visit or Traverse method for it, so we handle
|
ConceptRef->getConceptNameLoc(),
|
||||||
// TypeConstraints specially here.
|
|
||||||
Out(ReferenceLoc{TC->getNestedNameSpecifierLoc(),
|
|
||||||
TC->getConceptNameLoc(),
|
|
||||||
/*IsDecl=*/false,
|
/*IsDecl=*/false,
|
||||||
{TC->getNamedConcept()}});
|
{ConceptRef->getNamedConcept()}});
|
||||||
return RecursiveASTVisitor::TraverseTypeConstraint(TC);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -736,14 +736,6 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisitAutoTypeLoc(AutoTypeLoc L) {
|
|
||||||
if (L.isConstrained()) {
|
|
||||||
H.addAngleBracketTokens(L.getLAngleLoc(), L.getRAngleLoc());
|
|
||||||
H.addToken(L.getConceptNameInfo().getLoc(), HighlightingKind::Concept);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VisitFunctionDecl(FunctionDecl *D) {
|
bool VisitFunctionDecl(FunctionDecl *D) {
|
||||||
if (D->isOverloadedOperator()) {
|
if (D->isOverloadedOperator()) {
|
||||||
const auto AddOpDeclToken = [&](SourceLocation Loc) {
|
const auto AddOpDeclToken = [&](SourceLocation Loc) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user