LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/main - main.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 23 24 95.8 %
Date: 2025-01-10 12:39:30 Functions: 1 1 100.0 %
Branches: 2 2 100.0 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Gereon Kremer, Morgan Deters, Mathias Preiner
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2024 by the authors listed in the file AUTHORS
       8                 :            :  * in the top-level source directory and their institutional affiliations.
       9                 :            :  * All rights reserved.  See the file COPYING in the top-level source
      10                 :            :  * directory for licensing information.
      11                 :            :  * ****************************************************************************
      12                 :            :  *
      13                 :            :  * Main driver for cvc5 executable.
      14                 :            :  */
      15                 :            : #include "main/main.h"
      16                 :            : 
      17                 :            : #include <cvc5/cvc5.h>
      18                 :            : 
      19                 :            : #include <iostream>
      20                 :            : 
      21                 :            : #include "base/configuration.h"
      22                 :            : #include "main/command_executor.h"
      23                 :            : #include "options/option_exception.h"
      24                 :            : 
      25                 :            : using namespace cvc5::internal;
      26                 :            : using namespace cvc5::main;
      27                 :            : 
      28                 :            : /**
      29                 :            :  * cvc5's main() routine is just an exception-safe wrapper around runCvc5.
      30                 :            :  */
      31                 :      26928 : int main(int argc, char* argv[])
      32                 :            : {
      33                 :      50004 :   cvc5::TermManager tm;
      34                 :      50004 :   std::unique_ptr<cvc5::Solver> solver = std::make_unique<cvc5::Solver>(tm);
      35                 :            :   try
      36                 :            :   {
      37                 :      26928 :     return runCvc5(argc, argv, solver);
      38                 :            :   }
      39                 :          8 :   catch (cvc5::CVC5ApiOptionException& e)
      40                 :            :   {
      41                 :            : #ifdef CVC5_COMPETITION_MODE
      42                 :            :     solver->getDriverOptions().out() << "unknown" << std::endl;
      43                 :            : #endif
      44                 :          4 :     std::cerr << "(error \"" << e.getMessage() << "\")" << std::endl
      45                 :          4 :               << std::endl
      46                 :          4 :               << "Please use --help to get help on command-line options."
      47                 :          4 :               << std::endl;
      48                 :            :   }
      49                 :          1 :   catch (OptionException& e)
      50                 :            :   {
      51                 :            : #ifdef CVC5_COMPETITION_MODE
      52                 :            :     solver->getDriverOptions().out() << "unknown" << std::endl;
      53                 :            : #endif
      54                 :          2 :     std::cerr << "(error \"" << e.getMessage() << "\")" << std::endl
      55                 :          1 :               << std::endl
      56                 :          1 :               << "Please use --help to get help on command-line options."
      57                 :          1 :               << std::endl;
      58                 :            :   }
      59                 :         96 :   catch (cvc5::CVC5ApiException& e)
      60                 :            :   {
      61                 :            : #ifdef CVC5_COMPETITION_MODE
      62                 :            :     solver->getDriverOptions().out() << "unknown" << std::endl;
      63                 :            : #endif
      64         [ +  + ]:         48 :     if (solver->getOption("output-language") == "LANG_SMTLIB_V2_6")
      65                 :            :     {
      66                 :         82 :       solver->getDriverOptions().out()
      67                 :         41 :           << "(error \"" << e << "\")" << std::endl;
      68                 :            :     }
      69                 :            :     else
      70                 :            :     {
      71                 :         14 :       solver->getDriverOptions().err()
      72                 :          7 :           << "(error \"" << e << "\")" << std::endl;
      73                 :            :     }
      74                 :         48 :     if (solver->getOptionInfo("stats").boolValue() && pExecutor != nullptr)
      75                 :            :     {
      76                 :          0 :       pExecutor->printStatistics(solver->getDriverOptions().err());
      77                 :            :     }
      78                 :            :   }
      79                 :            :   // Make sure that the command executor is destroyed before the node manager.
      80                 :         53 :   pExecutor.reset();
      81                 :         53 :   exit(1);
      82                 :            : }

Generated by: LCOV version 1.14