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