1 //===-- ClangExpression.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ClangExpression_h_
11 #define liblldb_ClangExpression_h_
19 // Other libraries and framework includes
22 #include "lldb/lldb-forward.h"
23 #include "lldb/lldb-private.h"
24 #include "lldb/Core/ClangForward.h"
25 #include "lldb/Target/Process.h"
27 namespace lldb_private {
29 class RecordingMemoryManager;
31 //----------------------------------------------------------------------
32 /// @class ClangExpression ClangExpression.h "lldb/Expression/ClangExpression.h"
33 /// @brief Encapsulates a single expression for use with Clang
35 /// LLDB uses expressions for various purposes, notably to call functions
36 /// and as a backend for the expr command. ClangExpression encapsulates
37 /// the objects needed to parse and interpret or JIT an expression. It
38 /// uses the Clang parser to produce LLVM IR from the expression.
39 //----------------------------------------------------------------------
50 m_jit_start_addr (LLDB_INVALID_ADDRESS),
51 m_jit_end_addr (LLDB_INVALID_ADDRESS)
55 //------------------------------------------------------------------
57 //------------------------------------------------------------------
58 virtual ~ClangExpression ()
62 //------------------------------------------------------------------
63 /// Return the string that the parser should parse. Must be a full
65 //------------------------------------------------------------------
69 //------------------------------------------------------------------
70 /// Return the function name that should be used for executing the
71 /// expression. Text() should contain the definition of this
73 //------------------------------------------------------------------
77 //------------------------------------------------------------------
78 /// Return the language that should be used when parsing. To use
79 /// the default, return eLanguageTypeUnknown.
80 //------------------------------------------------------------------
81 virtual lldb::LanguageType
84 return lldb::eLanguageTypeUnknown;
87 //------------------------------------------------------------------
88 /// Return the object that the parser should use when resolving external
89 /// values. May be NULL if everything should be self-contained.
90 //------------------------------------------------------------------
91 virtual ClangExpressionDeclMap *
94 //------------------------------------------------------------------
95 /// Return the object that the parser should allow to access ASTs.
96 /// May be NULL if the ASTs do not need to be transformed.
98 /// @param[in] passthrough
99 /// The ASTConsumer that the returned transformer should send
100 /// the ASTs to after transformation.
101 //------------------------------------------------------------------
102 virtual clang::ASTConsumer *
103 ASTTransformer (clang::ASTConsumer *passthrough) = 0;
105 //------------------------------------------------------------------
106 /// Return the desired result type of the function, or
107 /// eResultTypeAny if indifferent.
108 //------------------------------------------------------------------
112 return eResultTypeAny;
115 //------------------------------------------------------------------
117 //------------------------------------------------------------------
119 //------------------------------------------------------------------
120 /// Return true if validation code should be inserted into the
122 //------------------------------------------------------------------
124 NeedsValidation () = 0;
126 //------------------------------------------------------------------
127 /// Return true if external variables in the expression should be
129 //------------------------------------------------------------------
131 NeedsVariableResolution () = 0;
133 //------------------------------------------------------------------
134 /// Return the address of the function's JIT-compiled code, or
135 /// LLDB_INVALID_ADDRESS if the function is not JIT compiled
136 //------------------------------------------------------------------
140 return m_jit_start_addr;
145 lldb::ProcessWP m_jit_process_wp;
146 lldb::addr_t m_jit_start_addr; ///< The address of the JITted function within the JIT allocation. LLDB_INVALID_ADDRESS if invalid.
147 lldb::addr_t m_jit_end_addr; ///< The address of the JITted function within the JIT allocation. LLDB_INVALID_ADDRESS if invalid.
151 } // namespace lldb_private
153 #endif // liblldb_ClangExpression_h_