Biohazrd icon indicating copy to clipboard operation
Biohazrd copied to clipboard

Should all translated declarations be able to be created synthetically?

Open PathogenDavid opened this issue 3 years ago • 1 comments

Right now all of the built-in declarations are restricted to being created internally. This prohibits them from being created synthetically. Should we lift this restriction? Currently I've not encountered a reason to do this, but it's not that absurd. (In theory SynthesizedLooseDeclarationsType could've been a synthesized TranslatedRecord, although it has no concept of static classes so it couldn't be marked as static.)

There are basically four types of declarations within Biohazrd:

  1. Declarations from parsing (Created via internal constructors generally taking a TranslationUnitParser, TranslatedFile, and Decl)
  2. Declarations synthesized to replace another.
  3. Declarations synthesized entirely.
  4. Declarations that are transformed variants of a previous declaration.

1 is purely internal and we don't want consumers of Biohazrd to be able to create them. (The way these declarations are constructed is tied too heavily to the internals of how Biohazrd parsing works.) 2 and 3 are primarily what this issue is about. 4 is a feature we get for free with C#9 records.

PathogenDavid avatar Sep 24 '20 23:09 PathogenDavid

TranslatedFunction types should likely never be allowed because we can't arrange the function call to them for ABI handling purposes.

PathogenDavid avatar Jun 21 '21 19:06 PathogenDavid