• 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_PUBLIC_H
17 #define PANDA_VERIFICATION_PUBLIC_H
18 
19 #include "runtime/include/mem/allocator.h"
20 #include "runtime/include/method.h"
21 #include "runtime/include/runtime_options.h"
22 #include <functional>
23 #include <string_view>
24 namespace panda {
25 class ClassLinker;
26 }  // namespace panda
27 
28 namespace panda::verifier {
29 
30 using Config = struct Config;  // NOLINT(bugprone-forward-declaration-namespace)
31 
32 Config *NewConfig();
33 bool LoadConfigFile(Config *config, std::string_view configFileName);
34 void DestroyConfig(Config *config);
35 
36 bool IsEnabled(Config const *config);
37 bool IsOnlyVerify(Config const *config);
38 
39 using Service = struct Service;
40 
41 Service *CreateService(Config const *config, panda::mem::InternalAllocatorPtr allocator, ClassLinker *linker,
42                        std::string const &cacheFileName);
43 void DestroyService(Service *service, bool updateCacheFile);
44 
45 Config const *GetServiceConfig(Service const *service);
46 
47 enum class Status { OK, FAILED, UNKNOWN };
48 
49 PANDA_PUBLIC_API Status Verify(Service *service, panda::Method *method, VerificationMode mode);
50 
51 }  // namespace panda::verifier
52 
53 #endif  // PANDA_VERIFICATION_PUBLIC_H
54