void AddDeclaration(object a) { if (!(a is Statement statement)) { return; } _tu.AddStatement(statement); if (statement is MultiDeclaratorStatement mds) { switch (mds.Specifiers.StorageClassSpecifier) { case StorageClassSpecifier.Typedef when mds.InitDeclarators != null: foreach (var i in mds.InitDeclarators) { lexer.AddTypedef(i.Declarator.DeclaredIdentifier); } break; case StorageClassSpecifier.None when mds.Specifiers.TypeSpecifiers.Count > 0: foreach (var i in mds.Specifiers.TypeSpecifiers) { if (i.Kind == TypeSpecifierKind.Class || i.Kind == TypeSpecifierKind.Struct || i.Kind == TypeSpecifierKind.Union || i.Kind == TypeSpecifierKind.Enum) { Debug.WriteLine($"Add typedef `{i.Name}`"); lexer.AddTypedef(i.Name); } } break; } } }
void AddDeclaration(object a) { if (!(a is Statement statement)) { return; } _tu.AddStatement(statement); if (statement is MultiDeclaratorStatement mds) { switch (mds.Specifiers.StorageClassSpecifier) { case StorageClassSpecifier.Typedef when mds.InitDeclarators != null: foreach (var i in mds.InitDeclarators) { lexer.AddTypedef(i.Declarator.DeclaredIdentifier); } break; } } }
void AddDeclaration(object a) { _tu.AddStatement((Statement)a); }