[llvm] 6634c3e - [GOFF] Wrap debug output with LLVM_DEBUG (#87252)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 11:20:44 PDT 2024


Author: Kai Nacke
Date: 2024-04-01T14:20:41-04:00
New Revision: 6634c3e9377abf88c08bb065fb55aa15cda4c248

URL: https://github.com/llvm/llvm-project/commit/6634c3e9377abf88c08bb065fb55aa15cda4c248
DIFF: https://github.com/llvm/llvm-project/commit/6634c3e9377abf88c08bb065fb55aa15cda4c248.diff

LOG: [GOFF] Wrap debug output with LLVM_DEBUG (#87252)

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.

Added: 
    

Modified: 
    llvm/lib/Object/GOFFObjectFile.cpp

Removed: 
    


################################################################################
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.


        


More information about the llvm-commits mailing list