]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Expression/ExpressionSourceCode.h
Merge ^/head r274961 through r276342.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Expression / ExpressionSourceCode.h
1 //===-- ExpressionSourceCode.h ----------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_ExpressionSourceCode_h
11 #define liblldb_ExpressionSourceCode_h
12
13 #include "lldb/lldb-enumerations.h"
14
15 #include <string>
16
17 namespace lldb_private
18 {
19
20 class ExecutionContext;
21
22 class ExpressionSourceCode
23 {
24 public:
25     static const char * g_expression_prefix;
26
27     static ExpressionSourceCode *CreateWrapped (const char *prefix,
28                                                 const char *body)
29     {
30         return new ExpressionSourceCode ("$__lldb_expr",
31                                          prefix,
32                                          body,
33                                          true);
34     }
35     
36     static ExpressionSourceCode *CreateUnwrapped (const char *name,
37                                                   const char *body)
38     {
39         return new ExpressionSourceCode (name,
40                                          "",
41                                          body,
42                                          false);
43     }
44     
45     bool NeedsWrapping () const
46     {
47         return m_wrap;
48     }
49     
50     const char *GetName () const
51     {
52         return m_name.c_str();
53     }
54     
55     bool GetText (std::string &text, 
56                   lldb::LanguageType wrapping_language, 
57                   bool const_object,
58                   bool static_method,
59                   ExecutionContext &exe_ctx) const;
60     
61 private:
62     ExpressionSourceCode (const char *name,
63                           const char *prefix,
64                           const char *body,
65                           bool wrap) :
66         m_name(name),
67         m_prefix(prefix),
68         m_body(body),
69         m_wrap(wrap)
70     {
71     }
72     
73     std::string m_name;
74     std::string m_prefix;
75     std::string m_body;
76     bool m_wrap;
77 };
78
79 } // namespace lldb_private
80
81 #endif