LCOV - code coverage report
Current view: top level - gcc/rust/util - rust-abi.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 54.5 % 33 18
Test Date: 2026-02-28 14:20:25 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // This file is part of GCC.
       2              : 
       3              : // GCC is free software; you can redistribute it and/or modify it under
       4              : // the terms of the GNU General Public License as published by the Free
       5              : // Software Foundation; either version 3, or (at your option) any later
       6              : // version.
       7              : 
       8              : // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
       9              : // WARRANTY; without even the implied warranty of MERCHANTABILITY or
      10              : // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      11              : // for more details.
      12              : 
      13              : // You should have received a copy of the GNU General Public License
      14              : // along with GCC; see the file COPYING3.  If not see
      15              : // <http://www.gnu.org/licenses/>.
      16              : 
      17              : #include "rust-abi.h"
      18              : 
      19              : namespace Rust {
      20              : 
      21              : Rust::ABI
      22         3020 : get_abi_from_string (const std::string &abi)
      23              : {
      24         3020 :   if (abi.compare ("rust") == 0)
      25              :     return Rust::ABI::RUST;
      26         3012 :   else if (abi.compare ("rust-call") == 0)
      27              :     return Rust::ABI::RUST;
      28         2948 :   else if (abi.compare ("Rust") == 0)
      29              :     return Rust::ABI::RUST;
      30         2939 :   else if (abi.compare ("rust-intrinsic") == 0)
      31              :     return Rust::ABI::INTRINSIC;
      32         2123 :   else if (abi.compare ("C") == 0)
      33              :     return Rust::ABI::C;
      34            4 :   else if (abi.compare ("cdecl") == 0)
      35              :     return Rust::ABI::CDECL;
      36            4 :   else if (abi.compare ("stdcall") == 0)
      37              :     return Rust::ABI::STDCALL;
      38            4 :   else if (abi.compare ("fastcall") == 0)
      39              :     return Rust::ABI::FASTCALL;
      40            4 :   else if (abi.compare ("sysv64") == 0)
      41              :     return Rust::ABI::SYSV64;
      42            4 :   else if (abi.compare ("win64") == 0)
      43            1 :     return Rust::ABI::WIN_64;
      44              : 
      45              :   return Rust::ABI::UNKNOWN;
      46              : }
      47              : 
      48              : std::string
      49        10038 : get_string_from_abi (Rust::ABI abi)
      50              : {
      51        10038 :   switch (abi)
      52              :     {
      53         6106 :     case Rust::ABI::RUST:
      54         6106 :       return "rust";
      55            0 :     case Rust::ABI::INTRINSIC:
      56            0 :       return "rust-intrinsic";
      57         3932 :     case Rust::ABI::C:
      58         3932 :       return "C";
      59            0 :     case Rust::ABI::CDECL:
      60            0 :       return "cdecl";
      61            0 :     case Rust::ABI::STDCALL:
      62            0 :       return "stdcall";
      63            0 :     case Rust::ABI::FASTCALL:
      64            0 :       return "fastcall";
      65            0 :     case Rust::ABI::SYSV64:
      66            0 :       return "sysv64";
      67            0 :     case Rust::ABI::WIN_64:
      68            0 :       return "win64";
      69              : 
      70            0 :     case Rust::ABI::UNKNOWN:
      71            0 :       return "unknown";
      72              :     }
      73            0 :   return "unknown";
      74              : }
      75              : 
      76              : } // namespace Rust
        

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.