]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / source / Plugins / LanguageRuntime / ObjC / AppleObjCRuntime / AppleObjCTypeEncodingParser.h
1 //===-- AppleObjCTypeEncodingParser.h ---------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef liblldb_AppleObjCTypeEncodingParser_h_
10 #define liblldb_AppleObjCTypeEncodingParser_h_
11
12 #include "clang/AST/ASTContext.h"
13
14 #include "lldb/lldb-private.h"
15
16 #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
17
18 namespace lldb_private {
19 class StringLexer;
20 class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
21 public:
22   AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
23   ~AppleObjCTypeEncodingParser() override = default;
24
25   CompilerType RealizeType(ClangASTContext &ast_ctx, const char *name,
26                            bool for_expression) override;
27
28 private:
29   struct StructElement {
30     std::string name;
31     clang::QualType type;
32     uint32_t bitfield;
33
34     StructElement();
35     ~StructElement() = default;
36   };
37
38   clang::QualType BuildType(ClangASTContext &clang_ast_ctx, StringLexer &type,
39                             bool for_expression,
40                             uint32_t *bitfield_bit_size = nullptr);
41
42   clang::QualType BuildStruct(ClangASTContext &ast_ctx, StringLexer &type,
43                               bool for_expression);
44
45   clang::QualType BuildAggregate(ClangASTContext &clang_ast_ctx,
46                                  StringLexer &type, bool for_expression,
47                                  char opener, char closer, uint32_t kind);
48
49   clang::QualType BuildUnion(ClangASTContext &ast_ctx, StringLexer &type,
50                              bool for_expression);
51
52   clang::QualType BuildArray(ClangASTContext &ast_ctx, StringLexer &type,
53                              bool for_expression);
54
55   std::string ReadStructName(StringLexer &type);
56
57   StructElement ReadStructElement(ClangASTContext &ast_ctx, StringLexer &type,
58                                   bool for_expression);
59
60   clang::QualType BuildObjCObjectPointerType(ClangASTContext &clang_ast_ctx,
61                                              StringLexer &type,
62                                              bool for_expression);
63
64   uint32_t ReadNumber(StringLexer &type);
65
66   std::string ReadQuotedString(StringLexer &type);
67
68   ObjCLanguageRuntime &m_runtime;
69 };
70
71 } // namespace lldb_private
72
73 #endif // liblldb_AppleObjCTypeEncodingParser_h_