GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/options.cpp Lines: 57 57 100.0 %
Date: 2021-08-01 Branches: 26 52 50.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Morgan Deters, Tim King, Andrew Reynolds
4
 *
5
 * This file is part of the cvc5 project.
6
 *
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.
11
 * ****************************************************************************
12
 *
13
 * Contains code for handling command-line options.
14
 */
15
16
#include "options/options.h"
17
18
#include "base/check.h"
19
#include "base/exception.h"
20
#include "base/output.h"
21
#include "options/language.h"
22
#include "options/options_handler.h"
23
#include "options/options_listener.h"
24
25
// clang-format off
26
#include "options/arith_options.h"
27
#include "options/arrays_options.h"
28
#include "options/base_options.h"
29
#include "options/booleans_options.h"
30
#include "options/builtin_options.h"
31
#include "options/bv_options.h"
32
#include "options/datatypes_options.h"
33
#include "options/decision_options.h"
34
#include "options/expr_options.h"
35
#include "options/fp_options.h"
36
#include "options/main_options.h"
37
#include "options/parser_options.h"
38
#include "options/printer_options.h"
39
#include "options/proof_options.h"
40
#include "options/prop_options.h"
41
#include "options/quantifiers_options.h"
42
#include "options/sep_options.h"
43
#include "options/sets_options.h"
44
#include "options/smt_options.h"
45
#include "options/strings_options.h"
46
#include "options/theory_options.h"
47
#include "options/uf_options.h"
48
49
#include "base/cvc5config.h"
50
51
52
53
using namespace cvc5;
54
using namespace cvc5::options;
55
// clang-format on
56
57
namespace cvc5
58
{
59
  thread_local Options* Options::s_current = nullptr;
60
61
27390
  Options::Options(OptionsListener * ol)
62
      :
63
        d_olisten(ol),
64
// clang-format off
65
        d_arith(std::make_unique<options::HolderARITH>()),
66
        d_arrays(std::make_unique<options::HolderARRAYS>()),
67
        d_base(std::make_unique<options::HolderBASE>()),
68
        d_booleans(std::make_unique<options::HolderBOOLEANS>()),
69
        d_builtin(std::make_unique<options::HolderBUILTIN>()),
70
        d_bv(std::make_unique<options::HolderBV>()),
71
        d_datatypes(std::make_unique<options::HolderDATATYPES>()),
72
        d_decision(std::make_unique<options::HolderDECISION>()),
73
        d_expr(std::make_unique<options::HolderEXPR>()),
74
        d_fp(std::make_unique<options::HolderFP>()),
75
        d_driver(std::make_unique<options::HolderDRIVER>()),
76
        d_parser(std::make_unique<options::HolderPARSER>()),
77
        d_printer(std::make_unique<options::HolderPRINTER>()),
78
        d_proof(std::make_unique<options::HolderPROOF>()),
79
        d_prop(std::make_unique<options::HolderPROP>()),
80
        d_quantifiers(std::make_unique<options::HolderQUANTIFIERS>()),
81
        d_sep(std::make_unique<options::HolderSEP>()),
82
        d_sets(std::make_unique<options::HolderSETS>()),
83
        d_smt(std::make_unique<options::HolderSMT>()),
84
        d_strings(std::make_unique<options::HolderSTRINGS>()),
85
        d_theory(std::make_unique<options::HolderTHEORY>()),
86
        d_uf(std::make_unique<options::HolderUF>()),
87
27390
        arith(*d_arith),
88
27390
        arrays(*d_arrays),
89
27390
        base(*d_base),
90
27390
        booleans(*d_booleans),
91
27390
        builtin(*d_builtin),
92
27390
        bv(*d_bv),
93
27390
        datatypes(*d_datatypes),
94
27390
        decision(*d_decision),
95
27390
        expr(*d_expr),
96
27390
        fp(*d_fp),
97
27390
        driver(*d_driver),
98
27390
        parser(*d_parser),
99
27390
        printer(*d_printer),
100
27390
        proof(*d_proof),
101
27390
        prop(*d_prop),
102
27390
        quantifiers(*d_quantifiers),
103
27390
        sep(*d_sep),
104
27390
        sets(*d_sets),
105
27390
        smt(*d_smt),
106
27390
        strings(*d_strings),
107
27390
        theory(*d_theory),
108
27390
        uf(*d_uf),
109
// clang-format on
110
629970
        d_handler(std::make_unique<options::OptionsHandler>(this))
111
  {
112
27390
  }
113
114
24770
  Options::~Options() {}
115
116
17005
void Options::copyValues(const Options& options){
117
17005
  if(this != &options) {
118
// clang-format off
119
17005
      *d_arith = *options.d_arith;
120
17005
      *d_arrays = *options.d_arrays;
121
17005
      *d_base = *options.d_base;
122
17005
      *d_booleans = *options.d_booleans;
123
17005
      *d_builtin = *options.d_builtin;
124
17005
      *d_bv = *options.d_bv;
125
17005
      *d_datatypes = *options.d_datatypes;
126
17005
      *d_decision = *options.d_decision;
127
17005
      *d_expr = *options.d_expr;
128
17005
      *d_fp = *options.d_fp;
129
17005
      *d_driver = *options.d_driver;
130
17005
      *d_parser = *options.d_parser;
131
17005
      *d_printer = *options.d_printer;
132
17005
      *d_proof = *options.d_proof;
133
17005
      *d_prop = *options.d_prop;
134
17005
      *d_quantifiers = *options.d_quantifiers;
135
17005
      *d_sep = *options.d_sep;
136
17005
      *d_sets = *options.d_sets;
137
17005
      *d_smt = *options.d_smt;
138
17005
      *d_strings = *options.d_strings;
139
17005
      *d_theory = *options.d_theory;
140
17005
      *d_uf = *options.d_uf;
141
// clang-format on
142
  }
143
17005
}
144
145
10480
void Options::setListener(OptionsListener* ol) { d_olisten = ol; }
146
147
9524
void Options::notifyListener(const std::string& key)
148
  {
149
9524
    if (d_olisten != nullptr)
150
    {
151
9524
      d_olisten->notifySetOption(key);
152
    }
153
9524
  }
154
155
29280
}  // namespace cvc5
156