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 PANDA_VERIFICATION_OPTIONS_H_ 17 #define PANDA_VERIFICATION_OPTIONS_H_ 18 19 #include "utils/pandargs.h" 20 #include "runtime/include/runtime_options.h" 21 #include "runtime/include/mem/panda_containers.h" 22 #include "runtime/include/mem/panda_string.h" 23 #include "verification/config/options/method_options_config.h" 24 25 #include <string> 26 #include <unordered_map> 27 28 namespace ark::verifier { 29 30 struct VerificationOptions { 31 // NOLINTBEGIN(misc-non-private-member-variables-in-classes) 32 std::string configFile = "default"; 33 VerificationMode mode = VerificationMode::DISABLED; 34 struct { 35 bool status = false; 36 } show; 37 bool verifyRuntimeLibraries = false; 38 bool syncOnClassInitialization = false; 39 size_t verificationThreads = 1; 40 struct { 41 std::string file; 42 bool updateOnExit = false; 43 } cache; 44 struct { 45 struct { 46 bool regChanges = false; 47 bool context = false; 48 bool typeSystem = false; 49 } show; 50 struct { 51 bool undefinedClass = false; 52 bool undefinedMethod = false; 53 bool undefinedField = false; 54 bool undefinedType = false; 55 bool undefinedString = false; 56 bool methodAccessViolation = false; 57 bool errorInExceptionHandler = false; 58 bool permanentRuntimeException = false; 59 bool fieldAccessViolation = false; 60 bool wrongSubclassingInMethodArgs = false; 61 } allow; 62 MethodOptionsConfig *methodOptions = nullptr; GetMethodOptionsark::verifier::VerificationOptions::__anon22663 MethodOptionsConfig &GetMethodOptions() 64 { 65 return *methodOptions; 66 } GetMethodOptionsark::verifier::VerificationOptions::__anon22667 const MethodOptionsConfig &GetMethodOptions() const 68 { 69 return *methodOptions; 70 } 71 } debug; 72 // NOLINTEND(misc-non-private-member-variables-in-classes) 73 74 void Initialize(); 75 void Destroy(); 76 IsEnabledark::verifier::VerificationOptions77 bool IsEnabled() const 78 { 79 return mode != VerificationMode::DISABLED; 80 } 81 IsOnlyVerifyark::verifier::VerificationOptions82 bool IsOnlyVerify() const 83 { 84 return mode == VerificationMode::AHEAD_OF_TIME || mode == VerificationMode::DEBUG; 85 } 86 }; 87 88 } // namespace ark::verifier 89 90 #endif // !PANDA_VERIFICATION_OPTIONS_H_ 91