bulbazord created this revision.
bulbazord added reviewers: JDevlieghere, Michael137, augusto2112, kastiglione,
fdeazeve.
Herald added a subscriber: emaste.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
This doesn't really use fast comparison or string uniqueness. In fact,
all of the current callers pass an empty string for type_name. The only
reason I don't remove it is because it looks like it is used downstream
for swift.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153810
Files:
lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -280,13 +280,13 @@
}
CompilerType CreateStructForIdentifier(
- ConstString type_name,
+ llvm::StringRef type_name,
const std::initializer_list<std::pair<const char *, CompilerType>>
&type_fields,
bool packed = false);
CompilerType GetOrCreateStructForIdentifier(
- ConstString type_name,
+ llvm::StringRef type_name,
const std::initializer_list<std::pair<const char *, CompilerType>>
&type_fields,
bool packed = false);
Index: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
===================================================================
--- lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2308,12 +2308,12 @@
}
CompilerType TypeSystemClang::CreateStructForIdentifier(
- ConstString type_name,
+ llvm::StringRef type_name,
const std::initializer_list<std::pair<const char *, CompilerType>>
&type_fields,
bool packed) {
CompilerType type;
- if (!type_name.IsEmpty() &&
+ if (!type_name.empty() &&
(type = GetTypeForIdentifier<clang::CXXRecordDecl>(type_name))
.IsValid()) {
lldbassert(0 && "Trying to create a type for an existing name");
@@ -2321,8 +2321,7 @@
}
type = CreateRecordType(nullptr, OptionalClangModuleID(), lldb::eAccessPublic,
- type_name.GetCString(), clang::TTK_Struct,
- lldb::eLanguageTypeC);
+ type_name, clang::TTK_Struct, lldb::eLanguageTypeC);
StartTagDeclarationDefinition(type);
for (const auto &field : type_fields)
AddFieldToRecordType(type, field.first, field.second, lldb::eAccessPublic,
@@ -2334,7 +2333,7 @@
}
CompilerType TypeSystemClang::GetOrCreateStructForIdentifier(
- ConstString type_name,
+ llvm::StringRef type_name,
const std::initializer_list<std::pair<const char *, CompilerType>>
&type_fields,
bool packed) {
Index: lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
===================================================================
--- lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
+++ lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
@@ -277,7 +277,7 @@
ast->AddFieldToRecordType(
union_type, "_rt",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_pid", pid_type},
{"_uid", uid_type},
@@ -287,7 +287,7 @@
ast->AddFieldToRecordType(
union_type, "_child",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_pid", pid_type},
{"_uid", uid_type},
@@ -299,7 +299,7 @@
ast->AddFieldToRecordType(
union_type, "_fault",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_addr", voidp_type},
{"_trap", int_type},
@@ -310,7 +310,7 @@
ast->AddFieldToRecordType(
union_type, "_poll",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_band", long_type},
{"_fd", int_type},
@@ -319,7 +319,7 @@
ast->AddFieldToRecordType(union_type, "_syscall",
ast->CreateStructForIdentifier(
- ConstString(),
+ llvm::StringRef(),
{
{"_sysnum", int_type},
{"_retval", int_type.GetArrayType(2)},
@@ -330,7 +330,7 @@
ast->AddFieldToRecordType(
union_type, "_ptrace_state",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_pe_report_event", int_type},
{"_option", ptrace_option_type},
Index: lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
===================================================================
--- lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -360,13 +360,14 @@
nullptr, OptionalClangModuleID(), lldb::eAccessPublic, "",
clang::TTK_Union, lldb::eLanguageTypeC);
ast->StartTagDeclarationDefinition(sigfault_bounds_type);
- ast->AddFieldToRecordType(sigfault_bounds_type, "_addr_bnd",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->AddFieldToRecordType(
+ sigfault_bounds_type, "_addr_bnd",
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_lower", voidp_type},
{"_upper", voidp_type},
}),
- lldb::eAccessPublic, 0);
+ lldb::eAccessPublic, 0);
ast->AddFieldToRecordType(sigfault_bounds_type, "_pkey", uint_type,
lldb::eAccessPublic, 0);
ast->CompleteTagDeclarationDefinition(sigfault_bounds_type);
@@ -404,7 +405,7 @@
ast->AddFieldToRecordType(
union_type, "_kill",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"si_pid", pid_type},
{"si_uid", uid_type},
@@ -413,7 +414,7 @@
ast->AddFieldToRecordType(
union_type, "_timer",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"si_tid", int_type},
{"si_overrun", int_type},
@@ -423,7 +424,7 @@
ast->AddFieldToRecordType(
union_type, "_rt",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"si_pid", pid_type},
{"si_uid", uid_type},
@@ -433,7 +434,7 @@
ast->AddFieldToRecordType(
union_type, "_sigchld",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"si_pid", pid_type},
{"si_uid", uid_type},
@@ -445,7 +446,7 @@
ast->AddFieldToRecordType(
union_type, "_sigfault",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"si_addr", voidp_type},
{"si_addr_lsb", short_type},
@@ -455,7 +456,7 @@
ast->AddFieldToRecordType(
union_type, "_sigpoll",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"si_band", band_type},
{"si_fd", int_type},
@@ -465,7 +466,7 @@
// NB: SIGSYS is not present on ia64 but we don't seem to support that
ast->AddFieldToRecordType(
union_type, "_sigsys",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_call_addr", voidp_type},
{"_syscall", int_type},
Index: lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
===================================================================
--- lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -244,7 +244,7 @@
ast->AddFieldToRecordType(
union_type, "_fault",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_trapno", int_type},
}),
@@ -252,7 +252,7 @@
ast->AddFieldToRecordType(
union_type, "_timer",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_timerid", int_type},
{"_overrun", int_type},
@@ -261,7 +261,7 @@
ast->AddFieldToRecordType(
union_type, "_mesgq",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_mqd", int_type},
}),
@@ -269,7 +269,7 @@
ast->AddFieldToRecordType(
union_type, "_poll",
- ast->CreateStructForIdentifier(ConstString(),
+ ast->CreateStructForIdentifier(llvm::StringRef(),
{
{"_band", long_type},
}),
Index: lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -291,7 +291,7 @@
if (!ast_ctx)
return;
CompilerType tree_node_type = ast_ctx->CreateStructForIdentifier(
- ConstString(),
+ llvm::StringRef(),
{{"ptr0", ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
{"ptr1", ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
{"ptr2", ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
Index: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -338,7 +338,7 @@
// +-----------------------------+
//
CompilerType tree_node_type = ast_ctx->CreateStructForIdentifier(
- ConstString(),
+ llvm::StringRef(),
{{"ptr0",
ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
{"ptr1",
@@ -503,7 +503,7 @@
// +-----------------------------+
//
CompilerType tree_node_type = ast_ctx->CreateStructForIdentifier(
- ConstString(),
+ llvm::StringRef(),
{{"__next_",
ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType()},
{"__hash_", ast_ctx->GetBasicType(lldb::eBasicTypeUnsignedLongLong)},
Index: lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
===================================================================
--- lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp
@@ -78,10 +78,10 @@
const char *const FuncPtr_name("__FuncPtr");
m_block_struct_type = clang_ast_context->CreateStructForIdentifier(
- ConstString(), {{isa_name, isa_type},
- {flags_name, flags_type},
- {reserved_name, reserved_type},
- {FuncPtr_name, function_pointer_type}});
+ llvm::StringRef(), {{isa_name, isa_type},
+ {flags_name, flags_type},
+ {reserved_name, reserved_type},
+ {FuncPtr_name, function_pointer_type}});
}
~BlockPointerSyntheticFrontEnd() override = default;
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits