LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/main - main.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 27 28 96.4 %
Date: 2026-03-16 10:41:14 Functions: 1 1 100.0 %
Branches: 5 6 83.3 %

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

Generated by: LCOV version 1.14