diff --git a/tools/generators/grpc/xpcf_grpc_gen.cpp b/tools/generators/grpc/xpcf_grpc_gen.cpp index 4c6dbd6..f50268e 100755 --- a/tools/generators/grpc/xpcf_grpc_gen.cpp +++ b/tools/generators/grpc/xpcf_grpc_gen.cpp @@ -220,14 +220,6 @@ try serviceGenerator->setDestinationFolder(options["output"].as()); } - bool fileOptIsEmpty = !options.count("file") || options["file"].as().empty(); - bool databaseDirOptIsEmpty = !options.count("database_dir") || options["database_dir"].as().empty(); - - if (!fileOptIsEmpty && !databaseDirOptIsEmpty) { - print_error("--file and --database_dir cannot be both set"); - return 1; - } - auto astParser = cmpMgr->resolve("astParser"); int result = astParser->initOptions(options); @@ -237,19 +229,21 @@ try cppast::cpp_entity_index idx; // the entity index is used to resolve cross references in the AST - if (!databaseDirOptIsEmpty) { - assert(fileOptIsEmpty); - if (int res = astParser->parse_database(options["database_dir"].as(),options) != 0) { - return res; + if (!options.count("file") || options["file"].as().empty()) { + if (options.count("database_dir") && !options["database_dir"].as().empty()) { + std::cout<<"File argument is missing : parsing every file listed in database"<parse_database(options["database_dir"].as(),options); + //parse_database(options["database_dir"].as(),idx,options, [&](const cppast::cpp_entity_index& idx, std::ostream& out, const cppast::cpp_file& file) { astParser->parseAst(idx,out,file); }); } - //parse_database(options["database_dir"].as(),idx,options, [&](const cppast::cpp_entity_index& idx, std::ostream& out, const cppast::cpp_file& file) { astParser->parseAst(idx,out,file); }); - } else if (!fileOptIsEmpty) { - if (int res = astParser->parse_file(options["file"].as(), options.count("fatal_errors") == 1) != 0) { - return res; + else { + print_error("missing one of file or database dir argument"); + return 1; } - } else { - print_error("missing one of --file or --database_dir argument"); - return 1; + } + else { + result = astParser->parse_file(options["file"].as(), options.count("fatal_errors") == 1); + if (result != 0) + return result; } //update types : try to qualify non fqdn types in parameters ... from classes found during parsing