GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/src/options/base_options.cpp Lines: 13 86 15.1 %
Date: 2021-09-17 Branches: 16 78 20.5 %

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
namespace cvc5::options {
26
27
// clang-format off
28
2
std::ostream& operator<<(std::ostream& os, OutputTag mode)
29
{
30
2
  switch(mode)
31
  {
32
    case OutputTag::TRIGGER: return os << "OutputTag::TRIGGER";
33
    case OutputTag::SYGUS: return os << "OutputTag::SYGUS";
34
2
    case OutputTag::NONE: return os << "OutputTag::NONE";
35
    case OutputTag::INST: return os << "OutputTag::INST";
36
    case OutputTag::RAW_BENCHMARK: return os << "OutputTag::RAW_BENCHMARK";
37
    default: Unreachable();
38
  }
39
  return os;
40
}
41
298630
OutputTag stringToOutputTag(const std::string& optarg)
42
{
43
298630
  if (optarg == "trigger") return OutputTag::TRIGGER;
44
298630
  else if (optarg == "sygus") return OutputTag::SYGUS;
45
298629
  else if (optarg == "none") return OutputTag::NONE;
46
298629
  else if (optarg == "inst") return OutputTag::INST;
47
298617
  else if (optarg == "raw-benchmark") return OutputTag::RAW_BENCHMARK;
48
4
  else if (optarg == "help")
49
  {
50
    std::cerr << R"FOOBAR(
51
  Output tags.
52
Available tags for --output are:
53
+ trigger
54
  print selected triggers for quantified formulas
55
+ sygus
56
  print enumerated terms and candidates generated by the sygus solver
57
+ inst
58
  print instantiations during solving
59
+ raw-benchmark
60
  print the benchmark back on the output verbatim as it is processed
61
)FOOBAR";
62
    std::exit(1);
63
  }
64
8
  throw OptionException(std::string("unknown option for --output: `") +
65
12
                        optarg + "'.  Try --output=help.");
66
}
67
// clang-format on
68
69
namespace base
70
{
71
// clang-format off
72
void setDefaultErr(Options& opts, ManagedErr value)
73
{
74
    if (!opts.base.errWasSetByUser) opts.base.err = value;
75
}
76
void setDefaultIn(Options& opts, ManagedIn value)
77
{
78
    if (!opts.base.inWasSetByUser) opts.base.in = value;
79
}
80
void setDefaultIncrementalSolving(Options& opts, bool value)
81
{
82
    if (!opts.base.incrementalSolvingWasSetByUser) opts.base.incrementalSolving = value;
83
}
84
void setDefaultInputLanguage(Options& opts, Language value)
85
{
86
    if (!opts.base.inputLanguageWasSetByUser) opts.base.inputLanguage = value;
87
}
88
void setDefaultLanguageHelp(Options& opts, bool value)
89
{
90
    if (!opts.base.languageHelpWasSetByUser) opts.base.languageHelp = value;
91
}
92
void setDefaultOut(Options& opts, ManagedOut value)
93
{
94
    if (!opts.base.outWasSetByUser) opts.base.out = value;
95
}
96
void setDefaultOutputTag(Options& opts, OutputTag value)
97
{
98
    if (!opts.base.outputTagWasSetByUser) opts.base.outputTag = value;
99
}
100
void setDefaultOutputLanguage(Options& opts, Language value)
101
{
102
    if (!opts.base.outputLanguageWasSetByUser) opts.base.outputLanguage = value;
103
}
104
void setDefaultParseOnly(Options& opts, bool value)
105
{
106
    if (!opts.base.parseOnlyWasSetByUser) opts.base.parseOnly = value;
107
}
108
void setDefaultPreprocessOnly(Options& opts, bool value)
109
{
110
    if (!opts.base.preprocessOnlyWasSetByUser) opts.base.preprocessOnly = value;
111
}
112
void setDefaultPrintSuccess(Options& opts, bool value)
113
{
114
    if (!opts.base.printSuccessWasSetByUser) opts.base.printSuccess = value;
115
}
116
void setDefaultCumulativeResourceLimit(Options& opts, uint64_t value)
117
{
118
    if (!opts.base.cumulativeResourceLimitWasSetByUser) opts.base.cumulativeResourceLimit = value;
119
}
120
void setDefaultPerCallResourceLimit(Options& opts, uint64_t value)
121
{
122
    if (!opts.base.perCallResourceLimitWasSetByUser) opts.base.perCallResourceLimit = value;
123
}
124
void setDefaultStatistics(Options& opts, bool value)
125
{
126
    if (!opts.base.statisticsWasSetByUser) opts.base.statistics = value;
127
}
128
void setDefaultStatisticsAll(Options& opts, bool value)
129
{
130
    if (!opts.base.statisticsAllWasSetByUser) opts.base.statisticsAll = value;
131
}
132
void setDefaultStatisticsEveryQuery(Options& opts, bool value)
133
{
134
    if (!opts.base.statisticsEveryQueryWasSetByUser) opts.base.statisticsEveryQuery = value;
135
}
136
void setDefaultStatisticsExpert(Options& opts, bool value)
137
{
138
    if (!opts.base.statisticsExpertWasSetByUser) opts.base.statisticsExpert = value;
139
}
140
void setDefaultCumulativeMillisecondLimit(Options& opts, uint64_t value)
141
{
142
    if (!opts.base.cumulativeMillisecondLimitWasSetByUser) opts.base.cumulativeMillisecondLimit = value;
143
}
144
void setDefaultPerCallMillisecondLimit(Options& opts, uint64_t value)
145
{
146
    if (!opts.base.perCallMillisecondLimitWasSetByUser) opts.base.perCallMillisecondLimit = value;
147
}
148
void setDefaultVerbosity(Options& opts, int64_t value)
149
{
150
    if (!opts.base.verbosityWasSetByUser) opts.base.verbosity = value;
151
}
152
void setDefaultResourceWeightHolder(Options& opts, std::vector<std::string> value)
153
{
154
    if (!opts.base.resourceWeightHolderWasSetByUser) opts.base.resourceWeightHolder = value;
155
}
156
void setDefaultOutputTagHolder(Options& opts, std::bitset<OutputTag__numValues> value)
157
{
158
    if (!opts.base.outputTagHolderWasSetByUser) opts.base.outputTagHolder = value;
159
}
160
// clang-format on
161
}
162
163
29577
}  // namespace cvc5::options