mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
39 lines
889 B
C++
39 lines
889 B
C++
/// \file debug.cpp
|
|
/// \brief
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
// Standard includes
|
|
#include <algorithm>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// Local includes
|
|
#include "debug.h"
|
|
|
|
bool DebuggingEnabled = false;
|
|
std::ostream& dbg(std::cerr);
|
|
static std::vector<std::string> DebugFeatures;
|
|
|
|
bool isDebugFeatureEnabled(std::string Name) {
|
|
return std::find(DebugFeatures.begin(),
|
|
DebugFeatures.end(),
|
|
Name) != DebugFeatures.end();
|
|
}
|
|
|
|
void enableDebugFeature(std::string Name) {
|
|
if (!isDebugFeatureEnabled(Name))
|
|
DebugFeatures.push_back(Name);
|
|
}
|
|
|
|
void disableDebugFeature(std::string Name) {
|
|
auto It = std::find(DebugFeatures.begin(),
|
|
DebugFeatures.end(),
|
|
Name);
|
|
if (It != DebugFeatures.end())
|
|
DebugFeatures.erase(It);
|
|
}
|