<commit_before>// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include "AutowiringDebug.h"
#include "Autowired.h"
#include <iomanip>
#include <iostream>
#include <sstream>

using namespace autowiring;
using namespace autowiring::dbg;

#ifdef _MSC_VER
// On Windows, lambda functions start with the key string "class <"
bool autowiring::dbg::IsLambda(const std::type_info& ti) {
  return demangle(ti).compare(0, 7, "class <") == 0;
}
#else
// On other platforms, try to find lambda functions by the presence of forbidden characters
bool autowiring::dbg::IsLambda(const std::type_info& ti) {
  auto name = demangle(ti);
  for (auto cur : name)
    if (
      !('a' <= cur && cur <= 'z') &&
      !('A' <= cur && cur <= 'Z') &&
      !('0' <= cur && cur <= '9') &&
      cur != '_' &&
      cur != ':' &&
      cur != '<' &&
      cur != '>' &&
      cur != ',' &&
      cur != ' '
    )
      return true;
  return false;
}
#endif

static std::string TrimPrefix(std::string name) {
#ifdef _MSC_VER
  // "class" or "struct" prefixes should be eliminated
  if (name.compare(0, 6, "class "))
    name = name.substr(5);
  if (name.compare(0, 7, "struct "))
    name = name.substr(6);
#endif

  return name;
}

static std::string DemangleWithAutoID(const std::type_info& ti) {
  auto retVal = demangle(ti);

  // prefix is at the beginning of the string, skip over it
  static const char prefix [] = "struct auto_id<";
  if (retVal.compare(0, sizeof(prefix) - 1, prefix) == 0) {<commit_msg>Make DemangleWithAutoID work correctly with mac and linux<commit_after>// Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include "AutowiringDebug.h"
#include "Autowired.h"
#include <iomanip>
#include <iostream>
#include <sstream>

using namespace autowiring;
using namespace autowiring::dbg;

#ifdef _MSC_VER
// On Windows, lambda functions start with the key string "class <"
bool autowiring::dbg::IsLambda(const std::type_info& ti) {
  return demangle(ti).compare(0, 7, "class <") == 0;
}
#else
// On other platforms, try to find lambda functions by the presence of forbidden characters
bool autowiring::dbg::IsLambda(const std::type_info& ti) {
  auto name = demangle(ti);
  for (auto cur : name)
    if (
      !('a' <= cur && cur <= 'z') &&
      !('A' <= cur && cur <= 'Z') &&
      !('0' <= cur && cur <= '9') &&
      cur != '_' &&
      cur != ':' &&
      cur != '<' &&
      cur != '>' &&
      cur != ',' &&
      cur != ' '
    )
      return true;
  return false;
}
#endif

static std::string TrimPrefix(std::string name) {
#ifdef _MSC_VER
  // "class" or "struct" prefixes should be eliminated
  if (name.compare(0, 6, "class "))
    name = name.substr(5);
  if (name.compare(0, 7, "struct "))
    name = name.substr(6);
#endif

  return name;
}

static std::string DemangleWithAutoID(const std::type_info& ti) {
  auto retVal = demangle(ti);

  // prefix is at the beginning of the string, skip over it
#ifdef _MSC_VER
  static const char prefix [] = "struct auto_id<";
#else
  static const char prefix [] = "auto_id<";
#endif

  if (retVal.compare(0, sizeof(prefix) - 1, prefix) == 0) {
{'fraction_non_alphanumeric': 0.1657179000632511, 'fraction_numerical': 0.013915243516761544, 'mean_word_length': 3.454929577464789, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 11, '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': '801514', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1076, 'n_words': 332}