diff --git a/src/ccc/dwarf_attributes.h b/src/ccc/dwarf_attributes.h index 069776b9..7dc089df 100644 --- a/src/ccc/dwarf_attributes.h +++ b/src/ccc/dwarf_attributes.h @@ -99,7 +99,7 @@ class Value { std::span block_or_null() const; std::string_view string_or_null() const; -protected: +private: u8 m_form = 0; union { u32 address; @@ -147,7 +147,7 @@ class LocationDescription { Result print(FILE* out) const; -protected: +private: Result parse_atom(u32& offset) const; std::span m_block; @@ -207,7 +207,7 @@ class Type { Result user_def_type() const; Result> modifiers() const; -protected: +private: u32 m_attribute = 0; Value m_value; }; @@ -260,7 +260,7 @@ class ArrayBound { Result print(FILE* out) const; -protected: +private: ArrayBoundType m_type = ArrayBoundType::NIL; u32 m_constant = 0; LocationDescription m_location_description; @@ -282,7 +282,7 @@ class ArraySubscriptData { Result parse_item(u32& offset, u32 importer_flags) const; -protected: +private: Result parse_fund_type(u32& offset) const; Result parse_user_def_type(u32& offset) const; Result parse_constant(u32& offset) const; @@ -304,7 +304,7 @@ class EnumerationElementList { Result parse_element(u32& offset) const; -protected: +private: std::span m_block; }; diff --git a/src/ccc/dwarf_forge.h b/src/ccc/dwarf_forge.h index 00e51ee4..6b24f738 100644 --- a/src/ccc/dwarf_forge.h +++ b/src/ccc/dwarf_forge.h @@ -43,7 +43,7 @@ class Forge { // Output the result. std::vector finish(); -protected: +private: template u32 push(T value) { diff --git a/src/ccc/dwarf_importer.h b/src/ccc/dwarf_importer.h index c5ed6d83..c235bb50 100644 --- a/src/ccc/dwarf_importer.h +++ b/src/ccc/dwarf_importer.h @@ -25,7 +25,7 @@ class SymbolTableImporter { // compilation units associated with the specified overlay. Result import_overlay(u32 overlay_id, SymbolGroup group); -protected: +private: Result import_compile_units(std::optional overlay_id, SymbolGroup group); Result import_compile_unit(const DIE& die); Result import_data_type(const DIE& die); diff --git a/src/ccc/dwarf_printer.h b/src/ccc/dwarf_printer.h index 5f3f0e80..b90606c6 100644 --- a/src/ccc/dwarf_printer.h +++ b/src/ccc/dwarf_printer.h @@ -20,7 +20,7 @@ class SymbolPrinter { Result print_subscr_data(FILE* out, const ArraySubscriptData& subscript_data) const; Result print_enumeration_element_list(FILE* out, const EnumerationElementList& element_list) const; -protected: +private: SectionReader& m_reader; }; diff --git a/src/ccc/dwarf_section.h b/src/ccc/dwarf_section.h index 18bfbf57..499ec9bc 100644 --- a/src/ccc/dwarf_section.h +++ b/src/ccc/dwarf_section.h @@ -98,7 +98,7 @@ class DIE { // Parse the attributes, and output them all in order. Result> all_attributes() const; -protected: +private: std::span m_debug; u32 m_offset; u32 m_length; @@ -115,7 +115,7 @@ class SectionReader { u32 importer_flags() const; -protected: +private: std::span m_debug; std::span m_line; u32 m_importer_flags; diff --git a/src/ccc/dwarf_to_ast.h b/src/ccc/dwarf_to_ast.h index f38c4a56..9b2c3063 100644 --- a/src/ccc/dwarf_to_ast.h +++ b/src/ccc/dwarf_to_ast.h @@ -17,7 +17,7 @@ class TypeImporter { Result> fundamental_type_to_ast(FundamentalType fund_type); Result> die_to_ast(const DIE& die); -protected: +private: Result> array_type_to_ast(const DIE& die); SymbolDatabase& m_database; diff --git a/src/ccc/mdebug_section.h b/src/ccc/mdebug_section.h index df15d3e5..15fe4cde 100644 --- a/src/ccc/mdebug_section.h +++ b/src/ccc/mdebug_section.h @@ -156,7 +156,7 @@ class SymbolTableReader { void print_header(FILE* out) const; Result print_symbols(FILE* out, bool print_locals, bool print_procedure_descriptors, bool print_externals) const; -protected: +private: bool m_ready = false; std::span m_elf; diff --git a/src/ccc/print_cpp.h b/src/ccc/print_cpp.h index 1bd4ec66..7df488b4 100644 --- a/src/ccc/print_cpp.h +++ b/src/ccc/print_cpp.h @@ -49,7 +49,7 @@ class CppPrinter { void global_variable( const GlobalVariable& symbol, const SymbolDatabase& database, const ElfFile* elf); -protected: +private: void ast_node( const ast::Node& node, VariableName& parent_name, diff --git a/src/ccc/symbol_database.h b/src/ccc/symbol_database.h index 1a753c78..26ea73c4 100644 --- a/src/ccc/symbol_database.h +++ b/src/ccc/symbol_database.h @@ -186,7 +186,7 @@ class SymbolList { // worry about dangling handles. void clear(); -protected: +private: // Do a binary search for a handle, and return either its index, or the // index where it could be inserted. size_t binary_search(SymbolHandle handle) const; @@ -322,7 +322,7 @@ class FunctionHash { return m_hash; } -protected: +private: u32 m_hash = 0; }; @@ -392,7 +392,7 @@ class Function : public Symbol { bool is_member_function_ish = false; // Filled in by fill_in_pointers_to_member_function_definitions. bool is_no_return = false; -protected: +private: void on_destroy(SymbolDatabase* database); SourceFileHandle m_source_file; @@ -422,7 +422,7 @@ class GlobalVariable : public Symbol { GlobalStorage storage; StorageClass storage_class = STORAGE_CLASS_NONE; -protected: +private: SourceFileHandle m_source_file; std::string m_mangled_name; }; @@ -456,7 +456,7 @@ class LocalVariable : public Symbol { std::variant storage; AddressRange live_range; -protected: +private: FunctionHandle m_function; }; @@ -479,7 +479,7 @@ class Module : public Symbol { s32 version_major = -1; s32 version_minor = -1; -protected: +private: void on_create(); }; @@ -496,7 +496,7 @@ class ParameterVariable : public Symbol { std::variant storage; -protected: +private: FunctionHandle m_function; }; @@ -544,7 +544,7 @@ class SourceFile : public Symbol { std::map stabs_type_number_to_handle; std::set toolchain_version_info; -protected: +private: void on_destroy(SymbolDatabase* database); std::vector m_functions; @@ -564,7 +564,7 @@ class SymbolSource : public Symbol { SymbolSourceHandle handle() const { return m_handle; } -protected: +private: void on_create(); }; @@ -680,7 +680,7 @@ class MultiSymbolHandle { friend auto operator<=>(const MultiSymbolHandle& lhs, const MultiSymbolHandle& rhs) = default; -protected: +private: SymbolDescriptor m_descriptor = DATA_TYPE; RawSymbolHandle m_handle = NULL_SYMBOL_HANDLE; }; @@ -711,7 +711,7 @@ class NodeHandle { friend auto operator<=>(const NodeHandle& lhs, const NodeHandle& rhs) = default; -protected: +private: MultiSymbolHandle m_symbol; const ast::Node* m_node = nullptr; u32 m_generation = 0; diff --git a/src/ccc/symbol_file.h b/src/ccc/symbol_file.h index f0eaa7bc..8e74c2b8 100644 --- a/src/ccc/symbol_file.h +++ b/src/ccc/symbol_file.h @@ -40,7 +40,7 @@ class ElfSymbolFile : public SymbolFile { const ElfFile& elf() const; -protected: +private: ElfFile m_elf; std::string m_name; }; @@ -55,7 +55,7 @@ class SNDLLSymbolFile : public SymbolFile { Result>> get_symbol_tables_from_sections( const std::vector& sections) const override; -protected: +private: std::shared_ptr m_sndll; }; diff --git a/src/ccc/symbol_table.h b/src/ccc/symbol_table.h index cd308d99..2adc49b2 100644 --- a/src/ccc/symbol_table.h +++ b/src/ccc/symbol_table.h @@ -96,7 +96,7 @@ class MdebugSymbolTable : public SymbolTable { Result print_headers(FILE* out) const override; Result print_symbols(FILE* out, u32 flags) const override; -protected: +private: std::span m_image; s32 m_section_offset; }; @@ -117,7 +117,7 @@ class DwarfSymbolTable : public SymbolTable { Result print_headers(FILE* out) const override; Result print_symbols(FILE* out, u32 flags) const override; -protected: +private: std::span m_debug; std::span m_line; }; @@ -138,7 +138,7 @@ class SymtabSymbolTable : public SymbolTable { Result print_headers(FILE* out) const override; Result print_symbols(FILE* out, u32 flags) const override; -protected: +private: std::span m_symtab; std::span m_strtab; }; @@ -161,7 +161,7 @@ class SNDLLSymbolTable : public SymbolTable { Result print_headers(FILE* out) const override; Result print_symbols(FILE* out, u32 flags) const override; -protected: +private: std::shared_ptr m_sndll; }; @@ -180,7 +180,7 @@ class ElfSectionHeadersSymbolTable : public SymbolTable { Result print_headers(FILE* out) const override; Result print_symbols(FILE* out, u32 flags) const override; -protected: +private: const ElfFile& m_elf; }; diff --git a/src/ccc/util.h b/src/ccc/util.h index 43fe1d05..bddb617f 100644 --- a/src/ccc/util.h +++ b/src/ccc/util.h @@ -94,7 +94,7 @@ template class [[nodiscard]] CCC_WARN_UNUSED Result { template friend class Result; -protected: +private: Value m_value; std::unique_ptr m_error;