mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
[indexer] Treat empty short_name as implicit call which should not be included in all_symbols
std::vector<int> a = f(); // besides f, there is an implicit move constructor vector(vector<T>&&) We expect finding references on `f` takes us to `f`, not to `vector(vector<T>&&)`
This commit is contained in:
parent
1dfa88ed1c
commit
ee78b527ae
@ -1478,12 +1478,16 @@ void OnIndexReference(CXClientData client_data, const CXIdxEntityRefInfo* ref) {
|
|||||||
// or implicit), but libclang only supports implicit for objective-c.
|
// or implicit), but libclang only supports implicit for objective-c.
|
||||||
bool is_implicit =
|
bool is_implicit =
|
||||||
CanBeCalledImplicitly(ref->referencedEntity->kind) &&
|
CanBeCalledImplicitly(ref->referencedEntity->kind) &&
|
||||||
// For explicit destructor call, ref->cursor may be "~" while called->def.short_name is "~A"
|
// Treats empty short_name as an implicit call like implicit move
|
||||||
// "~A" is not a substring of ref->cursor, but we should take this case as not `is_implicit`.
|
// constructor in `vector<int> a = f();`
|
||||||
called->def.short_name.size() && called->def.short_name[0] != '~' &&
|
(called->def.short_name.empty() ||
|
||||||
|
// For explicit destructor call, ref->cursor may be "~" while
|
||||||
|
// called->def.short_name is "~A"
|
||||||
|
// "~A" is not a substring of ref->cursor, but we should take this
|
||||||
|
// case as not `is_implicit`.
|
||||||
|
(called->def.short_name[0] != '~' &&
|
||||||
!CursorSpellingContainsString(ref->cursor, param->tu->cx_tu,
|
!CursorSpellingContainsString(ref->cursor, param->tu->cx_tu,
|
||||||
called->def.short_name);
|
called->def.short_name)));
|
||||||
|
|
||||||
if (IsFunctionCallContext(ref->container->cursor.kind)) {
|
if (IsFunctionCallContext(ref->container->cursor.kind)) {
|
||||||
IndexFuncId caller_id = db->ToFuncId(ref->container->cursor);
|
IndexFuncId caller_id = db->ToFuncId(ref->container->cursor);
|
||||||
|
Loading…
Reference in New Issue
Block a user