arkcompiler_runtime_core/verifier/main.cpp
chenyiyuan b6dd1322b5 Verify Constant Pool Support
Signed-off-by: chenyiyuan <chenyiyuan6@huawei.com>
Change-Id: I37eb1375440de5a8a28fc70ce223d9f4455c8293
2023-11-13 23:30:50 +08:00

58 lines
1.7 KiB
C++
Executable File

/*
* Copyright (c) 2023 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.
*/
#include "verify.h"
#include "utils/pandargs.h"
void PrintHelp(panda::PandArgParser &pa_parser)
{
std::cerr << "Usage:" << std::endl;
std::cerr << "ark_verifier [options] input_file" << std::endl;
std::cerr << "Supported options:" << std::endl;
std::cerr << pa_parser.GetHelpString() << std::endl;
}
bool PorcessArgs(panda::PandArgParser &pa_parser, const panda::PandArg<std::string> &input_file, int argc,
const char **argv)
{
if (!pa_parser.Parse(argc, argv)) {
PrintHelp(pa_parser);
return false;
}
if (input_file.GetValue().empty()) {
PrintHelp(pa_parser);
return false;
}
return true;
}
int main(int argc, const char **argv)
{
panda::PandArg<bool> help("help", false, "Print this message and exit");
panda::PandArg<std::string> input_file("input_file", "", "Path to the abc file");
panda::PandArgParser pa_parser;
pa_parser.Add(&help);
pa_parser.Add(&input_file);
if (!PorcessArgs(pa_parser, input_file, argc, argv)) {
return 1;
}
return Verify(input_file.GetValue()) ? 0 : 1;
}