forked from revng/revng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.cpp
38 lines (31 loc) · 889 Bytes
/
debug.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// \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);
}