diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:58 +0000 |
commit | b76161e41bc2c07cd47f9c61f875d1be95e26d10 (patch) | |
tree | d03c19ce10dec6419f97df1d4dac9d47eb88982f /source/Plugins/ExpressionParser | |
parent | 8b4000f13b303cc154136abc74c55670673e2a96 (diff) |
Notes
Diffstat (limited to 'source/Plugins/ExpressionParser')
11 files changed, 55 insertions, 30 deletions
diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index 1f78fb96bc348..256d46a15420d 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -43,8 +43,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/Endian.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-private.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/ASTContext.h" @@ -191,7 +191,7 @@ bool ClangExpressionDeclMap::AddPersistentVariable(const NamedDecl *decl, return false; if (m_parser_vars->m_materializer && is_result) { - Error err; + Status err; ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); @@ -364,7 +364,7 @@ bool ClangExpressionDeclMap::AddValueToStruct(const NamedDecl *decl, if (m_parser_vars->m_materializer) { uint32_t offset = 0; - Error err; + Status err; if (is_persistent_variable) { ExpressionVariableSP var_sp(var->shared_from_this()); @@ -1630,7 +1630,7 @@ bool ClangExpressionDeclMap::GetVariableValue(VariableSP &var, DWARFExpression &var_location_expr = var->LocationExpression(); Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr(); - Error err; + Status err; if (var->GetLocationIsConstantValueData()) { DataExtractor const_value_extractor; @@ -1987,8 +1987,33 @@ void ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context, .GetOpaqueDeclContext(); clang::FunctionDecl *src_function_decl = llvm::dyn_cast_or_null<clang::FunctionDecl>(src_decl_context); - - if (src_function_decl) { + if (src_function_decl && + src_function_decl->getTemplateSpecializationInfo()) { + clang::FunctionTemplateDecl *function_template = + src_function_decl->getTemplateSpecializationInfo()->getTemplate(); + clang::FunctionTemplateDecl *copied_function_template = + llvm::dyn_cast_or_null<clang::FunctionTemplateDecl>( + m_ast_importer_sp->CopyDecl(m_ast_context, + src_ast->getASTContext(), + function_template)); + if (copied_function_template) { + if (log) { + ASTDumper ast_dumper((clang::Decl *)copied_function_template); + + StreamString ss; + + function->DumpSymbolContext(&ss); + + log->Printf(" CEDM::FEVD[%u] Imported decl for function template" + " %s (description %s), returned %s", + current_id, + copied_function_template->getNameAsString().c_str(), + ss.GetData(), ast_dumper.GetCString()); + } + + context.AddNamedDecl(copied_function_template); + } + } else if (src_function_decl) { if (clang::FunctionDecl *copied_function_decl = llvm::dyn_cast_or_null<clang::FunctionDecl>( m_ast_importer_sp->CopyDecl(m_ast_context, diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp index 6c923ced1ec28..4e20be79f68b7 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp @@ -756,7 +756,7 @@ static bool FindFunctionInModule(ConstString &mangled_name, return false; } -lldb_private::Error ClangExpressionParser::PrepareForExecution( +lldb_private::Status ClangExpressionParser::PrepareForExecution( lldb::addr_t &func_addr, lldb::addr_t &func_end, lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, ExecutionPolicy execution_policy) { @@ -764,7 +764,7 @@ lldb_private::Error ClangExpressionParser::PrepareForExecution( func_end = LLDB_INVALID_ADDRESS; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - lldb_private::Error err; + lldb_private::Status err; std::unique_ptr<llvm::Module> llvm_module_ap( m_code_generator->ReleaseModule()); @@ -857,7 +857,7 @@ lldb_private::Error ClangExpressionParser::PrepareForExecution( if (execution_policy != eExecutionPolicyAlways && execution_policy != eExecutionPolicyTopLevel) { - lldb_private::Error interpret_error; + lldb_private::Status interpret_error; bool interpret_function_calls = !process ? false : process->CanInterpretFunctionCalls(); @@ -941,9 +941,9 @@ lldb_private::Error ClangExpressionParser::PrepareForExecution( return err; } -lldb_private::Error ClangExpressionParser::RunStaticInitializers( +lldb_private::Status ClangExpressionParser::RunStaticInitializers( lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx) { - lldb_private::Error err; + lldb_private::Status err; lldbassert(execution_unit_sp.get()); lldbassert(exe_ctx.HasThreadScope()); diff --git a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h index f0203f36e59bd..3e6a109a4af38 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h +++ b/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h @@ -14,7 +14,7 @@ #include "lldb/Core/ClangForward.h" #include "lldb/Expression/DiagnosticManager.h" #include "lldb/Expression/ExpressionParser.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/lldb-public.h" #include <string> @@ -110,7 +110,7 @@ public: /// An error code indicating the success or failure of the operation. /// Test with Success(). //------------------------------------------------------------------ - Error + Status PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end, lldb::IRExecutionUnitSP &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, @@ -128,8 +128,8 @@ public: /// @return /// The error code indicating the //------------------------------------------------------------------ - Error RunStaticInitializers(lldb::IRExecutionUnitSP &execution_unit_sp, - ExecutionContext &exe_ctx); + Status RunStaticInitializers(lldb::IRExecutionUnitSP &execution_unit_sp, + ExecutionContext &exe_ctx); //------------------------------------------------------------------ /// Returns a string representing current ABI. diff --git a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp index 95d81db12801a..2a6261a6df4d4 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp +++ b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp @@ -83,7 +83,7 @@ ClangUserExpression::ClangUserExpression( ClangUserExpression::~ClangUserExpression() {} -void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Error &err) { +void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); if (log) @@ -315,7 +315,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, bool generate_debug_info) { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); - Error err; + Status err; InstallContext(exe_ctx); @@ -501,7 +501,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, // { - Error jit_error = parser.PrepareForExecution( + Status jit_error = parser.PrepareForExecution( m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx, m_can_interpret, execution_policy); @@ -517,7 +517,7 @@ bool ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, } if (exe_ctx.GetProcessPtr() && execution_policy == eExecutionPolicyTopLevel) { - Error static_init_error = + Status static_init_error = parser.RunStaticInitializers(m_execution_unit_sp, exe_ctx); if (!static_init_error.Success()) { @@ -603,7 +603,7 @@ bool ClangUserExpression::AddArguments(ExecutionContext &exe_ctx, return false; } - Error object_ptr_error; + Status object_ptr_error; object_ptr = GetObjectPointer(frame_sp, object_name, object_ptr_error); diff --git a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h index 155c153b873ce..88a78798b6572 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h +++ b/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h @@ -168,7 +168,7 @@ private: //------------------------------------------------------------------ void ScanContext(ExecutionContext &exe_ctx, - lldb_private::Error &err) override; + lldb_private::Status &err) override; bool AddArguments(ExecutionContext &exe_ctx, std::vector<lldb::addr_t> &args, lldb::addr_t struct_address, diff --git a/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp b/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp index a54ab4a2267a6..065e5db4c9f84 100644 --- a/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp +++ b/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp @@ -118,7 +118,7 @@ bool ClangUtilityFunction::Install(DiagnosticManager &diagnostic_manager, bool can_interpret = false; // should stay that way - Error jit_error = parser.PrepareForExecution( + Status jit_error = parser.PrepareForExecution( m_jit_start_addr, m_jit_end_addr, m_execution_unit_sp, exe_ctx, can_interpret, eExecutionPolicyAlways); diff --git a/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp b/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp index 68a214ee46837..13f5657eedd84 100644 --- a/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp +++ b/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp @@ -1263,7 +1263,7 @@ bool IRForTarget::MaterializeInitializer(uint8_t *data, Constant *initializer) { lldb_private::Scalar scalar = int_initializer->getValue().zextOrTrunc( llvm::NextPowerOf2(constant_size) * 8); - lldb_private::Error get_data_error; + lldb_private::Status get_data_error; if (!scalar.GetAsMemoryData(data, constant_size, lldb_private::endian::InlHostByteOrder(), get_data_error)) diff --git a/source/Plugins/ExpressionParser/Clang/IRForTarget.h b/source/Plugins/ExpressionParser/Clang/IRForTarget.h index eb52730f3a870..93ce8aa44eb28 100644 --- a/source/Plugins/ExpressionParser/Clang/IRForTarget.h +++ b/source/Plugins/ExpressionParser/Clang/IRForTarget.h @@ -13,7 +13,7 @@ #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Utility/ConstString.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-public.h" diff --git a/source/Plugins/ExpressionParser/Go/GoParser.cpp b/source/Plugins/ExpressionParser/Go/GoParser.cpp index 0bae4a4574d95..538bd05e25f8d 100644 --- a/source/Plugins/ExpressionParser/Go/GoParser.cpp +++ b/source/Plugins/ExpressionParser/Go/GoParser.cpp @@ -12,7 +12,7 @@ #include "GoParser.h" #include "Plugins/ExpressionParser/Go/GoAST.h" -#include "lldb/Utility/Error.h" +#include "lldb/Utility/Status.h" #include "llvm/ADT/SmallString.h" using namespace lldb_private; @@ -860,7 +860,7 @@ llvm::StringRef GoParser::CopyString(llvm::StringRef s) { return m_strings.insert(std::make_pair(s, 'x')).first->getKey(); } -void GoParser::GetError(Error &error) { +void GoParser::GetError(Status &error) { llvm::StringRef want; if (m_failed) want = diff --git a/source/Plugins/ExpressionParser/Go/GoParser.h b/source/Plugins/ExpressionParser/Go/GoParser.h index bd12855802287..9ed2ae2033bd4 100644 --- a/source/Plugins/ExpressionParser/Go/GoParser.h +++ b/source/Plugins/ExpressionParser/Go/GoParser.h @@ -82,7 +82,7 @@ public: return m_lexer.BytesRemaining() == 0 && m_pos == m_tokens.size(); } - void GetError(Error &error); + void GetError(Status &error); private: class Rule; diff --git a/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 50d45a1ad1e79..f4b8cfbe03d47 100644 --- a/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -150,7 +150,7 @@ public: CompilerType EvaluateType(const GoASTExpr *e); - Error &error() { return m_error; } + Status &error() { return m_error; } private: std::nullptr_t NotImplemented(const GoASTExpr *e) { @@ -163,7 +163,7 @@ private: lldb::StackFrameSP m_frame; GoParser m_parser; DynamicValueType m_use_dynamic; - Error m_error; + Status m_error; llvm::StringRef m_package; std::vector<std::unique_ptr<GoASTStmt>> m_statements; }; @@ -254,7 +254,7 @@ GoUserExpression::DoExecute(DiagnosticManager &diagnostic_manager, m_interpreter->set_use_dynamic(options.GetUseDynamic()); ValueObjectSP result_val_sp = m_interpreter->Evaluate(exe_ctx); - Error err = m_interpreter->error(); + Status err = m_interpreter->error(); m_interpreter.reset(); if (!result_val_sp) { |