• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2022 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_VERIFICATION_PLUGINS_H
17 #define PANDA_VERIFICATION_PLUGINS_H
18 
19 #include "abs_int_inl_compat_checks.h"
20 #include "source_lang_enum.h"
21 
22 namespace panda::verifier::plugin {
23 
24 class Plugin {
25 public:
26     virtual ManagedThread *CreateManagedThread() const = 0;
27     virtual void DestroyManagedThread(ManagedThread *thr) const = 0;
28     virtual void TypeSystemSetup(TypeSystem *types) const = 0;
29 
30     virtual CheckResult const &CheckFieldAccessViolation(Field const *field, Method const *from,
31                                                          TypeSystem *types) const = 0;
32 
33     virtual CheckResult const &CheckMethodAccessViolation(Method const *method, Method const *from,
34                                                           TypeSystem *types) const = 0;
35 
36     virtual CheckResult const &CheckClassAccessViolation(Class const *klass, Method const *from,
37                                                          TypeSystem *types) const = 0;
38 
39     virtual Type NormalizeType(Type type, TypeSystem *types) const = 0;
40 
41     virtual CheckResult const &CheckClass(Class const *klass) const = 0;
42 };
43 
44 PANDA_PUBLIC_API Plugin const *GetLanguagePlugin(panda_file::SourceLang lang);
45 
46 }  // namespace panda::verifier::plugin
47 
48 #endif  // PANDA_VERIFICATION_PLUGINS_H
49