#include "system.hpp"
+#include "NonCopyable.hpp"
#include "legacy_util.hpp"
#include "third_party/fmt/core.h"
class Config;
-class Config
+class Config : NonCopyable
{
public:
Config() = default;
const std::string& key,
const std::string& value);
- // Clear the Config object and reset all values to defaults.
- void clear_and_reset();
-
private:
std::string m_primary_config_path;
std::string m_secondary_config_path;
const nonstd::optional<std::string>& env_var_key,
bool negate,
const std::string& origin);
-
- // These exist, but are private to be used in clear_and_reset()
- Config(const Config&) = default;
- Config& operator=(const Config&) = default;
};
inline const std::string&
// Reset the global state. Used by the test suite.
void
-cc_reset(Config& config)
+cc_reset()
{
- config.clear_and_reset();
-
free_and_nullify(current_working_dir);
free_and_nullify(included_pch_file);
free_and_nullify(cached_result_name);
struct args** preprocessor_args,
struct args** extra_args_to_hash,
struct args** compiler_args);
-void cc_reset(Config& config);
+void cc_reset();
bool is_precompiled_header(const char* path);
void
cct_test_begin(const char* name)
{
- Config config;
++total_tests;
if (verbose) {
printf("--- TEST: %s ---\n", name);
current_test = name;
x_setenv("CCACHE_CONFIG_PATH", "/dev/null");
- cc_reset(config);
}
void