Repository: carbon-language/carbon-lang
File: toolchain/lower/context.h (C/C++)

Code before:

  // State for building the LLVM IR.
  llvm::LLVMContext* llvm_context_;
  std::unique_ptr<llvm::Module> llvm_module_;

  // The filesystem for source code.
  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> file_system_;

  // State for building the LLVM IR debug info metadata.
  llvm::DIBuilder di_builder_;

  // The DICompileUnit, if any - null implies debug info is not being emitted.
  llvm::DICompileUnit* di_compile_unit_;

  // Parse trees. Used for debug information and crash diagnostics.
  const Parse::GetTreeAndSubtreesStore* tree_and_subtrees_getters_;

  // The optional vlog stream.
  llvm::raw_ostream* vlog_stream_;

  // The `FileContext`s for each IR that is involved in this lowering action.
  using FileContexts =
      FixedSizeValueStore<SemIR::CheckIRId, std::unique_ptr<FileContext>>;
  FileContexts file_contexts_;

  // Lowered version of the builtin type `type`.
  llvm::StructType* type_type_ = nullptr;

  // Global format string for `printf.int.format` used by the PrintInt builtin.
  llvm::Value* printf_int_format_string_ = nullptr;

  // Tracks which specific functions need to have their definitions lowered.
  // This list may grow while lowering generic definitions from this list.
  llvm::SmallVector<PendingSpecificFunctionDefinition>
      specific_function_definitions_;
};

}  // namespace Carbon::Lower

#endif  // CARBON_TOOLCHAIN_LOWER_CONTEXT_H_


Review comment (suggestion):
Don't we usually use `Store` as a suffix for the various store variants, rather than just pluralizing the type name? i.e.:

```suggestion
  using FileContextStore =
```

Code after:
  auto LowerPendingDefinitions() -> void;

  // State for building the LLVM IR.
  llvm::LLVMContext* llvm_context_;
  std::unique_ptr<llvm::Module> llvm_module_;

  // The filesystem for source code.
  llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> file_system_;

  // State for building the LLVM IR debug info metadata.
  llvm::DIBuilder di_builder_;

  // The DICompileUnit, if any - null implies debug info is not being emitted.
  llvm::DICompileUnit* di_compile_unit_;

  // Parse trees. Used for debug information and crash diagnostics.
  const Parse::GetTreeAndSubtreesStore* tree_and_subtrees_getters_;

  // The optional vlog stream.
  llvm::raw_ostream* vlog_stream_;

  // The total number of files.
  int total_ir_count_;

  // The `FileContext`s for each IR that is involved in this lowering action.
  using FileContextStore =
      FixedSizeValueStore<SemIR::CheckIRId, std::unique_ptr<FileContext>>;
  FileContextStore file_contexts_;

  // Lowered version of the builtin type `type`.
  llvm::StructType* type_type_ = nullptr;

  // Global format string for `printf.int.format` used by the PrintInt builtin.
  llvm::Value* printf_int_format_string_ = nullptr;

  // Tracks which specific functions need to have their definitions lowered.
  // This list may grow while lowering generic definitions from this list.
  llvm::SmallVector<PendingSpecificFunctionDefinition>
      specific_function_definitions_;
};

}  // namespace Carbon::Lower

#endif  // CARBON_TOOLCHAIN_LOWER_CONTEXT_H_