]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Target/CPPLanguageRuntime.h
Update nvi to 2.1.3 which fixes the data corruption when locale conversion
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Target / CPPLanguageRuntime.h
1 //===-- CPPLanguageRuntime.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_CPPLanguageRuntime_h_
11 #define liblldb_CPPLanguageRuntime_h_
12
13 // C Includes
14 // C++ Includes
15 #include <vector>
16 // Other libraries and framework includes
17 // Project includes
18 #include "lldb/Core/PluginInterface.h"
19 #include "lldb/lldb-private.h"
20 #include "lldb/Target/LanguageRuntime.h"
21
22 namespace lldb_private {
23
24 class CPPLanguageRuntime :
25     public LanguageRuntime
26 {
27 public:
28     
29     class MethodName
30     {
31     public:
32         enum Type
33         {
34             eTypeInvalid,
35             eTypeUnknownMethod,
36             eTypeClassMethod,
37             eTypeInstanceMethod
38         };
39         
40         MethodName () :
41             m_full(),
42             m_basename(),
43             m_context(),
44             m_arguments(),
45             m_qualifiers(),
46             m_type (eTypeInvalid),
47             m_parsed (false),
48             m_parse_error (false)
49         {
50         }
51
52         MethodName (const ConstString &s) :
53             m_full(s),
54             m_basename(),
55             m_context(),
56             m_arguments(),
57             m_qualifiers(),
58             m_type (eTypeInvalid),
59             m_parsed (false),
60             m_parse_error (false)
61         {
62         }
63
64         void
65         Clear();
66         
67         bool
68         IsValid ()
69         {
70             if (!m_parsed)
71                 Parse();
72             if (m_parse_error)
73                 return false;
74             if (m_type == eTypeInvalid)
75                 return false;
76             return (bool)m_full;
77         }
78
79         Type
80         GetType () const
81         {
82             return m_type;
83         }
84         
85         const ConstString &
86         GetFullName () const
87         {
88             return m_full;
89         }
90         
91         llvm::StringRef
92         GetBasename ();
93
94         llvm::StringRef
95         GetContext ();
96         
97         llvm::StringRef
98         GetArguments ();
99         
100         llvm::StringRef
101         GetQualifiers ();
102
103     protected:
104         void
105         Parse();
106
107         ConstString     m_full;         // Full name:    "lldb::SBTarget::GetBreakpointAtIndex(unsigned int) const"
108         llvm::StringRef m_basename;     // Basename:     "GetBreakpointAtIndex"
109         llvm::StringRef m_context;      // Decl context: "lldb::SBTarget"
110         llvm::StringRef m_arguments;    // Arguments:    "(unsigned int)"
111         llvm::StringRef m_qualifiers;   // Qualifiers:   "const"
112         Type m_type;
113         bool m_parsed;
114         bool m_parse_error;
115     };
116
117     virtual
118     ~CPPLanguageRuntime();
119     
120     virtual lldb::LanguageType
121     GetLanguageType () const
122     {
123         return lldb::eLanguageTypeC_plus_plus;
124     }
125     
126     virtual bool
127     IsVTableName (const char *name) = 0;
128     
129     virtual bool
130     GetObjectDescription (Stream &str, ValueObject &object);
131     
132     virtual bool
133     GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope);
134     
135     static bool
136     IsCPPMangledName(const char *name);
137
138     // Extract C++ context and identifier from a string using heuristic matching (as opposed to
139     // CPPLanguageRuntime::MethodName which has to have a fully qualified C++ name with parens and arguments.
140     // If the name is a lone C identifier (e.g. C) or a qualified C identifier (e.g. A::B::C) it will return true,
141     // and identifier will be the identifier (C and C respectively) and the context will be "" and "A::B::" respectively.
142     // If the name fails the heuristic matching for a qualified or unqualified C/C++ identifier, then it will return false
143     // and identifier and context will be unchanged.
144
145     static bool
146     ExtractContextAndIdentifier (const char *name, llvm::StringRef &context, llvm::StringRef &identifier);
147     
148     // in some cases, compilers will output different names for one same type. when that happens, it might be impossible
149     // to construct SBType objects for a valid type, because the name that is available is not the same as the name that
150     // can be used as a search key in FindTypes(). the equivalents map here is meant to return possible alternative names
151     // for a type through which a search can be conducted. Currently, this is only enabled for C++ but can be extended
152     // to ObjC or other languages if necessary
153     static uint32_t
154     FindEquivalentNames(ConstString type_name, std::vector<ConstString>& equivalents);
155
156 protected:
157     //------------------------------------------------------------------
158     // Classes that inherit from CPPLanguageRuntime can see and modify these
159     //------------------------------------------------------------------
160     CPPLanguageRuntime(Process *process);
161 private:
162     DISALLOW_COPY_AND_ASSIGN (CPPLanguageRuntime);
163 };
164
165 } // namespace lldb_private
166
167 #endif  // liblldb_CPPLanguageRuntime_h_