GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/main/main.cpp Lines: 14 16 87.5 %
Date: 2021-03-22 Branches: 31 65 47.7 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file main.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Morgan Deters, Tim King, Christopher L. Conway
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 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.\endverbatim
11
 **
12
 ** \brief Main driver for CVC4 executable
13
 **
14
 ** Main driver for CVC4 executable.
15
 **/
16
#include "main/main.h"
17
18
#include <cstdlib>
19
#include <cstring>
20
#include <fstream>
21
#include <iostream>
22
#include <stdio.h>
23
#include <unistd.h>
24
25
#include "base/configuration.h"
26
#include "base/output.h"
27
#include "main/command_executor.h"
28
#include "main/interactive_shell.h"
29
#include "options/language.h"
30
#include "options/options.h"
31
#include "parser/parser.h"
32
#include "parser/parser_builder.h"
33
#include "parser/parser_exception.h"
34
#include "util/result.h"
35
#include "util/statistics.h"
36
37
using namespace std;
38
using namespace CVC4;
39
using namespace CVC4::main;
40
using namespace CVC4::language;
41
42
/**
43
 * CVC4's main() routine is just an exception-safe wrapper around CVC4.
44
 * Please don't construct anything here.  Even if the constructor is
45
 * inside the try { }, an exception during destruction can cause
46
 * problems.  That's why main() wraps runCvc4() in the first place.
47
 * Put everything in runCvc4().
48
 */
49
7906
int main(int argc, char* argv[]) {
50
13342
  Options opts;
51
  try {
52
7906
    return runCvc4(argc, argv, opts);
53
2
  } catch(OptionException& e) {
54
#ifdef CVC4_COMPETITION_MODE
55
    *opts.getOut() << "unknown" << endl;
56
#endif
57
1
    cerr << "(error \"" << e << "\")" << endl
58
1
         << endl
59
1
         << "Please use --help to get help on command-line options." << endl;
60
42
  } catch(Exception& e) {
61
#ifdef CVC4_COMPETITION_MODE
62
    *opts.getOut() << "unknown" << endl;
63
#endif
64
21
    if (language::isOutputLang_smt2(opts.getOutputLanguage()))
65
    {
66
15
      *opts.getOut() << "(error \"" << e << "\")" << endl;
67
    } else {
68
6
      *opts.getErr() << "(error \"" << e << "\")" << endl;
69
    }
70
21
    if(opts.getStatistics() && pExecutor != NULL) {
71
      pTotalTime->stop();
72
      pExecutor->flushStatistics(*opts.getErr());
73
    }
74
  }
75
22
  exit(1);
76
23718
}