mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
27 lines
718 B
C++
27 lines
718 B
C++
#ifndef _DEBUG_H
|
|
#define _DEBUG_H
|
|
|
|
// Standard includes
|
|
#include <ostream>
|
|
|
|
// LLVM includes
|
|
#include "llvm/Support/Debug.h"
|
|
|
|
// TODO: use a dedicated namespace
|
|
extern bool DebuggingEnabled;
|
|
extern std::ostream& dbg;
|
|
|
|
bool isDebugFeatureEnabled(std::string Name);
|
|
void enableDebugFeature(std::string Name);
|
|
void disableDebugFeature(std::string Name);
|
|
|
|
/// Executes \p code only if \p feature is enabled
|
|
#define DBG(feature, code) do { \
|
|
if (DebuggingEnabled && isDebugFeatureEnabled(feature)) { \
|
|
code; \
|
|
} \
|
|
} while (0)
|
|
|
|
|
|
#endif // _DEBUG_H
|