/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/heap/cppgc/name-trait.cc
41 строка
1 KB
Michaël Zasso
deps: update V8 to 14.6.202.33
24 апр 2026, 19:01
Не верифицирован
24 апр 2026, 19:01
f1e0b83
Код
Авторство
О чём код?
// Copyright 2020 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "include/cppgc/internal/name-trait.h" #include <stdio.h> #include <string_view> #include "src/base/logging.h" namespace cppgc { // static constexpr const char NameProvider::kHiddenName[]; // static constexpr const char NameProvider::kNoNameDeducible[]; namespace internal { // static HeapObjectName NameTraitBase::GetNameFromTypeSignature(const char* signature) { // Parsing string of structure: // static HeapObjectName NameTrait<int>::GetNameFor(...) [T = int] if (!signature) return {NameProvider::kNoNameDeducible, false}; const std::string_view raw(signature); const auto start_pos = raw.rfind("T = ") + 4; DCHECK_NE(std::string_view::npos, start_pos); const auto len = raw.length() - start_pos - 1; const std::string_view name = raw.substr(start_pos, len); char* name_buffer = new char[name.length() + 1]; memcpy(name_buffer, name.data(), name.length()); name_buffer[name.length()] = '\0'; // ensure null terminator set return {name_buffer, false}; } } // namespace internal } // namespace cppgc