[clangd] Collect references in array designators (#140356)
This commit is contained in:
committed by
GitHub
parent
ec21b0fc9f
commit
ca5040990e
@@ -2311,6 +2311,14 @@ TEST(FindReferences, WithinAST) {
|
||||
$(S::deleteObject)[[de^lete]] S;
|
||||
}
|
||||
};
|
||||
)cpp",
|
||||
// Array designators
|
||||
R"cpp(
|
||||
const int $def[[F^oo]] = 0;
|
||||
int Bar[] = {
|
||||
[$(Bar)[[F^oo]]...$(Bar)[[Fo^o]] + 1] = 0,
|
||||
[$(Bar)[[^Foo]] + 2] = 1
|
||||
};
|
||||
)cpp"};
|
||||
for (const char *Test : Tests)
|
||||
checkFindRefs(Test);
|
||||
|
||||
@@ -435,6 +435,13 @@ public:
|
||||
ParentDC, SymbolRoleSet(),
|
||||
/*Relations=*/{}, E);
|
||||
}
|
||||
} else {
|
||||
if (D.isArrayDesignator())
|
||||
TraverseStmt(E->getArrayIndex(D));
|
||||
else if (D.isArrayRangeDesignator()) {
|
||||
TraverseStmt(E->getArrayRangeStart(D));
|
||||
TraverseStmt(E->getArrayRangeEnd(D));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user