1293116Semaste//===-- AppleObjCTypeEncodingParser.h ---------------------------*- C++ -*-===//
2293116Semaste//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6293116Semaste//
7293116Semaste//===----------------------------------------------------------------------===//
8293116Semaste
9293116Semaste#ifndef liblldb_AppleObjCTypeEncodingParser_h_
10293116Semaste#define liblldb_AppleObjCTypeEncodingParser_h_
11293116Semaste
12293116Semaste#include "clang/AST/ASTContext.h"
13293116Semaste
14293116Semaste#include "lldb/lldb-private.h"
15293116Semaste
16353358Sdim#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
17353358Sdim
18360784Sdimnamespace lldb_private {
19314564Sdimclass StringLexer;
20314564Sdimclass AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
21314564Sdimpublic:
22314564Sdim  AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
23314564Sdim  ~AppleObjCTypeEncodingParser() override = default;
24293116Semaste
25360784Sdim  CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name,
26314564Sdim                           bool for_expression) override;
27293116Semaste
28314564Sdimprivate:
29314564Sdim  struct StructElement {
30314564Sdim    std::string name;
31314564Sdim    clang::QualType type;
32314564Sdim    uint32_t bitfield;
33314564Sdim
34314564Sdim    StructElement();
35314564Sdim    ~StructElement() = default;
36314564Sdim  };
37314564Sdim
38360784Sdim  clang::QualType BuildType(ClangASTContext &clang_ast_ctx, StringLexer &type,
39314564Sdim                            bool for_expression,
40314564Sdim                            uint32_t *bitfield_bit_size = nullptr);
41314564Sdim
42360784Sdim  clang::QualType BuildStruct(ClangASTContext &ast_ctx, StringLexer &type,
43314564Sdim                              bool for_expression);
44314564Sdim
45360784Sdim  clang::QualType BuildAggregate(ClangASTContext &clang_ast_ctx,
46360784Sdim                                 StringLexer &type, bool for_expression,
47360784Sdim                                 char opener, char closer, uint32_t kind);
48314564Sdim
49360784Sdim  clang::QualType BuildUnion(ClangASTContext &ast_ctx, StringLexer &type,
50314564Sdim                             bool for_expression);
51314564Sdim
52360784Sdim  clang::QualType BuildArray(ClangASTContext &ast_ctx, StringLexer &type,
53314564Sdim                             bool for_expression);
54314564Sdim
55360784Sdim  std::string ReadStructName(StringLexer &type);
56314564Sdim
57360784Sdim  StructElement ReadStructElement(ClangASTContext &ast_ctx, StringLexer &type,
58314564Sdim                                  bool for_expression);
59314564Sdim
60360784Sdim  clang::QualType BuildObjCObjectPointerType(ClangASTContext &clang_ast_ctx,
61360784Sdim                                             StringLexer &type,
62314564Sdim                                             bool for_expression);
63314564Sdim
64360784Sdim  uint32_t ReadNumber(StringLexer &type);
65314564Sdim
66360784Sdim  std::string ReadQuotedString(StringLexer &type);
67314564Sdim
68314564Sdim  ObjCLanguageRuntime &m_runtime;
69314564Sdim};
70314564Sdim
71293116Semaste} // namespace lldb_private
72293116Semaste
73293116Semaste#endif // liblldb_AppleObjCTypeEncodingParser_h_
74