Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Updated parsing of typedef enclosed declarations #83

Merged
merged 8 commits into from
Aug 17, 2020

Conversation

mannprerak2
Copy link
Contributor

@mannprerak2 mannprerak2 commented Aug 17, 2020

  • Added getCursorUSR_wrap to wrapper.c, updated wrapper version to v3,
  • Updated code to use USR obtained via libclang to uniquely identify declarations. This prevents skipping of struct and typedefs with similar names (closes Struct and typedef Struct name conflicts dart-lang/native#403).
  • Name from the global namespace is used (affects structs and enums as they can be inside a typedef) (closes [Question] typedef struct dart-lang/native#400).
  • If declaration is excluded according to config the above rule isn't followed and the name used in the first function parsed is used.
  • Added tests, updated test_coverage.dart.

Example -

Suppose we have a struct _S(struct namespace) enclosed in typedef S(global namespace), some typerefs and a function using struct via a typeref.

typedef struct _S{

} S; // S is in global namespace, _S is in struct namespace.

// These typerefs are not considered.
typedef S S1;
typedef S S2;
typedef S S3;

void func(S1*);

Ffigen follows the following rules

  • If only _S or S is included according to config, that particular name is used.
  • If both _S and S are included according to config, name in the global namespace, S is used.
  • If both _S and S are excluded according to config, the name used by the first function parsed (S1` in the example) will be used.

@mannprerak2 mannprerak2 changed the title Struct typedef Updated parsing of typedef enclosed declarations Aug 17, 2020
@jonasfj jonasfj merged commit cb661ee into dart-archive:master Aug 17, 2020
@mannprerak2 mannprerak2 deleted the struct_typedef branch August 17, 2020 12:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Struct and typedef Struct name conflicts [Question] typedef struct
2 participants