Skip to content

Conversation

@andrew-boyarshin
Copy link
Contributor

Not currently exposed, but can easily be plumbed as opt-in command line option. Note, that not all Desc items have Location attribute set, since for some it doesn't make any sense.

}
}

private void WriteSourceLocation(CXSourceLocation location, bool inline)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned this is going to end up very noisy across regenerations. The anonymous struct names/remappings is already a pain point for some users

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's opt-in. It is useful for diagnostics (aka "where did this come from?"), but not so much for end-user of the bindings. I don't expect SharpGen-generated bindings or e.g. TerraFX.Interop to contain this info. But e.g. win32metadata and SharpGen might use this information to enrich logging or other forms of diagnostics.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I understand the benefit.

I was just iterating the concern around noise in practice. Many diffs would become nearly unreadable due to minor changes in information such as whitespace addition.

If it's being added here, a corresponding switch and basic test validating it works and doesn't regress should also be added.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll add public API surface and write some tests this weekend.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've added 2 tests that cover all important cases.

@tannergooding
Copy link
Member

The rest of the changes look reasonable to me.


GenerateTemplateBindings = 0x01000000,

GenerateSourceLocationAttribute = 1 << 25,
Copy link
Member

@tannergooding tannergooding Apr 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This should be either 0x02000000 or all entries should be updated to use the 1 << n syntax.

I don't have a particular preference for which is done, I'd just like for it to be consistent so correctness can be determined at a glance

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the rest to use bit shifting to be explicit and simplify visual validation of flag values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@tannergooding
Copy link
Member

Changes LGTM, minus the differing flag value

@tannergooding tannergooding merged commit b3fdc2f into dotnet:main Apr 10, 2021
@andrew-boyarshin andrew-boyarshin deleted the enum_desc branch April 11, 2021 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants