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
Please register or sign in to comment