<commit_before>#![allow(non_upper_case_globals, dead_code)]

use std::os::raw::{c_uint, c_char, c_int, c_ulong, c_longlong};
use std::{mem, ptr};
use std::fmt;
use std::hash::Hash;
use std::hash::Hasher;
use std::ffi::{CString, CStr};

use clangll::*;

// Cursor
#[derive(Copy, Clone)]
pub struct Cursor {
    x: CXCursor
}

pub type CursorVisitor<'s> = for<'a, 'b> FnMut(&'a Cursor, &'b Cursor) -> Enum_CXChildVisitResult + 's;

impl Cursor {
    // common
    pub fn spelling(&self) -> String {
        unsafe {
            String_ { x: clang_getCursorSpelling(self.x) }.to_string()
        }
    }

    pub fn display_name(&self) -> String {
        unsafe {
            String_ { x: clang_getCursorDisplayName(self.x) }.to_string()
        }
    }

    pub fn mangling(&self) -> String {
        let mut mangling = unsafe {
            String_ { x: clang_Cursor_getMangling(self.x) }.to_string()
        };

        // Try to undo backend mangling
        if cfg!(target_os = "macos") || cfg!(target_os = "windows") {
            mangling.remove(0);
        }
        mangling<commit_msg>Restrict the undo mangling hack to gnu target<commit_after>#![allow(non_upper_case_globals, dead_code)]

use std::os::raw::{c_uint, c_char, c_int, c_ulong, c_longlong};
use std::{mem, ptr};
use std::fmt;
use std::hash::Hash;
use std::hash::Hasher;
use std::ffi::{CString, CStr};

use clangll::*;

// Cursor
#[derive(Copy, Clone)]
pub struct Cursor {
    x: CXCursor
}

pub type CursorVisitor<'s> = for<'a, 'b> FnMut(&'a Cursor, &'b Cursor) -> Enum_CXChildVisitResult + 's;

impl Cursor {
    // common
    pub fn spelling(&self) -> String {
        unsafe {
            String_ { x: clang_getCursorSpelling(self.x) }.to_string()
        }
    }

    pub fn display_name(&self) -> String {
        unsafe {
            String_ { x: clang_getCursorDisplayName(self.x) }.to_string()
        }
    }

    pub fn mangling(&self) -> String {
        let mut mangling = unsafe {
            String_ { x: clang_Cursor_getMangling(self.x) }.to_string()
        };

        // Try to undo backend mangling
        if cfg!(target_os = "macos") || cfg!(all(target_os = "windows", target_env = "gnu")) {
            mangling.remove(0);
        }
        mangling
{'fraction_non_alphanumeric': 0.15082552431950022, 'fraction_numerical': 0.000892458723784025, 'mean_word_length': 2.6935749588138385, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2520552', 'n_tokens_mistral': 816, 'n_tokens_neox': 799, 'n_words': 180}