1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef DISASM_ACCUMULATORS_H_INCLUDED
17 #define DISASM_ACCUMULATORS_H_INCLUDED
18 
19 #include <map>
20 #include <string>
21 #include <vector>
22 
23 #include "libpandafile/debug_info_extractor.h"
24 
25 namespace ark::disasm {
26 using LabelTable = std::map<size_t, std::string>;
27 using IdList = std::vector<ark::panda_file::File::EntityId>;
28 
29 struct MethodInfo {
30     std::string methodInfo;
31 
32     std::vector<std::string> instructionsInfo;
33 
34     panda_file::LineNumberTable lineNumberTable;
35 
36     panda_file::LocalVariableTable localVariableTable;
37 };
38 
39 struct RecordInfo {
40     std::string recordInfo;
41 
42     std::vector<std::string> fieldsInfo;
43 };
44 
45 struct ProgInfo {
46     std::map<std::string, RecordInfo> recordsInfo;
47     std::map<std::string, MethodInfo> methodsInfo;
48 };
49 
50 using AnnotationList = std::vector<std::pair<std::string, std::string>>;
51 
52 struct RecordAnnotations {
53     AnnotationList annList;
54     std::map<std::string, AnnotationList> fieldAnnotations;
55 };
56 
57 struct ProgAnnotations {
58     std::map<std::string, AnnotationList> methodAnnotations;
59     std::map<std::string, RecordAnnotations> recordAnnotations;
60 };
61 }  // namespace ark::disasm
62 
63 #endif
64