LCOV - code coverage report
Current view: top level - gcc/rust/util - rust-abi.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 46.2 % 39 18
Test Date: 2026-10-03 16:17:38 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         3567 : get_abi_from_string (const std::string &abi)
      23              : {
      24         3567 :   if (abi.compare ("rust") == 0)
      25              :     return Rust::ABI::RUST;
      26         3567 :   else if (abi.compare ("rust-call") == 0)
      27              :     return Rust::ABI::RUST;
      28         3502 :   else if (abi.compare ("Rust") == 0)
      29              :     return Rust::ABI::RUST;
      30         3489 :   else if (abi.compare ("rust-intrinsic") == 0)
      31              :     return Rust::ABI::INTRINSIC;
      32         2300 :   else if (abi.compare ("C") == 0)
      33              :     return Rust::ABI::C;
      34           12 :   else if (abi.compare ("cdecl") == 0)
      35              :     return Rust::ABI::CDECL;
      36           12 :   else if (abi.compare ("stdcall") == 0)
      37              :     return Rust::ABI::STDCALL;
      38           12 :   else if (abi.compare ("fastcall") == 0)
      39              :     return Rust::ABI::FASTCALL;
      40           12 :   else if (abi.compare ("sysv64") == 0)
      41              :     return Rust::ABI::SYSV64;
      42           12 :   else if (abi.compare ("win64") == 0)
      43              :     return Rust::ABI::WIN_64;
      44           11 :   else if (abi.compare ("platform-intrinsic") == 0)
      45              :     return Rust::ABI::PLATFORM_INTRINSIC;
      46           10 :   else if (abi.compare ("unadjusted") == 0)
      47            7 :     return Rust::ABI::UNADJUSTED;
      48              : 
      49              :   return Rust::ABI::UNKNOWN;
      50              : }
      51              : 
      52              : std::string
      53           70 : get_string_from_abi (Rust::ABI abi)
      54              : {
      55           70 :   switch (abi)
      56              :     {
      57           70 :     case Rust::ABI::RUST:
      58           70 :       return "rust";
      59            0 :     case Rust::ABI::INTRINSIC:
      60            0 :       return "rust-intrinsic";
      61            0 :     case Rust::ABI::C:
      62            0 :       return "C";
      63            0 :     case Rust::ABI::CDECL:
      64            0 :       return "cdecl";
      65            0 :     case Rust::ABI::STDCALL:
      66            0 :       return "stdcall";
      67            0 :     case Rust::ABI::FASTCALL:
      68            0 :       return "fastcall";
      69            0 :     case Rust::ABI::SYSV64:
      70            0 :       return "sysv64";
      71            0 :     case Rust::ABI::WIN_64:
      72            0 :       return "win64";
      73            0 :     case Rust::ABI::PLATFORM_INTRINSIC:
      74            0 :       return "platform-intrinsic";
      75            0 :     case Rust::ABI::UNADJUSTED:
      76            0 :       return "unadjusted";
      77              : 
      78            0 :     case Rust::ABI::UNKNOWN:
      79            0 :       return "unknown";
      80              :     }
      81            0 :   return "unknown";
      82              : }
      83              : 
      84              : } // 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.