• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 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 PANDA_GUARD_OBFUSCATE_GRAPH_ANALYZER_H
17 #define PANDA_GUARD_OBFUSCATE_GRAPH_ANALYZER_H
18 
19 #include "entity.h"
20 
21 namespace panda::guard {
22 
23 class GraphAnalyzer {
24 public:
25     GraphAnalyzer() = delete;
26 
27     ~GraphAnalyzer() = delete;
28     NO_COPY_SEMANTIC(GraphAnalyzer);
29 
30     /**
31      * Get Related Lda.Str instruction
32      * @param inIns origin inst
33      * @param outIns related Lda.Str inst; if not found, outIns.ins_ will be nullptr
34      * @param index reg index, -1 as using default value
35      */
36     static void GetLdaStr(const InstructionInfo &inIns, InstructionInfo &outIns, int index = -1);
37 
38     /**
39      * Get Related instruction of DefineMethod
40      * @param inIns input ins: definemethod
41      * @param defineIns ins info of define method
42      * @param nameIns ins info of name define
43      */
44     static void HandleDefineMethod(const InstructionInfo &inIns, InstructionInfo &defineIns, InstructionInfo &nameIns);
45 
46     /**
47      * Get Related instruction of definepropertybyname
48      * @param inIns input ins
49      * @param defineIns related define ins
50      */
51     static void HandleDefineProperty(const InstructionInfo &inIns, InstructionInfo &defineIns);
52 
53     /**
54      * Get class is component
55      *
56      * @Component
57      * struct ClassName{}
58      *
59      * @ComponentV2
60      * struct ClassName{}
61      *
62      * @param inIns defineclasswithbuffer instruction
63      * @return is component class
64      */
65     static bool IsComponentClass(const InstructionInfo &inIns);
66 };
67 
68 }  // namespace panda::guard
69 
70 #endif  // PANDA_GUARD_OBFUSCATE_GRAPH_ANALYZER_H
71