Skip to content

Commit

Permalink
Support -debug-glow-only even in release builds
Browse files Browse the repository at this point in the history
Reviewed By: junhanh

Differential Revision: D54523800

fbshipit-source-id: d267fd4466afea2bd24f1b1cf97f4c22099cced4
  • Loading branch information
Roman Levenstein authored and facebook-github-bot committed Mar 5, 2024
1 parent 9ecc93a commit 0c03ae9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions include/glow/Support/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

namespace glow {

#ifndef NDEBUG
#if !defined(NDEBUG) && !defined(DISABLE_DEBUG_GLOW)

/// \returns true if \p type matches the activated debug type.
bool isCurrentDebugType(const char *type);
bool isGlowCurrentDebugType(const char *type);

/// Macro to perform debug actions when TYPE is activated.
#define DEBUG_GLOW_WITH_TYPE(TYPE, X) \
do { \
if (glow::DebugFlag || glow::isCurrentDebugType(TYPE)) { \
if (glow::DebugFlag || glow::isGlowCurrentDebugType(TYPE)) { \
X; \
} \
} while (false)
Expand Down
2 changes: 0 additions & 2 deletions lib/Optimizer/IROptimizer/IROptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,10 @@ class LiveIntervalsInstructionNumbering {
};
} // namespace

#ifndef NDEBUG
llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Interval &I) {
os << I.str();
return os;
}
#endif

/// Set of intervals for a single memory buffer. If there is only one write into
/// a memory buffer, it would contain a single interval. If there are multiple
Expand Down
4 changes: 2 additions & 2 deletions lib/Support/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace glow {
/// Exported boolean set by -debug-glow option.
bool DebugFlag = false;

#ifndef NDEBUG
bool isCurrentDebugType(const char *type) {
#if !defined(NDEBUG) && !defined(DISABLE_DEBUG_GLOW)
bool isGlowCurrentDebugType(const char *type) {
return std::find(DebugGlowOnly.begin(), DebugGlowOnly.end(), type) !=
DebugGlowOnly.end();
}
Expand Down

0 comments on commit 0c03ae9

Please sign in to comment.