TypeList.h revision 3f5ee7fd6991891f0892bd71537763d9b59acd12
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 <map>
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    void
44    Insert (lldb::TypeSP& type);
45
46    bool
47    InsertUnique (lldb::TypeSP& type);
48
49    uint32_t
50    GetSize() const;
51
52    lldb::TypeSP
53    GetTypeAtIndex(uint32_t idx);
54
55    //------------------------------------------------------------------
56    // Classes that inherit from TypeList can see and modify these
57    //------------------------------------------------------------------
58    ClangASTContext &
59    GetClangASTContext ();
60
61    void *
62    CreateClangPointerType (Type *type);
63
64    void *
65    CreateClangTypedefType (Type *typedef_type, Type *base_type);
66
67    // For C++98 references (&)
68    void *
69    CreateClangLValueReferenceType (Type *type);
70
71    // For C++0x references (&&)
72    void *
73    CreateClangRValueReferenceType (Type *type);
74
75private:
76    typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
77    typedef collection::iterator iterator;
78    typedef collection::const_iterator const_iterator;
79    ClangASTContext m_ast; ///< The type abtract syntax tree.
80
81    collection m_types;
82
83    DISALLOW_COPY_AND_ASSIGN (TypeList);
84};
85
86} // namespace lldb_private
87
88#endif  // liblldb_TypeList_h_
89