diff options
Diffstat (limited to 'include/lldb/Expression/Expression.h')
-rw-r--r-- | include/lldb/Expression/Expression.h | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/include/lldb/Expression/Expression.h b/include/lldb/Expression/Expression.h index 162dcd3e4672..2f0183cf269b 100644 --- a/include/lldb/Expression/Expression.h +++ b/include/lldb/Expression/Expression.h @@ -1,9 +1,8 @@ //===-- Expression.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,8 +22,7 @@ namespace lldb_private { class RecordingMemoryManager; -//---------------------------------------------------------------------- -/// @class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates +/// \class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates /// a single expression for use in lldb /// /// LLDB uses expressions for various purposes, notably to call functions @@ -32,78 +30,72 @@ class RecordingMemoryManager; /// objects needed to parse and interpret or JIT an expression. It uses the /// expression parser appropriate to the language of the expression to produce /// LLVM IR from the expression. -//---------------------------------------------------------------------- class Expression { public: + /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.) + enum ExpressionKind { + eKindFunctionCaller, + eKindClangFunctionCaller, + eKindUserExpression, + eKindLLVMUserExpression, + eKindClangUserExpression, + eKindUtilityFunction, + eKindClangUtilityFunction, + }; + enum ResultType { eResultTypeAny, eResultTypeId }; - Expression(Target &target); + Expression(Target &target, ExpressionKind kind); - Expression(ExecutionContextScope &exe_scope); + Expression(ExecutionContextScope &exe_scope, ExpressionKind kind); - //------------------------------------------------------------------ /// Destructor - //------------------------------------------------------------------ virtual ~Expression() {} - //------------------------------------------------------------------ /// Return the string that the parser should parse. Must be a full /// translation unit. - //------------------------------------------------------------------ virtual const char *Text() = 0; - //------------------------------------------------------------------ /// Return the function name that should be used for executing the /// expression. Text() should contain the definition of this function. - //------------------------------------------------------------------ virtual const char *FunctionName() = 0; - //------------------------------------------------------------------ /// Return the language that should be used when parsing. To use the /// default, return eLanguageTypeUnknown. - //------------------------------------------------------------------ virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; } - //------------------------------------------------------------------ /// Return the desired result type of the function, or eResultTypeAny if /// indifferent. - //------------------------------------------------------------------ virtual ResultType DesiredResultType() { return eResultTypeAny; } - //------------------------------------------------------------------ /// Flags - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Return true if validation code should be inserted into the expression. - //------------------------------------------------------------------ virtual bool NeedsValidation() = 0; - //------------------------------------------------------------------ /// Return true if external variables in the expression should be resolved. - //------------------------------------------------------------------ virtual bool NeedsVariableResolution() = 0; virtual EvaluateExpressionOptions *GetOptions() { return nullptr; }; - //------------------------------------------------------------------ /// Return the address of the function's JIT-compiled code, or /// LLDB_INVALID_ADDRESS if the function is not JIT compiled - //------------------------------------------------------------------ lldb::addr_t StartAddress() { return m_jit_start_addr; } - //------------------------------------------------------------------ /// Called to notify the expression that it is about to be executed. - //------------------------------------------------------------------ virtual void WillStartExecuting() {} - //------------------------------------------------------------------ /// Called to notify the expression that its execution has finished. - //------------------------------------------------------------------ virtual void DidFinishExecuting() {} virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; } + /// LLVM-style RTTI support. + ExpressionKind getKind() const { return m_kind; } + +private: + /// LLVM-style RTTI support. + const ExpressionKind m_kind; protected: lldb::TargetWP m_target_wp; /// Expression's always have to have a target... lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but |