[llvm] [GOFF] Wrap debug output with LLVM_DEBUG (PR #87252)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 1 09:08:19 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Kai Nacke (redstar)
<details>
<summary>Changes</summary>
The content of a GOFF record is always dumped if NDEBUG is not defined,
which produces rather confusing output. This changes wrap the dumping
code in LLVM_DEBUG, so the dump is only done when debug output of this
module is requested.
---
Full diff: https://github.com/llvm/llvm-project/pull/87252.diff
1 Files Affected:
- (modified) llvm/lib/Object/GOFFObjectFile.cpp (+3-6)
``````````diff
diff --git a/llvm/lib/Object/GOFFObjectFile.cpp b/llvm/lib/Object/GOFFObjectFile.cpp
index 76a13559ebfe35..d3dfd5d1540cfe 100644
--- a/llvm/lib/Object/GOFFObjectFile.cpp
+++ b/llvm/lib/Object/GOFFObjectFile.cpp
@@ -104,16 +104,13 @@ GOFFObjectFile::GOFFObjectFile(MemoryBufferRef Object, Error &Err)
PrevContinuationBits = I[1] & 0x03;
continue;
}
-
-#ifndef NDEBUG
- for (size_t J = 0; J < GOFF::RecordLength; ++J) {
+ LLVM_DEBUG(for (size_t J = 0; J < GOFF::RecordLength; ++J) {
const uint8_t *P = I + J;
if (J % 8 == 0)
dbgs() << " ";
-
dbgs() << format("%02hhX", *P);
- }
-#endif
+ });
+
switch (RecordType) {
case GOFF::RT_ESD: {
// Save ESD record.
``````````
</details>
https://github.com/llvm/llvm-project/pull/87252
More information about the llvm-commits
mailing list