Using declarations fix in symbol tables

Implementation is very similar to typedef implementation.
Issue #655 and closes #1488.
Testcase using_member.i.
Better implementation to that reverted in previous commit 3f36157b.
Symbol tables shown with -debug-csymbols and -debug-symbols now correct
and are similar to when using a typedef.
This commit is contained in:
William S Fulton 2022-02-20 13:30:58 +00:00
parent 3f36157b39
commit cb963a1440
1 changed files with 9 additions and 4 deletions

View File

@ -641,10 +641,11 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
{
Node *td = n;
while (td && Checkattr(td, "nodeType", "cdecl") && Checkattr(td, "storage", "typedef")) {
while (td && ((Equal(nodeType(td), "cdecl") && Checkattr(td, "storage", "typedef")) || (Equal(nodeType(td), "using") && !Getattr(n, "namespace")))) {
SwigType *type;
Node *td1;
type = Copy(Getattr(td, "type"));
int using_not_typedef = Equal(nodeType(td), "using");
type = Copy(Getattr(td, using_not_typedef ? "uname" : "type"));
SwigType_push(type, Getattr(td, "decl"));
td1 = Swig_symbol_clookup(type, 0);
@ -665,9 +666,13 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
ie, when Foo -> FooBar -> Foo, jump one scope up when possible.
*/
if (td1 && Checkattr(td1, "storage", "typedef")) {
String *st = Getattr(td1, "type");
if (td1) {
String *st = 0;
String *sn = Getattr(td, "name");
if (Equal(nodeType(td1), "cdecl") && Checkattr(td1, "storage", "typedef"))
st = Getattr(td1, "type");
else if (Equal(nodeType(td1), "using") && !Getattr(td1, "namespace"))
st = Getattr(td1, "uname");
if (st && sn && Equal(st, sn)) {
Symtab *sc = Getattr(current_symtab, "parentNode");
if (sc)