TypeList.h revision b433a3d8b910d571c0bcdcd5018778ac3763e703
1//===-- TypeList.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_TypeList_h_
11#define liblldb_TypeList_h_
12
13#include "lldb/lldb-private.h"
14#include "lldb/Symbol/ClangASTContext.h"
15#include "lldb/Symbol/Type.h"
16#include <vector>
17
18namespace lldb_private {
19
20class TypeList
21{
22public:
23    //------------------------------------------------------------------
24    // Constructors and Destructors
25    //------------------------------------------------------------------
26    TypeList(const char *target_triple = NULL);
27
28    virtual
29    ~TypeList();
30
31    void
32    Clear();
33
34    void
35    Dump(Stream *s, bool show_context);
36
37    lldb::TypeSP
38    FindType(lldb::user_id_t uid);
39
40    TypeList
41    FindTypes(const ConstString &name);
42
43    lldb::TypeSP
44    InsertUnique(lldb::TypeSP& type);
45
46    uint32_t
47    GetSize() const;
48
49    lldb::TypeSP
50    GetTypeAtIndex(uint32_t idx);
51
52    //------------------------------------------------------------------
53    // Classes that inherit from TypeList can see and modify these
54    //------------------------------------------------------------------
55    ClangASTContext &
56    GetClangASTContext ();
57
58    void *
59    CreateClangPointerType (Type *type);
60
61    void *
62    CreateClangTypedefType (Type *typedef_type, Type *base_type);
63
64    // For C++98 references (&)
65    void *
66    CreateClangLValueReferenceType (Type *type);
67
68    // For C++0x references (&&)
69    void *
70    CreateClangRValueReferenceType (Type *type);
71
72private:
73    typedef std::vector<lldb::TypeSP> collection;
74    typedef collection::iterator iterator;
75    typedef collection::const_iterator const_iterator;
76    ClangASTContext m_ast; ///< The type abtract syntax tree.
77
78    collection m_types;
79
80    DISALLOW_COPY_AND_ASSIGN (TypeList);
81};
82
83} // namespace lldb_private
84
85#endif  // liblldb_TypeList_h_
86