diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
commit | 5f29bb8a675e8f96452b632e7129113f7dec850e (patch) | |
tree | 3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /source/Symbol/Function.cpp | |
parent | 88c643b6fec27eec436c8d138fee6346e92337d6 (diff) |
Notes
Diffstat (limited to 'source/Symbol/Function.cpp')
-rw-r--r-- | source/Symbol/Function.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source/Symbol/Function.cpp b/source/Symbol/Function.cpp index f792a5c5213e7..951392c1f1bff 100644 --- a/source/Symbol/Function.cpp +++ b/source/Symbol/Function.cpp @@ -1,9 +1,8 @@ //===-- Function.cpp --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -25,14 +24,12 @@ using namespace lldb; using namespace lldb_private; -//---------------------------------------------------------------------- // Basic function information is contained in the FunctionInfo class. It is // designed to contain the name, linkage name, and declaration location. -//---------------------------------------------------------------------- FunctionInfo::FunctionInfo(const char *name, const Declaration *decl_ptr) : m_name(name), m_declaration(decl_ptr) {} -FunctionInfo::FunctionInfo(const ConstString &name, const Declaration *decl_ptr) +FunctionInfo::FunctionInfo(ConstString name, const Declaration *decl_ptr) : m_name(name), m_declaration(decl_ptr) {} FunctionInfo::~FunctionInfo() {} @@ -69,7 +66,7 @@ InlineFunctionInfo::InlineFunctionInfo(const char *name, const char *mangled, : FunctionInfo(name, decl_ptr), m_mangled(ConstString(mangled), true), m_call_decl(call_decl_ptr) {} -InlineFunctionInfo::InlineFunctionInfo(const ConstString &name, +InlineFunctionInfo::InlineFunctionInfo(ConstString name, const Mangled &mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr) @@ -130,9 +127,7 @@ size_t InlineFunctionInfo::MemorySize() const { return FunctionInfo::MemorySize() + m_mangled.MemorySize(); } -//---------------------------------------------------------------------- // -//---------------------------------------------------------------------- CallEdge::CallEdge(const char *symbol_name, lldb::addr_t return_pc) : return_pc(return_pc), resolved(false) { lazy_callee.symbol_name = symbol_name; @@ -183,15 +178,13 @@ lldb::addr_t CallEdge::GetReturnPCAddress(Function &caller, return base.GetLoadAddress(&target) + return_pc; } -//---------------------------------------------------------------------- // -//---------------------------------------------------------------------- Function::Function(CompileUnit *comp_unit, lldb::user_id_t func_uid, lldb::user_id_t type_uid, const Mangled &mangled, Type *type, const AddressRange &range) : UserID(func_uid), m_comp_unit(comp_unit), m_type_uid(type_uid), m_type(type), m_mangled(mangled), m_block(func_uid), m_range(range), - m_frame_base(nullptr), m_flags(), m_prologue_byte_size(0) { + m_frame_base(), m_flags(), m_prologue_byte_size(0) { m_block.SetParentScope(this); assert(comp_unit != nullptr); } @@ -553,7 +546,7 @@ uint32_t Function::GetPrologueByteSize() { // Now calculate the offset to pass the subsequent line 0 entries. uint32_t first_non_zero_line = prologue_end_line_idx; - while (1) { + while (true) { LineEntry line_entry; if (line_table->GetLineEntryAtIndex(first_non_zero_line, line_entry)) { @@ -596,10 +589,14 @@ uint32_t Function::GetPrologueByteSize() { } lldb::LanguageType Function::GetLanguage() const { + lldb::LanguageType lang = m_mangled.GuessLanguage(); + if (lang != lldb::eLanguageTypeUnknown) + return lang; + if (m_comp_unit) return m_comp_unit->GetLanguage(); - else - return lldb::eLanguageTypeUnknown; + + return lldb::eLanguageTypeUnknown; } ConstString Function::GetName() const { |