mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-27 22:02:33 +01:00
In preparation for exporting specific classes, remove `fields_exported`. A class's fields will be exported for each specific, so a single boolean won't work. Instead, check in `ExportAllFieldsToCpp` if `clang_decls` already has an export for this field, and skip if so. Once specifics are supported, this lookup will use both the field's `InstId` and `SpecificId`. The above changes aren't quite sufficient, because if a field fails to be exported, it will keep being attempted on each call to `ExportAllFieldsToCpp` resulting in multiple errors. Fix this by storing an invalid `FieldDecl` in `ClangDeclStore` if an error occurs. This lets `ExportAllFieldsToCpp` know not to reattempt export, and `ExportFieldToCpp` returns `nullptr` for invalid fields same as before.