Biohazrd icon indicating copy to clipboard operation
Biohazrd copied to clipboard

Better support for template metadata and function templates

Open PathogenDavid opened this issue 2 years ago • 0 comments

Right now reading template-related information is difficult to do since you end up having to deal with low-level Clang details. We should expose template-related concepts in a way that makes it possible for specialized generators to inspect them.

  • [ ] TranslatedTemplateSpecialization should expose the parameters used for the template.
  • [ ] TemplateSpecializationType should be reduced to a type which allows you to inspect the template paramers
    • Need to decide if this should only happen when template support is disabled or if we want a specialization of TranslatedTypeReference for templates.
    • We could also have a special type which has a TranslatedTypeReference and the parameter-related metadata, but that makes walking the type tree more difficult for consumers because they have to handle this edge case.
  • [x] Add an abstract TranslatedTemplate declaration type which exposes the concept of an uninitialized template.
    • For now these would just be for inspection purposes. In the future we might expose the ability to explicitly specialize the template.
    • [ ] Decide if types inheriting from this type should cause diagnostics. (On one hand it'd help discover why templates without any instantiations are not in the output, on the other hand it's noise in projects where it doesn't matter.)
    • [x] Add a TranslatedRecordTemplate inheriting from TranslatedTemplate to represent record templates.
      • [ ] TranslatedTemplateSpecialization should be updated to reference the template
    • [x] Add a TranslatedFunctionTemplate inheriting from TranslatedTemplate to represent function templates.
  • [ ] Add TranslatedFunctionTemplateSpecialization inheriting from TranslatedFunction which similar to TranslatedTemplateSpecialization represents a specific function specialization.
    • [ ] Consider renaming TranslatedTemplateSpecialization to TranslatedRecordTemplateSpecialization.

PathogenDavid avatar Jun 28 '22 19:06 PathogenDavid