AppleObjCTypeEncodingParser.h revision 314564
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
19314564Sdim#include "lldb/Target/ObjCLanguageRuntime.h"
20293116Semaste#include "lldb/lldb-private.h"
21293116Semaste
22293116Semastenamespace lldb_utility {
23314564Sdimclass StringLexer;
24293116Semaste}
25293116Semaste
26293116Semastenamespace lldb_private {
27293116Semaste
28314564Sdimclass AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
29314564Sdimpublic:
30314564Sdim  AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
31314564Sdim  ~AppleObjCTypeEncodingParser() override = default;
32293116Semaste
33314564Sdim  CompilerType RealizeType(clang::ASTContext &ast_ctx, const char *name,
34314564Sdim                           bool for_expression) override;
35293116Semaste
36314564Sdimprivate:
37314564Sdim  struct StructElement {
38314564Sdim    std::string name;
39314564Sdim    clang::QualType type;
40314564Sdim    uint32_t bitfield;
41314564Sdim
42314564Sdim    StructElement();
43314564Sdim    ~StructElement() = default;
44314564Sdim  };
45314564Sdim
46314564Sdim  clang::QualType BuildType(clang::ASTContext &ast_ctx,
47314564Sdim                            lldb_utility::StringLexer &type,
48314564Sdim                            bool for_expression,
49314564Sdim                            uint32_t *bitfield_bit_size = nullptr);
50314564Sdim
51314564Sdim  clang::QualType BuildStruct(clang::ASTContext &ast_ctx,
52314564Sdim                              lldb_utility::StringLexer &type,
53314564Sdim                              bool for_expression);
54314564Sdim
55314564Sdim  clang::QualType BuildAggregate(clang::ASTContext &ast_ctx,
56314564Sdim                                 lldb_utility::StringLexer &type,
57314564Sdim                                 bool for_expression, char opener, char closer,
58314564Sdim                                 uint32_t kind);
59314564Sdim
60314564Sdim  clang::QualType BuildUnion(clang::ASTContext &ast_ctx,
61314564Sdim                             lldb_utility::StringLexer &type,
62314564Sdim                             bool for_expression);
63314564Sdim
64314564Sdim  clang::QualType BuildArray(clang::ASTContext &ast_ctx,
65314564Sdim                             lldb_utility::StringLexer &type,
66314564Sdim                             bool for_expression);
67314564Sdim
68314564Sdim  std::string ReadStructName(lldb_utility::StringLexer &type);
69314564Sdim
70314564Sdim  StructElement ReadStructElement(clang::ASTContext &ast_ctx,
71314564Sdim                                  lldb_utility::StringLexer &type,
72314564Sdim                                  bool for_expression);
73314564Sdim
74314564Sdim  clang::QualType BuildObjCObjectPointerType(clang::ASTContext &ast_ctx,
75314564Sdim                                             lldb_utility::StringLexer &type,
76314564Sdim                                             bool for_expression);
77314564Sdim
78314564Sdim  uint32_t ReadNumber(lldb_utility::StringLexer &type);
79314564Sdim
80314564Sdim  std::string ReadQuotedString(lldb_utility::StringLexer &type);
81314564Sdim
82314564Sdim  ObjCLanguageRuntime &m_runtime;
83314564Sdim};
84314564Sdim
85293116Semaste} // namespace lldb_private
86293116Semaste
87293116Semaste#endif // liblldb_AppleObjCTypeEncodingParser_h_
88