|
|
|||
File indexing completed on 2026-05-10 08:42:47
0001 //===-- Expression.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_EXPRESSION_H 0010 #define LLDB_EXPRESSION_EXPRESSION_H 0011 0012 #include <map> 0013 #include <string> 0014 #include <vector> 0015 0016 0017 #include "lldb/Expression/ExpressionTypeSystemHelper.h" 0018 #include "lldb/lldb-forward.h" 0019 #include "lldb/lldb-private.h" 0020 0021 namespace lldb_private { 0022 0023 /// \class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates 0024 /// a single expression for use in lldb 0025 /// 0026 /// LLDB uses expressions for various purposes, notably to call functions 0027 /// and as a backend for the expr command. Expression encapsulates the 0028 /// objects needed to parse and interpret or JIT an expression. It uses the 0029 /// expression parser appropriate to the language of the expression to produce 0030 /// LLVM IR from the expression. 0031 class Expression { 0032 public: 0033 enum ResultType { eResultTypeAny, eResultTypeId }; 0034 0035 Expression(Target &target); 0036 0037 Expression(ExecutionContextScope &exe_scope); 0038 0039 /// Destructor 0040 virtual ~Expression() = default; 0041 0042 /// Return the string that the parser should parse. Must be a full 0043 /// translation unit. 0044 virtual const char *Text() = 0; 0045 0046 /// Return the function name that should be used for executing the 0047 /// expression. Text() should contain the definition of this function. 0048 virtual const char *FunctionName() = 0; 0049 0050 /// Return the language that should be used when parsing. 0051 virtual SourceLanguage Language() const { return {}; } 0052 0053 /// Return the Materializer that the parser should use when registering 0054 /// external values. 0055 virtual Materializer *GetMaterializer() { return nullptr; } 0056 0057 /// Return the desired result type of the function, or eResultTypeAny if 0058 /// indifferent. 0059 virtual ResultType DesiredResultType() const { return eResultTypeAny; } 0060 0061 /// Flags 0062 0063 /// Return true if validation code should be inserted into the expression. 0064 virtual bool NeedsValidation() = 0; 0065 0066 /// Return true if external variables in the expression should be resolved. 0067 virtual bool NeedsVariableResolution() = 0; 0068 0069 virtual EvaluateExpressionOptions *GetOptions() { return nullptr; }; 0070 0071 /// Return the address of the function's JIT-compiled code, or 0072 /// LLDB_INVALID_ADDRESS if the function is not JIT compiled 0073 lldb::addr_t StartAddress() { return m_jit_start_addr; } 0074 0075 /// Called to notify the expression that it is about to be executed. 0076 virtual void WillStartExecuting() {} 0077 0078 /// Called to notify the expression that its execution has finished. 0079 virtual void DidFinishExecuting() {} 0080 0081 virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; } 0082 0083 // LLVM RTTI support 0084 virtual bool isA(const void *ClassID) const = 0; 0085 0086 protected: 0087 lldb::TargetWP m_target_wp; /// Expression's always have to have a target... 0088 lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but 0089 /// it doesn't need to (e.g. calculator 0090 /// mode.) 0091 lldb::addr_t m_jit_start_addr; ///< The address of the JITted function within 0092 ///the JIT allocation. LLDB_INVALID_ADDRESS if 0093 ///invalid. 0094 lldb::addr_t m_jit_end_addr; ///< The address of the JITted function within 0095 ///the JIT allocation. LLDB_INVALID_ADDRESS if 0096 ///invalid. 0097 }; 0098 0099 } // namespace lldb_private 0100 0101 #endif // LLDB_EXPRESSION_EXPRESSION_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|