Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:47

0001 //===-- DynamicCheckerFunctions.h -------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLDB_EXPRESSION_DYNAMICCHECKERFUNCTIONS_H
0010 #define LLDB_EXPRESSION_DYNAMICCHECKERFUNCTIONS_H
0011 
0012 #include "lldb/lldb-types.h"
0013 
0014 #include "llvm/Support/Error.h"
0015 
0016 namespace lldb_private {
0017 
0018 class DiagnosticManager;
0019 class ExecutionContext;
0020 
0021 /// Encapsulates dynamic check functions used by expressions.
0022 ///
0023 /// Each of the utility functions encapsulated in this class is responsible
0024 /// for validating some data that an expression is about to use.  Examples
0025 /// are:
0026 ///
0027 /// a = *b;     // check that b is a valid pointer
0028 /// [b init];   // check that b is a valid object to send "init" to
0029 ///
0030 /// The class installs each checker function into the target process and makes
0031 /// it available to IRDynamicChecks to use.
0032 class DynamicCheckerFunctions {
0033 public:
0034   enum DynamicCheckerFunctionsKind {
0035     DCF_Clang,
0036   };
0037 
0038   DynamicCheckerFunctions(DynamicCheckerFunctionsKind kind) : m_kind(kind) {}
0039   virtual ~DynamicCheckerFunctions() = default;
0040 
0041   /// Install the utility functions into a process.  This binds the instance
0042   /// of DynamicCheckerFunctions to that process.
0043   ///
0044   /// \param[in] diagnostic_manager
0045   ///     A diagnostic manager to report errors to.
0046   ///
0047   /// \param[in] exe_ctx
0048   ///     The execution context to install the functions into.
0049   ///
0050   /// \return
0051   ///     Either llvm::ErrorSuccess or Error with llvm::ErrorInfo
0052   ///
0053   virtual llvm::Error Install(DiagnosticManager &diagnostic_manager,
0054                               ExecutionContext &exe_ctx) = 0;
0055   virtual bool DoCheckersExplainStop(lldb::addr_t addr, Stream &message) = 0;
0056 
0057   DynamicCheckerFunctionsKind GetKind() const { return m_kind; }
0058 
0059 private:
0060   const DynamicCheckerFunctionsKind m_kind;
0061 };
0062 } // namespace lldb_private
0063 
0064 #endif // LLDB_EXPRESSION_DYNAMICCHECKERFUNCTIONS_H