summaryrefslogtreecommitdiff
path: root/source/Symbol
diff options
context:
space:
mode:
Diffstat (limited to 'source/Symbol')
-rw-r--r--source/Symbol/ClangASTContext.cpp67
-rw-r--r--source/Symbol/CompactUnwindInfo.cpp6
-rw-r--r--source/Symbol/CompilerType.cpp4
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp3
-rw-r--r--source/Symbol/JavaASTContext.cpp4
-rw-r--r--source/Symbol/ObjectFile.cpp25
-rw-r--r--source/Symbol/SymbolContext.cpp2
-rw-r--r--source/Symbol/Symtab.cpp24
-rw-r--r--source/Symbol/Type.cpp2
-rw-r--r--source/Symbol/Variable.cpp8
10 files changed, 96 insertions, 49 deletions
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index 8e2576aaec956..94c91fe335a75 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -1394,6 +1394,12 @@ CompilerType ClangASTContext::CreateRecordType(DeclContext *decl_ctx,
return CompilerType();
}
+namespace {
+ bool IsValueParam(const clang::TemplateArgument &argument) {
+ return argument.getKind() == TemplateArgument::Integral;
+ }
+}
+
static TemplateParameterList *CreateTemplateParameterList(
ASTContext *ast,
const ClangASTContext::TemplateParameterInfos &template_param_infos,
@@ -1401,31 +1407,51 @@ static TemplateParameterList *CreateTemplateParameterList(
const bool parameter_pack = false;
const bool is_typename = false;
const unsigned depth = 0;
- const size_t num_template_params = template_param_infos.GetSize();
+ const size_t num_template_params = template_param_infos.args.size();
+ DeclContext *const decl_context =
+ ast->getTranslationUnitDecl(); // Is this the right decl context?,
for (size_t i = 0; i < num_template_params; ++i) {
const char *name = template_param_infos.names[i];
IdentifierInfo *identifier_info = nullptr;
if (name && name[0])
identifier_info = &ast->Idents.get(name);
- if (template_param_infos.args[i].getKind() == TemplateArgument::Integral) {
+ if (IsValueParam(template_param_infos.args[i])) {
template_param_decls.push_back(NonTypeTemplateParmDecl::Create(
- *ast,
- ast->getTranslationUnitDecl(), // Is this the right decl context?,
- // SourceLocation StartLoc,
+ *ast, decl_context,
SourceLocation(), SourceLocation(), depth, i, identifier_info,
template_param_infos.args[i].getIntegralType(), parameter_pack,
nullptr));
} else {
template_param_decls.push_back(TemplateTypeParmDecl::Create(
- *ast,
- ast->getTranslationUnitDecl(), // Is this the right decl context?
+ *ast, decl_context,
SourceLocation(), SourceLocation(), depth, i, identifier_info,
is_typename, parameter_pack));
}
}
-
+
+ if (template_param_infos.packed_args &&
+ template_param_infos.packed_args->args.size()) {
+ IdentifierInfo *identifier_info = nullptr;
+ if (template_param_infos.pack_name && template_param_infos.pack_name[0])
+ identifier_info = &ast->Idents.get(template_param_infos.pack_name);
+ const bool parameter_pack_true = true;
+ if (IsValueParam(template_param_infos.packed_args->args[0])) {
+ template_param_decls.push_back(NonTypeTemplateParmDecl::Create(
+ *ast, decl_context,
+ SourceLocation(), SourceLocation(), depth, num_template_params,
+ identifier_info,
+ template_param_infos.packed_args->args[0].getIntegralType(),
+ parameter_pack_true, nullptr));
+ } else {
+ template_param_decls.push_back(TemplateTypeParmDecl::Create(
+ *ast, decl_context,
+ SourceLocation(), SourceLocation(), depth, num_template_params,
+ identifier_info,
+ is_typename, parameter_pack_true));
+ }
+ }
clang::Expr *const requires_clause = nullptr; // TODO: Concepts
TemplateParameterList *template_param_list = TemplateParameterList::Create(
*ast, SourceLocation(), SourceLocation(), template_param_decls,
@@ -1535,10 +1561,19 @@ ClangASTContext::CreateClassTemplateSpecializationDecl(
DeclContext *decl_ctx, ClassTemplateDecl *class_template_decl, int kind,
const TemplateParameterInfos &template_param_infos) {
ASTContext *ast = getASTContext();
+ llvm::SmallVector<clang::TemplateArgument, 2> args(
+ template_param_infos.args.size() +
+ (template_param_infos.packed_args ? 1 : 0));
+ std::copy(template_param_infos.args.begin(), template_param_infos.args.end(),
+ args.begin());
+ if (template_param_infos.packed_args) {
+ args[args.size() - 1] = TemplateArgument::CreatePackCopy(
+ *ast, template_param_infos.packed_args->args);
+ }
ClassTemplateSpecializationDecl *class_template_specialization_decl =
ClassTemplateSpecializationDecl::Create(
*ast, (TagDecl::TagKind)kind, decl_ctx, SourceLocation(),
- SourceLocation(), class_template_decl, template_param_infos.args,
+ SourceLocation(), class_template_decl, args,
nullptr);
class_template_specialization_decl->setSpecializationKind(
@@ -4458,7 +4493,7 @@ ClangASTContext::GetNumMemberFunctions(lldb::opaque_compiler_type_t type) {
case clang::Type::ObjCObjectPointer: {
const clang::ObjCObjectPointerType *objc_class_type =
- qual_type->getAsObjCInterfacePointerType();
+ qual_type->getAs<clang::ObjCObjectPointerType>();
const clang::ObjCInterfaceType *objc_interface_type =
objc_class_type->getInterfaceType();
if (objc_interface_type &&
@@ -4567,7 +4602,7 @@ ClangASTContext::GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
case clang::Type::ObjCObjectPointer: {
const clang::ObjCObjectPointerType *objc_class_type =
- qual_type->getAsObjCInterfacePointerType();
+ qual_type->getAs<clang::ObjCObjectPointerType>();
const clang::ObjCInterfaceType *objc_interface_type =
objc_class_type->getInterfaceType();
if (objc_interface_type &&
@@ -5636,7 +5671,7 @@ uint32_t ClangASTContext::GetNumFields(lldb::opaque_compiler_type_t type) {
case clang::Type::ObjCObjectPointer: {
const clang::ObjCObjectPointerType *objc_class_type =
- qual_type->getAsObjCInterfacePointerType();
+ qual_type->getAs<clang::ObjCObjectPointerType>();
const clang::ObjCInterfaceType *objc_interface_type =
objc_class_type->getInterfaceType();
if (objc_interface_type &&
@@ -5784,7 +5819,7 @@ CompilerType ClangASTContext::GetFieldAtIndex(lldb::opaque_compiler_type_t type,
case clang::Type::ObjCObjectPointer: {
const clang::ObjCObjectPointerType *objc_class_type =
- qual_type->getAsObjCInterfacePointerType();
+ qual_type->getAs<clang::ObjCObjectPointerType>();
const clang::ObjCInterfaceType *objc_interface_type =
objc_class_type->getInterfaceType();
if (objc_interface_type &&
@@ -6398,7 +6433,7 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex(
if (base_class->isVirtual()) {
bool handled = false;
if (valobj) {
- Error err;
+ Status err;
AddressType addr_type = eAddressTypeInvalid;
lldb::addr_t vtable_ptr_addr =
valobj->GetCPPVTableAddress(addr_type);
@@ -8792,7 +8827,7 @@ ClangASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
if (dst_size >= byte_size) {
Scalar scalar = ap_float.bitcastToAPInt().zextOrTrunc(
llvm::NextPowerOf2(byte_size) * 8);
- lldb_private::Error get_data_error;
+ lldb_private::Status get_data_error;
if (scalar.GetAsMemoryData(dst, byte_size,
lldb_private::endian::InlHostByteOrder(),
get_data_error))
@@ -9361,7 +9396,7 @@ void ClangASTContext::DumpSummary(lldb::opaque_compiler_type_t type,
buf.back() = '\0';
size_t bytes_read;
size_t total_cstr_len = 0;
- Error error;
+ Status error;
while ((bytes_read = process->ReadMemory(pointer_address, &buf.front(),
buf.size(), error)) > 0) {
const size_t len = strlen((const char *)&buf.front());
diff --git a/source/Symbol/CompactUnwindInfo.cpp b/source/Symbol/CompactUnwindInfo.cpp
index 77fcd33bbb3b0..bc367496003e8 100644
--- a/source/Symbol/CompactUnwindInfo.cpp
+++ b/source/Symbol/CompactUnwindInfo.cpp
@@ -272,7 +272,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) {
return;
m_section_contents_if_encrypted.reset(
new DataBufferHeap(m_section_sp->GetByteSize(), 0));
- Error error;
+ Status error;
if (process_sp->ReadMemory(
m_section_sp->GetLoadBaseAddress(&process_sp->GetTarget()),
m_section_contents_if_encrypted->GetBytes(),
@@ -836,7 +836,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target,
if (process_sp) {
Address subl_payload_addr(function_info.valid_range_offset_start, sl);
subl_payload_addr.Slide(offset_to_subl_insn);
- Error error;
+ Status error;
uint64_t large_stack_size = process_sp->ReadUnsignedIntegerFromMemory(
subl_payload_addr.GetLoadAddress(&target), 4, 0, error);
if (large_stack_size != 0 && error.Success()) {
@@ -1100,7 +1100,7 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target,
if (process_sp) {
Address subl_payload_addr(function_info.valid_range_offset_start, sl);
subl_payload_addr.Slide(offset_to_subl_insn);
- Error error;
+ Status error;
uint64_t large_stack_size = process_sp->ReadUnsignedIntegerFromMemory(
subl_payload_addr.GetLoadAddress(&target), 4, 0, error);
if (large_stack_size != 0 && error.Success()) {
diff --git a/source/Symbol/CompilerType.cpp b/source/Symbol/CompilerType.cpp
index cc33dc196226e..e3880af27f22e 100644
--- a/source/Symbol/CompilerType.cpp
+++ b/source/Symbol/CompilerType.cpp
@@ -1004,7 +1004,7 @@ bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx,
if (exe_ctx)
process = exe_ctx->GetProcessPtr();
if (process) {
- Error error;
+ Status error;
return process->ReadMemory(addr, dst, byte_size, error) == byte_size;
}
}
@@ -1039,7 +1039,7 @@ bool CompilerType::WriteToMemory(lldb_private::ExecutionContext *exe_ctx,
if (exe_ctx)
process = exe_ctx->GetProcessPtr();
if (process) {
- Error error;
+ Status error;
return process->WriteMemory(addr, new_value.GetData(), byte_size,
error) == byte_size;
}
diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp
index d229e880d97df..015ecd856aa84 100644
--- a/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/source/Symbol/DWARFCallFrameInfo.cpp
@@ -419,7 +419,8 @@ void DWARFCallFrameInfo::GetFDEIndex() {
if (m_fde_index_initialized) // if two threads hit the locker
return;
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s - %s", LLVM_PRETTY_FUNCTION,
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s - %s", LLVM_PRETTY_FUNCTION,
m_objfile.GetFileSpec().GetFilename().AsCString(""));
bool clear_address_zeroth_bit = false;
diff --git a/source/Symbol/JavaASTContext.cpp b/source/Symbol/JavaASTContext.cpp
index ac029dfe5dc85..ae4e9d5134b56 100644
--- a/source/Symbol/JavaASTContext.cpp
+++ b/source/Symbol/JavaASTContext.cpp
@@ -137,7 +137,7 @@ public:
if (m_dynamic_type_id.Evaluate(exe_ctx->GetBestExecutionContextScope(),
nullptr, nullptr, 0, &obj_load_address,
nullptr, result, nullptr)) {
- Error error;
+ Status error;
lldb::addr_t type_id_addr = result.GetScalar().UInt();
lldb::ProcessSP process_sp = exe_ctx->GetProcessSP();
@@ -303,7 +303,7 @@ public:
if (!m_length_expression.IsValid())
return UINT32_MAX;
- Error error;
+ Status error;
ValueObjectSP address_obj = value_obj->AddressOf(error);
if (error.Fail())
return UINT32_MAX;
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index 483a315defbd4..c970de6fef063 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -37,8 +37,9 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
ObjectFileSP object_file_sp;
if (module_sp) {
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
Timer scoped_timer(
- LLVM_PRETTY_FUNCTION,
+ func_cat,
"ObjectFile::FindPlugin (module = %s, file = %p, file_offset = "
"0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
module_sp->GetFileSpec().GetPath().c_str(),
@@ -176,9 +177,11 @@ ObjectFileSP ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp,
ObjectFileSP object_file_sp;
if (module_sp) {
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "ObjectFile::FindPlugin (module = "
- "%s, process = %p, header_addr = "
- "0x%" PRIx64 ")",
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat,
+ "ObjectFile::FindPlugin (module = "
+ "%s, process = %p, header_addr = "
+ "0x%" PRIx64 ")",
module_sp->GetFileSpec().GetPath().c_str(),
static_cast<void *>(process_sp.get()), header_addr);
uint32_t idx;
@@ -454,7 +457,7 @@ DataBufferSP ObjectFile::ReadMemory(const ProcessSP &process_sp,
DataBufferSP data_sp;
if (process_sp) {
std::unique_ptr<DataBufferHeap> data_ap(new DataBufferHeap(byte_size, 0));
- Error error;
+ Status error;
const size_t bytes_read = process_sp->ReadMemory(
addr, data_ap->GetBytes(), data_ap->GetByteSize(), error);
if (bytes_read == byte_size)
@@ -493,7 +496,7 @@ size_t ObjectFile::ReadSectionData(const Section *section,
if (IsInMemory()) {
ProcessSP process_sp(m_process_wp.lock());
if (process_sp) {
- Error error;
+ Status error;
const addr_t base_load_addr =
section->GetLoadBaseAddress(&process_sp->GetTarget());
if (base_load_addr != LLDB_INVALID_ADDRESS)
@@ -654,17 +657,17 @@ ConstString ObjectFile::GetNextSyntheticSymbolName() {
return ConstString(ss.GetString());
}
-Error ObjectFile::LoadInMemory(Target &target, bool set_pc) {
- Error error;
+Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
+ Status error;
ProcessSP process = target.CalculateProcess();
if (!process)
- return Error("No Process");
+ return Status("No Process");
if (set_pc && !GetEntryPointAddress().IsValid())
- return Error("No entry address in object file");
+ return Status("No entry address in object file");
SectionList *section_list = GetSectionList();
if (!section_list)
- return Error("No section in object file");
+ return Status("No section in object file");
size_t section_count = section_list->GetNumSections(0);
for (size_t i = 0; i < section_count; ++i) {
SectionSP section_sp = section_list->GetSectionAtIndex(i);
diff --git a/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp
index d99bfc609261d..5ea6f91200c17 100644
--- a/source/Symbol/SymbolContext.cpp
+++ b/source/Symbol/SymbolContext.cpp
@@ -735,7 +735,7 @@ LineEntry SymbolContext::GetFunctionStartLineEntry() const {
bool SymbolContext::GetAddressRangeFromHereToEndLine(uint32_t end_line,
AddressRange &range,
- Error &error) {
+ Status &error) {
if (!line_entry.IsValid()) {
error.SetErrorString("Symbol context has no line table.");
return false;
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index e0710aa4e6b9e..3eec3e7061850 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -220,7 +220,8 @@ void Symtab::InitNameIndexes() {
// Protected function, no need to lock mutex...
if (!m_name_indexes_computed) {
m_name_indexes_computed = true;
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
// Create the name index vector to be able to quickly search by name
const size_t num_symbols = m_symbols.size();
#if 1
@@ -433,7 +434,8 @@ void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
bool add_demangled, bool add_mangled,
NameToIndexMap &name_to_index_map) const {
if (add_demangled || add_mangled) {
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
std::lock_guard<std::recursive_mutex> guard(m_mutex);
// Create the name index vector to be able to quickly search by name
@@ -595,7 +597,8 @@ void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
bool remove_duplicates) const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
// No need to sort if we have zero or one items...
if (indexes.size() <= 1)
return;
@@ -621,7 +624,8 @@ uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name,
std::vector<uint32_t> &indexes) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
if (symbol_name) {
if (!m_name_indexes_computed)
InitNameIndexes();
@@ -637,7 +641,8 @@ uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name,
std::vector<uint32_t> &indexes) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
if (symbol_name) {
const size_t old_size = indexes.size();
if (!m_name_indexes_computed)
@@ -766,7 +771,8 @@ Symtab::FindAllSymbolsWithNameAndType(const ConstString &name,
std::vector<uint32_t> &symbol_indexes) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
// Initialize all of the lookup by name indexes before converting NAME
// to a uniqued string NAME_STR below.
if (!m_name_indexes_computed)
@@ -785,7 +791,8 @@ size_t Symtab::FindAllSymbolsWithNameAndType(
Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
// Initialize all of the lookup by name indexes before converting NAME
// to a uniqued string NAME_STR below.
if (!m_name_indexes_computed)
@@ -817,7 +824,8 @@ Symbol *Symtab::FindFirstSymbolWithNameAndType(const ConstString &name,
Visibility symbol_visibility) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
- Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
+ static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+ Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
if (!m_name_indexes_computed)
InitNameIndexes();
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 89fc9f974c679..53d9c5cc96a92 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -410,7 +410,7 @@ bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
if (exe_ctx) {
Process *process = exe_ctx->GetProcessPtr();
if (process) {
- Error error;
+ Status error;
return exe_ctx->GetProcessPtr()->ReadMemory(addr, dst, byte_size,
error) == byte_size;
}
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index 0d1db1cdeac0b..fd19a09949663 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -330,11 +330,11 @@ bool Variable::IsInScope(StackFrame *frame) {
return false;
}
-Error Variable::GetValuesForVariableExpressionPath(
+Status Variable::GetValuesForVariableExpressionPath(
llvm::StringRef variable_expr_path, ExecutionContextScope *scope,
GetVariableCallback callback, void *baton, VariableList &variable_list,
ValueObjectList &valobj_list) {
- Error error;
+ Status error;
if (!callback || variable_expr_path.empty()) {
error.SetErrorString("unknown error");
return error;
@@ -350,7 +350,7 @@ Error Variable::GetValuesForVariableExpressionPath(
return error;
}
for (uint32_t i = 0; i < valobj_list.GetSize();) {
- Error tmp_error;
+ Status tmp_error;
ValueObjectSP valobj_sp(
valobj_list.GetValueObjectAtIndex(i)->Dereference(tmp_error));
if (tmp_error.Fail()) {
@@ -368,7 +368,7 @@ Error Variable::GetValuesForVariableExpressionPath(
valobj_list);
if (error.Success()) {
for (uint32_t i = 0; i < valobj_list.GetSize();) {
- Error tmp_error;
+ Status tmp_error;
ValueObjectSP valobj_sp(
valobj_list.GetValueObjectAtIndex(i)->AddressOf(tmp_error));
if (tmp_error.Fail()) {