MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / processOutputDirectory_

Method processOutputDirectory_

src/CommandLine/CommandLineParser.cpp:738–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736}
737
738void CommandLineParser::processOutputDirectory_(
739 const std::vector<std::string>& args) {
740 FileSystem* const fileSystem = FileSystem::getInstance();
741 fs::path wd = fileSystem->getWorkingDir();
742 for (size_t i = 0; i < args.size(); i++) {
743 std::string arg(undecorateArg(args[i]));
744
745 if (arg == "-wd") {
746 if (i == args.size() - 1) {
747 Location loc(m_symbolTable->registerSymbol(args[i]));
748 Error err(ErrorDefinition::CMD_WD_MISSING_DIR, loc);
749 m_errors->addError(err);
750 break;
751 }
752 fs::path rwd = undecorateArg(args[++i]);
753 wd = rwd.is_relative() ? fileSystem->getWorkingDir() / rwd : rwd;
754 } else if (arg == "-odir" || arg == "-o" || arg == "--Mdir") {
755 if (i == args.size() - 1) {
756 Location loc(m_symbolTable->registerSymbol(args[i]));
757 Error err(ErrorDefinition::CMD_PP_FILE_MISSING_ODIR, loc);
758 m_errors->addError(err);
759 break;
760 }
761
762 fs::path outputDir = undecorateArg(args[++i]);
763 if (outputDir.is_relative()) outputDir = wd / outputDir;
764 m_outputDirId =
765 fileSystem->getOutputDir(outputDir.string(), m_symbolTable);
766 } else if (arg == "-l") {
767 if (i == args.size() - 1) {
768 Location loc(m_symbolTable->registerSymbol(arg));
769 Error err(ErrorDefinition::CMD_LOG_FILE_MISSING_FILE, loc);
770 m_errors->addError(err);
771 break;
772 }
773 m_logFileNameId = m_symbolTable->registerSymbol(undecorateArg(args[++i]));
774 }
775 }
776}
777
778bool CommandLineParser::parseCommandLine(int32_t argc, const char** argv) {
779 FileSystem* const fileSystem = FileSystem::getInstance();

Callers

nothing calls this directly

Calls 5

undecorateArgFunction · 0.85
getOutputDirMethod · 0.80
getWorkingDirMethod · 0.45
registerSymbolMethod · 0.45
addErrorMethod · 0.45

Tested by

no test coverage detected