[lldb] Fix missing initialization in UtilityFunction ctor (NFC)
The UtilityFunction ctor was dropping the text argument. Probably for that reason ClangUtilityFunction was setting the parent's member directly instead of deferring to the parent ctor. Also change the signatures to take strings which are std::moved in place.
This commit is contained in:
parent
7975b8c38d
commit
a00acbab45
|
@ -42,8 +42,8 @@ public:
|
|||
///
|
||||
/// \param[in] name
|
||||
/// The name of the function, as used in the text.
|
||||
UtilityFunction(ExecutionContextScope &exe_scope, const char *text,
|
||||
const char *name);
|
||||
UtilityFunction(ExecutionContextScope &exe_scope, std::string text,
|
||||
std::string name);
|
||||
|
||||
~UtilityFunction() override;
|
||||
|
||||
|
@ -110,9 +110,10 @@ public:
|
|||
protected:
|
||||
std::shared_ptr<IRExecutionUnit> m_execution_unit_sp;
|
||||
lldb::ModuleWP m_jit_module_wp;
|
||||
std::string m_function_text; ///< The text of the function. Must be a
|
||||
///well-formed translation unit.
|
||||
std::string m_function_name; ///< The name of the function.
|
||||
/// The text of the function. Must be a well-formed translation unit.
|
||||
std::string m_function_text;
|
||||
/// The name of the function.
|
||||
std::string m_function_name;
|
||||
std::unique_ptr<FunctionCaller> m_caller_up;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ char UtilityFunction::ID;
|
|||
/// \param[in] name
|
||||
/// The name of the function, as used in the text.
|
||||
UtilityFunction::UtilityFunction(ExecutionContextScope &exe_scope,
|
||||
const char *text, const char *name)
|
||||
std::string text, std::string name)
|
||||
: Expression(exe_scope), m_execution_unit_sp(), m_jit_module_wp(),
|
||||
m_function_text(), m_function_name(name) {}
|
||||
m_function_text(std::move(text)), m_function_name(std::move(name)) {}
|
||||
|
||||
UtilityFunction::~UtilityFunction() {
|
||||
lldb::ProcessSP process_sp(m_jit_process_wp.lock());
|
||||
|
|
|
@ -42,11 +42,9 @@ char ClangUtilityFunction::ID;
|
|||
/// \param[in] name
|
||||
/// The name of the function, as used in the text.
|
||||
ClangUtilityFunction::ClangUtilityFunction(ExecutionContextScope &exe_scope,
|
||||
const char *text, const char *name)
|
||||
: UtilityFunction(exe_scope, text, name) {
|
||||
std::string text, std::string name)
|
||||
: UtilityFunction(exe_scope, std::move(text), std::move(name)) {
|
||||
m_function_text.assign(ClangExpressionSourceCode::g_expression_prefix);
|
||||
if (text && text[0])
|
||||
m_function_text.append(text);
|
||||
}
|
||||
|
||||
ClangUtilityFunction::~ClangUtilityFunction() {}
|
||||
|
|
|
@ -41,36 +41,6 @@ public:
|
|||
}
|
||||
static bool classof(const Expression *obj) { return obj->isA(&ID); }
|
||||
|
||||
class ClangUtilityFunctionHelper : public ClangExpressionHelper {
|
||||
public:
|
||||
ClangUtilityFunctionHelper() {}
|
||||
|
||||
~ClangUtilityFunctionHelper() override {}
|
||||
|
||||
/// Return the object that the parser should use when resolving external
|
||||
/// values. May be NULL if everything should be self-contained.
|
||||
ClangExpressionDeclMap *DeclMap() override {
|
||||
return m_expr_decl_map_up.get();
|
||||
}
|
||||
|
||||
void ResetDeclMap() { m_expr_decl_map_up.reset(); }
|
||||
|
||||
void ResetDeclMap(ExecutionContext &exe_ctx, bool keep_result_in_memory);
|
||||
|
||||
/// Return the object that the parser should allow to access ASTs. May be
|
||||
/// NULL if the ASTs do not need to be transformed.
|
||||
///
|
||||
/// \param[in] passthrough
|
||||
/// The ASTConsumer that the returned transformer should send
|
||||
/// the ASTs to after transformation.
|
||||
clang::ASTConsumer *
|
||||
ASTTransformer(clang::ASTConsumer *passthrough) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map_up;
|
||||
};
|
||||
/// Constructor
|
||||
///
|
||||
/// \param[in] text
|
||||
|
@ -78,8 +48,8 @@ public:
|
|||
///
|
||||
/// \param[in] name
|
||||
/// The name of the function, as used in the text.
|
||||
ClangUtilityFunction(ExecutionContextScope &exe_scope, const char *text,
|
||||
const char *name);
|
||||
ClangUtilityFunction(ExecutionContextScope &exe_scope, std::string text,
|
||||
std::string name);
|
||||
|
||||
~ClangUtilityFunction() override;
|
||||
|
||||
|
@ -99,9 +69,39 @@ public:
|
|||
ExecutionContext &exe_ctx) override;
|
||||
|
||||
private:
|
||||
ClangUtilityFunctionHelper m_type_system_helper; ///< The map to use when
|
||||
///parsing and materializing
|
||||
///the expression.
|
||||
class ClangUtilityFunctionHelper : public ClangExpressionHelper {
|
||||
public:
|
||||
ClangUtilityFunctionHelper() {}
|
||||
|
||||
~ClangUtilityFunctionHelper() override {}
|
||||
|
||||
/// Return the object that the parser should use when resolving external
|
||||
/// values. May be NULL if everything should be self-contained.
|
||||
ClangExpressionDeclMap *DeclMap() override {
|
||||
return m_expr_decl_map_up.get();
|
||||
}
|
||||
|
||||
void ResetDeclMap() { m_expr_decl_map_up.reset(); }
|
||||
|
||||
void ResetDeclMap(ExecutionContext &exe_ctx, bool keep_result_in_memory);
|
||||
|
||||
/// Return the object that the parser should allow to access ASTs. May be
|
||||
/// nullptr if the ASTs do not need to be transformed.
|
||||
///
|
||||
/// \param[in] passthrough
|
||||
/// The ASTConsumer that the returned transformer should send
|
||||
/// the ASTs to after transformation.
|
||||
clang::ASTConsumer *
|
||||
ASTTransformer(clang::ASTConsumer *passthrough) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map_up;
|
||||
};
|
||||
|
||||
/// The map to use when parsing and materializing the expression.
|
||||
ClangUtilityFunctionHelper m_type_system_helper;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
|
Loading…
Reference in New Issue