LCOV - code coverage report
Current view: top level - gcc/rust/metadata - rust-export-metadata.h Coverage Total Hit
Test: gcc.info Lines: 100.0 % 1 1
Test Date: 2026-02-28 14:20:25 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // Copyright (C) 2020-2026 Free Software Foundation, Inc.
       2              : 
       3              : // This file is part of GCC.
       4              : 
       5              : // GCC is free software; you can redistribute it and/or modify it under
       6              : // the terms of the GNU General Public License as published by the Free
       7              : // Software Foundation; either version 3, or (at your option) any later
       8              : // version.
       9              : 
      10              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      11              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      13              : // for more details.
      14              : 
      15              : // You should have received a copy of the GNU General Public License
      16              : // along with GCC; see the file COPYING3.  If not see
      17              : // <http://www.gnu.org/licenses/>.
      18              : 
      19              : #ifndef RUST_EXPORT_METADATA_H
      20              : #define RUST_EXPORT_METADATA_H
      21              : 
      22              : #include "rust-system.h"
      23              : #include "rust-hir-full-decls.h"
      24              : #include "rust-hir-map.h"
      25              : 
      26              : namespace Rust {
      27              : namespace Metadata {
      28              : 
      29              : static const char kMagicHeader[4] = {'G', 'R', 'S', 'T'};
      30              : static const char kSzDelim[1] = {'$'};
      31              : 
      32              : class ExportContext
      33              : {
      34              : public:
      35              :   ExportContext ();
      36              : 
      37              :   ~ExportContext ();
      38              : 
      39              :   void push_module_scope (const HIR::Module &module);
      40              : 
      41              :   const HIR::Module &pop_module_scope ();
      42              : 
      43              :   void emit_trait (const HIR::Trait &trait);
      44              :   void emit_function (const HIR::Function &fn);
      45              : 
      46              :   /**
      47              :    * Macros are a bit particular - they only live at the AST level, so we can
      48              :    * directly refer to them using their NodeId. There's no need to keep an HIR
      49              :    * node for them.
      50              :    */
      51              :   void emit_macro (AST::MacroRulesDefinition &macro);
      52              : 
      53              :   const std::string &get_interface_buffer () const;
      54              : 
      55              : private:
      56              :   Analysis::Mappings &mappings;
      57              : 
      58              :   std::vector<std::reference_wrapper<const HIR::Module>> module_stack;
      59              :   std::string public_interface_buffer;
      60              : };
      61              : 
      62         4028 : class PublicInterface
      63              : {
      64              : public:
      65              :   static void Export (HIR::Crate &crate);
      66              : 
      67              :   static void ExportTo (HIR::Crate &crate, const std::string &output_path);
      68              : 
      69              :   static bool is_crate_public (const HIR::VisItem &item);
      70              : 
      71              :   static std::string expected_metadata_filename ();
      72              : 
      73              : protected:
      74              :   void gather_export_data ();
      75              : 
      76              :   void write_to_object_file () const;
      77              : 
      78              :   void write_to_path (const std::string &path) const;
      79              : 
      80              : private:
      81              :   PublicInterface (HIR::Crate &crate);
      82              : 
      83              :   HIR::Crate &crate;
      84              :   Analysis::Mappings &mappings;
      85              :   ExportContext context;
      86              : };
      87              : 
      88              : } // namespace Metadata
      89              : } // namespace Rust
      90              : 
      91              : #endif // RUST_EXPORT_METADATA_H
        

Generated by: LCOV version 2.4-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.