1 //===-- FormatClasses.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 lldb_FormatClasses_h_
11 #define lldb_FormatClasses_h_
21 // Other libraries and framework includes
24 #include "lldb/lldb-public.h"
25 #include "lldb/lldb-enumerations.h"
27 #include "lldb/Core/ValueObject.h"
28 #include "lldb/Interpreter/ScriptInterpreterPython.h"
29 #include "lldb/Symbol/ClangASTType.h"
30 #include "lldb/Symbol/Type.h"
32 #include "lldb/DataFormatters/TypeFormat.h"
33 #include "lldb/DataFormatters/TypeSummary.h"
34 #include "lldb/DataFormatters/TypeSynthetic.h"
36 namespace lldb_private {
38 class TypeNameSpecifierImpl
41 TypeNameSpecifierImpl() :
47 TypeNameSpecifierImpl (const char* name, bool is_regex) :
52 m_type.m_type_name.assign(name);
55 // if constructing with a given type, is_regex cannot be true since we are
56 // giving an exact type to match
57 TypeNameSpecifierImpl (lldb::TypeSP type) :
63 m_type.m_type_name.assign(type->GetName().GetCString());
64 m_type.m_typeimpl_sp = lldb::TypeImplSP(new TypeImpl(type));
68 TypeNameSpecifierImpl (ClangASTType type) :
74 m_type.m_type_name.assign(type.GetConstTypeName().GetCString());
75 m_type.m_typeimpl_sp = lldb::TypeImplSP(new TypeImpl(type));
82 if (m_type.m_type_name.size())
83 return m_type.m_type_name.c_str();
90 if (m_type.m_typeimpl_sp && m_type.m_typeimpl_sp->IsValid())
91 return m_type.m_typeimpl_sp->GetTypeSP();
92 return lldb::TypeSP();
98 if (m_type.m_typeimpl_sp && m_type.m_typeimpl_sp->IsValid())
99 return m_type.m_typeimpl_sp->GetClangASTType();
100 return ClangASTType();
111 // this works better than TypeAndOrName because the latter only wraps a TypeSP
112 // whereas TypeImplSP can also be backed by a ClangASTType which is more commonly
113 // used in LLDB. moreover, TypeImplSP is also what is currently backing SBType
116 std::string m_type_name;
117 lldb::TypeImplSP m_typeimpl_sp;
123 DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
126 } // namespace lldb_private
128 #endif // lldb_FormatClasses_h_