The symbol tree construction code assumes that tag parents appear before their 
children. At the moment tag list is sorted by line numbers which works for C 
structs
```C
struct Foo {
    int bar;
    int baz;
}
```
where the tag Foo (which is a parent of bar and baz) is sorted before bar and 
baz. However, this doesn't work when the name of the struct (or a variable 
of an anonymous struct) follows the struct members such as in the following 
SystemVerilog example:
```systemverilog
struct packed {
    byte s_a, s_b, s_c;
    string s_str;
} s_member;
```
Here the members are sorted before the parent and the symbol tree construction 
code doesn't work correctly.

This patch sorts symbols so that parents are sorted before their members - only 
if tags aren't in a parent-child relationship the original sorting by line 
is performed.

@b4n Does this look alright to you?

Fixes #4060.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Make sure that parents appear before their children when constructing 
symbol tree

-- File Changes --

    M src/symbols.c (40)

-- Patch Links --

https://github.com/geany/geany/pull/4063.patch
https://github.com/geany/geany/pull/4063.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4063
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/[email protected]>

Reply via email to