GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/main/main.cpp Lines: 14 15 93.3 %
Date: 2021-03-23 Branches: 31 63 49.2 %

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
36
using namespace std;
37
using namespace CVC4;
38
using namespace CVC4::main;
39
using namespace CVC4::language;
40
41
/**
42
 * CVC4's main() routine is just an exception-safe wrapper around CVC4.
43
 * Please don't construct anything here.  Even if the constructor is
44
 * inside the try { }, an exception during destruction can cause
45
 * problems.  That's why main() wraps runCvc4() in the first place.
46
 * Put everything in runCvc4().
47
 */
48
7909
int main(int argc, char* argv[]) {
49
13347
  Options opts;
50
  try {
51
7909
    return runCvc4(argc, argv, opts);
52
2
  } catch(OptionException& e) {
53
#ifdef CVC4_COMPETITION_MODE
54
    *opts.getOut() << "unknown" << endl;
55
#endif
56
1
    cerr << "(error \"" << e << "\")" << endl
57
1
         << endl
58
1
         << "Please use --help to get help on command-line options." << endl;
59
42
  } catch(Exception& e) {
60
#ifdef CVC4_COMPETITION_MODE
61
    *opts.getOut() << "unknown" << endl;
62
#endif
63
21
    if (language::isOutputLang_smt2(opts.getOutputLanguage()))
64
    {
65
15
      *opts.getOut() << "(error \"" << e << "\")" << endl;
66
    } else {
67
6
      *opts.getErr() << "(error \"" << e << "\")" << endl;
68
    }
69
21
    if(opts.getStatistics() && pExecutor != NULL) {
70
      pExecutor->flushStatistics(*opts.getErr());
71
    }
72
  }
73
22
  exit(1);
74
23727
}