GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/base_options.cpp Lines: 11 115 9.6 %
Date: 2021-09-07 Branches: 7 75 9.3 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mathias Preiner, Aina Niemetz
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
 * Option template for option modules.
14
 *
15
 * For each <module>_options.toml configuration file, mkoptions.py
16
 * expands this template and generates a <module>_options.cpp file.
17
 */
18
#include "options/base_options.h"
19
20
#include <iostream>
21
22
#include "base/check.h"
23
#include "options/option_exception.h"
24
25
// clang-format off
26
namespace cvc5::options {
27
28
2
std::ostream& operator<<(std::ostream& os, OutputTag mode)
29
{
30
2
  switch(mode) {
31
    case OutputTag::SYGUS:
32
      return os << "OutputTag::SYGUS";
33
    case OutputTag::TRIGGER:
34
      return os << "OutputTag::TRIGGER";
35
    case OutputTag::INST:
36
      return os << "OutputTag::INST";
37
2
    case OutputTag::NONE:
38
2
      return os << "OutputTag::NONE";
39
    default:
40
      Unreachable();
41
  }
42
  return os;
43
}
44
3
OutputTag stringToOutputTag(const std::string& optarg)
45
{
46
3
  if (optarg == "sygus")
47
  {
48
1
    return OutputTag::SYGUS;
49
  }
50
2
  else if (optarg == "trigger")
51
  {
52
    return OutputTag::TRIGGER;
53
  }
54
2
  else if (optarg == "inst")
55
  {
56
2
    return OutputTag::INST;
57
  }
58
  else if (optarg == "none")
59
  {
60
    return OutputTag::NONE;
61
  }
62
  else if (optarg == "help")
63
  {
64
    std::cerr << "Output tags.\n"
65
         "Available tags for --output are:\n"
66
         "+ sygus\n"
67
         "  print enumerated terms and candidates generated by the sygus solver\n"
68
         "+ trigger\n"
69
         "  print selected triggers for quantified formulas\n"
70
         "+ inst\n"
71
         "  print instantiations during solving\n";
72
    std::exit(1);
73
  }
74
  throw OptionException(std::string("unknown option for --output: `") +
75
                        optarg + "'.  Try --output=help.");
76
}
77
78
namespace base
79
{
80
// clang-format off
81
void setDefaultErr(Options& opts, ManagedErr value)
82
{
83
    if (!opts.base.errWasSetByUser) {
84
        opts.base.err = value;
85
    }
86
}
87
void setDefaultIn(Options& opts, ManagedIn value)
88
{
89
    if (!opts.base.inWasSetByUser) {
90
        opts.base.in = value;
91
    }
92
}
93
void setDefaultIncrementalSolving(Options& opts, bool value)
94
{
95
    if (!opts.base.incrementalSolvingWasSetByUser) {
96
        opts.base.incrementalSolving = value;
97
    }
98
}
99
void setDefaultInputLanguage(Options& opts, Language value)
100
{
101
    if (!opts.base.inputLanguageWasSetByUser) {
102
        opts.base.inputLanguage = value;
103
    }
104
}
105
void setDefaultLanguageHelp(Options& opts, bool value)
106
{
107
    if (!opts.base.languageHelpWasSetByUser) {
108
        opts.base.languageHelp = value;
109
    }
110
}
111
void setDefaultOut(Options& opts, ManagedOut value)
112
{
113
    if (!opts.base.outWasSetByUser) {
114
        opts.base.out = value;
115
    }
116
}
117
void setDefaultOutputLanguage(Options& opts, Language value)
118
{
119
    if (!opts.base.outputLanguageWasSetByUser) {
120
        opts.base.outputLanguage = value;
121
    }
122
}
123
void setDefaultOutputTag(Options& opts, OutputTag value)
124
{
125
    if (!opts.base.outputTagWasSetByUser) {
126
        opts.base.outputTag = value;
127
    }
128
}
129
void setDefaultOutputTagHolder(Options& opts, std::bitset<OutputTag__numValues> value)
130
{
131
    if (!opts.base.outputTagHolderWasSetByUser) {
132
        opts.base.outputTagHolder = value;
133
    }
134
}
135
void setDefaultParseOnly(Options& opts, bool value)
136
{
137
    if (!opts.base.parseOnlyWasSetByUser) {
138
        opts.base.parseOnly = value;
139
    }
140
}
141
void setDefaultPreprocessOnly(Options& opts, bool value)
142
{
143
    if (!opts.base.preprocessOnlyWasSetByUser) {
144
        opts.base.preprocessOnly = value;
145
    }
146
}
147
void setDefaultPrintSuccess(Options& opts, bool value)
148
{
149
    if (!opts.base.printSuccessWasSetByUser) {
150
        opts.base.printSuccess = value;
151
    }
152
}
153
void setDefaultResourceWeightHolder(Options& opts, std::vector<std::string> value)
154
{
155
    if (!opts.base.resourceWeightHolderWasSetByUser) {
156
        opts.base.resourceWeightHolder = value;
157
    }
158
}
159
void setDefaultPerCallResourceLimit(Options& opts, uint64_t value)
160
{
161
    if (!opts.base.perCallResourceLimitWasSetByUser) {
162
        opts.base.perCallResourceLimit = value;
163
    }
164
}
165
void setDefaultCumulativeResourceLimit(Options& opts, uint64_t value)
166
{
167
    if (!opts.base.cumulativeResourceLimitWasSetByUser) {
168
        opts.base.cumulativeResourceLimit = value;
169
    }
170
}
171
void setDefaultStatistics(Options& opts, bool value)
172
{
173
    if (!opts.base.statisticsWasSetByUser) {
174
        opts.base.statistics = value;
175
    }
176
}
177
void setDefaultStatisticsAll(Options& opts, bool value)
178
{
179
    if (!opts.base.statisticsAllWasSetByUser) {
180
        opts.base.statisticsAll = value;
181
    }
182
}
183
void setDefaultStatisticsEveryQuery(Options& opts, bool value)
184
{
185
    if (!opts.base.statisticsEveryQueryWasSetByUser) {
186
        opts.base.statisticsEveryQuery = value;
187
    }
188
}
189
void setDefaultStatisticsExpert(Options& opts, bool value)
190
{
191
    if (!opts.base.statisticsExpertWasSetByUser) {
192
        opts.base.statisticsExpert = value;
193
    }
194
}
195
void setDefaultPerCallMillisecondLimit(Options& opts, uint64_t value)
196
{
197
    if (!opts.base.perCallMillisecondLimitWasSetByUser) {
198
        opts.base.perCallMillisecondLimit = value;
199
    }
200
}
201
void setDefaultCumulativeMillisecondLimit(Options& opts, uint64_t value)
202
{
203
    if (!opts.base.cumulativeMillisecondLimitWasSetByUser) {
204
        opts.base.cumulativeMillisecondLimit = value;
205
    }
206
}
207
void setDefaultVerbosity(Options& opts, int64_t value)
208
{
209
    if (!opts.base.verbosityWasSetByUser) {
210
        opts.base.verbosity = value;
211
    }
212
}
213
// clang-format on
214
}
215
216
29502
}  // namespace cvc5::options
217
// clang-format on