/* * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ABC2PROGRAM_ABC2PROGRAM_COMPILER_H #define ABC2PROGRAM_ABC2PROGRAM_COMPILER_H #include #include #include #include "common/abc2program_entity_container.h" namespace panda::abc2program { class Abc2ProgramCompiler { public: ~Abc2ProgramCompiler(); bool OpenAbcFile(const std::string &file_path); bool CheckFileVersionIsSupported(std::array min_version, uint8_t target_api_version, std::string target_api_sub_version) const; const panda_file::File &GetAbcFile() const; const panda_file::DebugInfoExtractor &GetDebugInfoExtractor() const; pandasm::Program *CompileAbcFile(); void CompileAbcClass(const panda_file::File::EntityId &record_id, pandasm::Program &program); bool CheckClassId(uint32_t class_id, size_t offset) const; private: bool IsVersionLessEqual(const std::array &version_1, const std::array &version_2) const; std::unique_ptr file_; std::unique_ptr debug_info_extractor_; // the single whole program compiled from the abc file, only used in non-parallel mode pandasm::Program *prog_ = nullptr; }; // class Abc2ProgramCompiler } // namespace panda::abc2program #endif // ABC2PROGRAM_ABC2PROGRAM_COMPILER_H