summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Expression/IRDynamicChecks.h7
-rw-r--r--lldb/source/Expression/IRDynamicChecks.cpp29
2 files changed, 18 insertions, 18 deletions
diff --git a/lldb/include/lldb/Expression/IRDynamicChecks.h b/lldb/include/lldb/Expression/IRDynamicChecks.h
index 26f1cdb83c0..0e667394dae 100644
--- a/lldb/include/lldb/Expression/IRDynamicChecks.h
+++ b/lldb/include/lldb/Expression/IRDynamicChecks.h
@@ -1,5 +1,4 @@
-//===-- IRDynamicChecks.h ---------------------------------------------*- C++
-//-*-===//
+//===-- IRDynamicChecks.h ---------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -68,8 +67,8 @@ public:
bool DoCheckersExplainStop(lldb::addr_t addr, Stream &message);
- std::unique_ptr<UtilityFunction> m_valid_pointer_check;
- std::unique_ptr<UtilityFunction> m_objc_object_check;
+ std::shared_ptr<UtilityFunction> m_valid_pointer_check;
+ std::shared_ptr<UtilityFunction> m_objc_object_check;
};
/// \class IRDynamicChecks IRDynamicChecks.h
diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp
index f66dec2e788..2e7b76b3240 100644
--- a/lldb/source/Expression/IRDynamicChecks.cpp
+++ b/lldb/source/Expression/IRDynamicChecks.cpp
@@ -134,8 +134,9 @@ public:
///
/// \param[in] module
/// The module being instrumented.
- Instrumenter(llvm::Module &module, DynamicCheckerFunctions &checker_functions)
- : m_module(module), m_checker_functions(checker_functions),
+ Instrumenter(llvm::Module &module,
+ std::shared_ptr<UtilityFunction> checker_function)
+ : m_module(module), m_checker_function(checker_function),
m_i8ptr_ty(nullptr), m_intptr_ty(nullptr) {}
virtual ~Instrumenter() = default;
@@ -296,8 +297,8 @@ protected:
InstVector m_to_instrument; ///< List of instructions the inspector found
llvm::Module &m_module; ///< The module which is being instrumented
- DynamicCheckerFunctions
- &m_checker_functions; ///< The dynamic checker functions for the process
+ std::shared_ptr<UtilityFunction>
+ m_checker_function; ///< The dynamic checker function for the process
private:
PointerType *m_i8ptr_ty;
@@ -307,8 +308,8 @@ private:
class ValidPointerChecker : public Instrumenter {
public:
ValidPointerChecker(llvm::Module &module,
- DynamicCheckerFunctions &checker_functions)
- : Instrumenter(module, checker_functions),
+ std::shared_ptr<UtilityFunction> checker_function)
+ : Instrumenter(module, checker_function),
m_valid_pointer_check_func(nullptr) {}
~ValidPointerChecker() override = default;
@@ -322,8 +323,8 @@ protected:
PrintValue(inst).c_str());
if (!m_valid_pointer_check_func)
- m_valid_pointer_check_func = BuildPointerValidatorFunc(
- m_checker_functions.m_valid_pointer_check->StartAddress());
+ m_valid_pointer_check_func =
+ BuildPointerValidatorFunc(m_checker_function->StartAddress());
llvm::Value *dereferenced_ptr = nullptr;
@@ -366,8 +367,8 @@ private:
class ObjcObjectChecker : public Instrumenter {
public:
ObjcObjectChecker(llvm::Module &module,
- DynamicCheckerFunctions &checker_functions)
- : Instrumenter(module, checker_functions),
+ std::shared_ptr<UtilityFunction> checker_function)
+ : Instrumenter(module, checker_function),
m_objc_object_check_func(nullptr) {}
~ObjcObjectChecker() override = default;
@@ -391,8 +392,8 @@ protected:
// InspectInstruction wouldn't have registered it
if (!m_objc_object_check_func)
- m_objc_object_check_func = BuildObjectCheckerFunc(
- m_checker_functions.m_objc_object_check->StartAddress());
+ m_objc_object_check_func =
+ BuildObjectCheckerFunc(m_checker_function->StartAddress());
// id objc_msgSend(id theReceiver, SEL theSelector, ...)
@@ -552,7 +553,7 @@ bool IRDynamicChecks::runOnModule(llvm::Module &M) {
}
if (m_checker_functions.m_valid_pointer_check) {
- ValidPointerChecker vpc(M, m_checker_functions);
+ ValidPointerChecker vpc(M, m_checker_functions.m_valid_pointer_check);
if (!vpc.Inspect(*function))
return false;
@@ -562,7 +563,7 @@ bool IRDynamicChecks::runOnModule(llvm::Module &M) {
}
if (m_checker_functions.m_objc_object_check) {
- ObjcObjectChecker ooc(M, m_checker_functions);
+ ObjcObjectChecker ooc(M, m_checker_functions.m_objc_object_check);
if (!ooc.Inspect(*function))
return false;
OpenPOWER on IntegriCloud