There are several problems with how we handle anonymous tags which this pull request tries to resolve:

  1. Anonymous tags are currently determined based on how these tags are named by ctags which may not be completely reliable and unnecessary. ctags now has XTAG_ANONYMOUS flag we can query and determine whether a tag is anonymous or not based on that. Our fortran parser didn't report XTAG_ANONYMOUS so it has been updated to do so.
  2. In order to store the information about anonymous tags, this pull request renames the unused pointerOrder member of TMTag (see the corresponding commit about more details to flags and uses one bit to indicate whether a tag is anonymous. This is technically a API change but since pointerOrder always contained 0 and was unused (or maybe used by some super-old parser 15 years back), it doesn't really matter (no g-p plugin uses this field).
  3. With the introduction of the new cxx parser, anonymous tags are reported as __anonNUM - before they were reported as e.g anon_struct_NUM - i.e. they contained information about the type in their name which made them easier to identify in the symbol tree. This pull request adds back this naming.
  4. In addition to (3), the NUM in the previous parser was global for all types - i.e. tags were named as anon_enum_1, anon_struct_2, anon_enum_3 which is a bit strange as it suggests there are 3 enums but there are 2 instead. This pull request makes these numbers per-type so the above becomes anon_enum_1, anon_struct_1, anon_enum_2.
  5. This pull request sets the name of anonymous tag if it's followed by the corresponding typedef tag and the typedef tag is removed. For instance, for typedef struct{int a} Foo; you would previously get an anonymous tag for the struct under which a would be shown and then separately tag Foo as a typedef. After this patch, you get a tag Foo for the struct with a as its member and the anonymous name is dropped which makes things much clearer in the sidebar.

And finally, thanks to the fact that we do renaming of anonymous tags ourselves now, the last diff against ctags main can be dropped so we can use the upstream version without any modifications and the patch file isn't necessary any more. Hurray!!!


You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany/pull/3059

Commit Summary

File Changes

(11 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3059@github.com>