<commit_before>package runtime

import (
	"fmt"
	"os"
	"strings"

	"github.com/go-clang/gen"
)

// PrepareFunctionName prepares C function naming to Go function name.
func PrepareFunctionName(g *gen.Generation, f *gen.Function) string {
	fname := strings.TrimPrefix(f.Name, "clang_")

	// trim some allowlisted prefixes by their function name
	switch {
	case strings.HasPrefix(fname, "indexLoc_"):
		fname = strings.TrimPrefix(fname, "indexLoc_")

	case strings.HasPrefix(fname, "index_"):
		fname = strings.TrimPrefix(fname, "index_")

	case strings.HasPrefix(fname, "Location_"):
		fname = strings.TrimPrefix(fname, "Location_")

	case strings.HasPrefix(fname, "Range_"):
		fname = strings.TrimPrefix(fname, "Range_")

	case strings.HasPrefix(fname, "remap_"):
		fname = strings.TrimPrefix(fname, "remap_")

	case strings.EqualFold(fname, "Install_aborting_llvm_fatal_error_handler"): // special case
		// fname = strings.Trim(fname, "llvm_")
		// fname = gen.ToCamelCase(fname)
		fname = "InstallAbortingFatalErrorHandler"

	case strings.EqualFold(fname, "Uninstall_llvm_fatal_error_handler"):
		fname = "UninstallFatalErrorHandler"
	}

	// trim some allowlisted prefixes by their types
	if len(f.Parameters) > 0 && g.IsEnumOrStruct(f.Parameters[0].Type.GoName) {
		switch f.Parameters[0].Type.GoName {
		case "CodeCompleteResults":
			fname = strings.TrimPrefix(fname, "codeComplete")

		case "CompletionString":
			if f.CName == "clang_getNumCompletionChunks" {
				fname = "NumChunks"
			} else {
				fname = strings.TrimPrefix(fname, "getCompletion")
			}

		case "SourceRange":
			fname = strings.TrimPrefix(fname, "getRange")
		}
	}

	return fname<commit_msg>cmd/go-clang-gen/runtime: remove unused commented code<commit_after>package runtime

import (
	"fmt"
	"os"
	"strings"

	"github.com/go-clang/gen"
)

// PrepareFunctionName prepares C function naming to Go function name.
func PrepareFunctionName(g *gen.Generation, f *gen.Function) string {
	fname := strings.TrimPrefix(f.Name, "clang_")

	// trim some allowlisted prefixes by their function name
	switch {
	case strings.HasPrefix(fname, "indexLoc_"):
		fname = strings.TrimPrefix(fname, "indexLoc_")

	case strings.HasPrefix(fname, "index_"):
		fname = strings.TrimPrefix(fname, "index_")

	case strings.HasPrefix(fname, "Location_"):
		fname = strings.TrimPrefix(fname, "Location_")

	case strings.HasPrefix(fname, "Range_"):
		fname = strings.TrimPrefix(fname, "Range_")

	case strings.HasPrefix(fname, "remap_"):
		fname = strings.TrimPrefix(fname, "remap_")

	case strings.EqualFold(fname, "Install_aborting_llvm_fatal_error_handler"): // special case
		fname = "InstallAbortingFatalErrorHandler"

	case strings.EqualFold(fname, "Uninstall_llvm_fatal_error_handler"):
		fname = "UninstallFatalErrorHandler"
	}

	// trim some allowlisted prefixes by their types
	if len(f.Parameters) > 0 && g.IsEnumOrStruct(f.Parameters[0].Type.GoName) {
		switch f.Parameters[0].Type.GoName {
		case "CodeCompleteResults":
			fname = strings.TrimPrefix(fname, "codeComplete")

		case "CompletionString":
			if f.CName == "clang_getNumCompletionChunks" {
				fname = "NumChunks"
			} else {
				fname = strings.TrimPrefix(fname, "getCompletion")
			}

		case "SourceRange":
			fname = strings.TrimPrefix(fname, "getRange")
		}
	}

	return fname
{'fraction_non_alphanumeric': 0.12731130645650196, 'fraction_numerical': 0.0018187329493785996, 'mean_word_length': 4.9352517985611515, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 5, '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': '6869389', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1133, 'n_words': 232}