Use type name as fallback ID for anon typedef'ed structs/unions etc.

Authored by mwolff on Sep 21 2019, 12:27 PM.

Description

Use type name as fallback ID for anon typedef'ed structs/unions etc.

The cursor pointing to the struct within typedef struct {...} foo;
has an empty cursor spelling, but its type spelling is set to foo.
This is ideal to disambiguate between different structs. Without that,
we would end up associating uses of different cursors to the first
declaration with an empty name. Now that we set a proper non-empty
name, we can correctly disambiguate and associate the uses correctly.

Sadly, clang_getCompletionParent is broken too for this case - it
doesn't return the typedef name :( We now work-around this limitation
by parsing the USR of the container which _does_ contain that info.
Very hacky but at least this makes it work for both, uses and code
completion! Also, we can get rid of the previous hack which tried to
match the type too, which is probably way more costly than this.

BUG: 409041

Details

Committed
mwolffSep 21 2019, 1:59 PM
Parents
R32:9a545cb9794b: Revert "Use type name as fallback ID for anon typedef'ed structs/unions etc."
Branches
Unknown
Tags
Unknown