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 LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCTYPEENCODINGPARSER_H
10#define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCTYPEENCODINGPARSER_H
11
12#include "Plugins/Language/ObjC/ObjCConstants.h"
13#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
14#include "lldb/lldb-private.h"
15
16#include "clang/AST/ASTContext.h"
17
18namespace lldb_private {
19class StringLexer;
20class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
21public:
22 AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
23 ~AppleObjCTypeEncodingParser() override = default;
24
25 CompilerType RealizeType(TypeSystemClang &ast_ctx, const char *name,
26 bool for_expression) override;
27
28private:
29 struct StructElement {
30 std::string name;
31 clang::QualType type;
32 uint32_t bitfield = 0;
33
34 StructElement();
35 ~StructElement() = default;
36 };
37
38 clang::QualType BuildType(TypeSystemClang &clang_ast_ctx, StringLexer &type,
39 bool for_expression,
40 uint32_t *bitfield_bit_size = nullptr);
41
42 clang::QualType BuildStruct(TypeSystemClang &ast_ctx, StringLexer &type,
43 bool for_expression);
44
45 clang::QualType BuildAggregate(TypeSystemClang &clang_ast_ctx,
46 StringLexer &type, bool for_expression,
47 char opener, char closer, uint32_t kind);
48
49 clang::QualType BuildUnion(TypeSystemClang &ast_ctx, StringLexer &type,
50 bool for_expression);
51
52 clang::QualType BuildArray(TypeSystemClang &ast_ctx, StringLexer &type,
53 bool for_expression);
54
55 std::string ReadStructName(StringLexer &type);
56
57 StructElement ReadStructElement(TypeSystemClang &ast_ctx, StringLexer &type,
58 bool for_expression);
59
60 clang::QualType BuildObjCObjectPointerType(TypeSystemClang &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 // LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCTYPEENCODINGPARSER_H
74

source code of lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h