Fix renaming tag type containing anonymous type
commitb8754a7a32e2972761e07ebb191db44ab01ec6bb
authorJiří Techet <techet@gmail.com>
Thu, 1 Sep 2022 21:05:29 +0000 (1 23:05 +0200)
committerJiří Techet <techet@gmail.com>
Thu, 1 Sep 2022 21:05:29 +0000 (1 23:05 +0200)
treeb805653e7490cf412c77eb8932eea62a02b85f87
parent5cdfe35cf26ca6935eddc652cceb799e0cbad142
Fix renaming tag type containing anonymous type

The current code assumes that the whole var_type string consists of the
anonymous type name. This works for simple cases like

struct {} X;

where X is of the type __anonXXXX but not for cases like

struct {} X[2];

where X is of type __anonXXXX[].

For these cases checking for equality of var_tag->var_type, orig_name isn't
sufficient and we have to check whether orig_name is a substring
of var_tag->var_type and replace this substring with the new anon name.

This problem can be seen for instance in the symbol tree tooltip of
the symbols_icons variable inside symbols.c
src/tagmanager/tm_ctags.c