AppleObjCTypeEncodingParser.h revision 293116
1293116Semaste//===-- AppleObjCTypeEncodingParser.h ---------------------------*- C++ -*-===//
2293116Semaste//
3293116Semaste//                     The LLVM Compiler Infrastructure
4293116Semaste//
5293116Semaste// This file is distributed under the University of Illinois Open Source
6293116Semaste// License. See LICENSE.TXT for details.
7293116Semaste//
8293116Semaste//===----------------------------------------------------------------------===//
9293116Semaste
10293116Semaste#ifndef liblldb_AppleObjCTypeEncodingParser_h_
11293116Semaste#define liblldb_AppleObjCTypeEncodingParser_h_
12293116Semaste
13293116Semaste// C Includes
14293116Semaste// C++ Includes
15293116Semaste// Other libraries and framework includes
16293116Semaste#include "clang/AST/ASTContext.h"
17293116Semaste
18293116Semaste// Project includes
19293116Semaste#include "lldb/lldb-private.h"
20293116Semaste#include "lldb/Target/ObjCLanguageRuntime.h"
21293116Semaste
22293116Semastenamespace lldb_utility {
23293116Semaste    class StringLexer;
24293116Semaste}
25293116Semaste
26293116Semastenamespace lldb_private {
27293116Semaste
28293116Semaste    class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType
29293116Semaste    {
30293116Semaste    public:
31293116Semaste        AppleObjCTypeEncodingParser (ObjCLanguageRuntime& runtime);
32293116Semaste        ~AppleObjCTypeEncodingParser() override = default;
33293116Semaste
34293116Semaste        CompilerType RealizeType(clang::ASTContext &ast_ctx, const char* name, bool for_expression) override;
35293116Semaste
36293116Semaste    private:
37293116Semaste        struct StructElement {
38293116Semaste            std::string name;
39293116Semaste            clang::QualType type;
40293116Semaste            uint32_t bitfield;
41293116Semaste
42293116Semaste            StructElement ();
43293116Semaste            ~StructElement () = default;
44293116Semaste        };
45293116Semaste
46293116Semaste        clang::QualType
47293116Semaste        BuildType (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression, uint32_t *bitfield_bit_size = nullptr);
48293116Semaste
49293116Semaste        clang::QualType
50293116Semaste        BuildStruct (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
51293116Semaste
52293116Semaste        clang::QualType
53293116Semaste        BuildAggregate (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression, char opener, char closer, uint32_t kind);
54293116Semaste
55293116Semaste        clang::QualType
56293116Semaste        BuildUnion (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
57293116Semaste
58293116Semaste        clang::QualType
59293116Semaste        BuildArray (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
60293116Semaste
61293116Semaste        std::string
62293116Semaste        ReadStructName(lldb_utility::StringLexer& type);
63293116Semaste
64293116Semaste        StructElement
65293116Semaste        ReadStructElement (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
66293116Semaste
67293116Semaste        clang::QualType
68293116Semaste        BuildObjCObjectPointerType (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
69293116Semaste
70293116Semaste        uint32_t
71293116Semaste        ReadNumber (lldb_utility::StringLexer& type);
72293116Semaste
73293116Semaste        std::string
74293116Semaste        ReadQuotedString(lldb_utility::StringLexer& type);
75293116Semaste
76293116Semaste        ObjCLanguageRuntime& m_runtime;
77293116Semaste    };
78293116Semaste
79293116Semaste} // namespace lldb_private
80293116Semaste
81293116Semaste#endif // liblldb_AppleObjCTypeEncodingParser_h_
82