From 70ff2d3f2a98dfbd3107a332fb2f7672bc6b3760 Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@sandoe.co.uk>
Date: Mon, 18 Mar 2019 13:57:01 +0000
Subject: [PATCH] [llvm, dsymutil] Mark debug stuff as debug.

---
 llvm/tools/dsymutil/DebugMap.cpp            |  7 ++++---
 llvm/tools/dsymutil/MachODebugMapParser.cpp | 10 ++++++----
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/llvm/tools/dsymutil/DebugMap.cpp b/llvm/tools/dsymutil/DebugMap.cpp
index 302bb0f8bc7..f7099c0a1eb 100644
--- a/llvm/tools/dsymutil/DebugMap.cpp
+++ b/llvm/tools/dsymutil/DebugMap.cpp
@@ -34,6 +34,7 @@
 #include <vector>
 
 #include "llvm/Support/Debug.h"
+#define DEBUG_TYPE "dsymutil"
 
 namespace llvm {
 
@@ -94,14 +95,14 @@ DebugMap::addDebugMapObject(StringRef ObjectFilePath,
 
 const DebugMapObject::DebugMapEntry *
 DebugMapObject::lookupSymbol(StringRef SymbolName) const {
-dbgs () << "looking for " << SymbolName;
+  LLVM_DEBUG(dbgs () << "looking for " << SymbolName);
   StringMap<SymbolMapping>::const_iterator Sym = Symbols.find(SymbolName);
   if (Sym == Symbols.end())
     {
-      dbgs () << " NO\n";
+      LLVM_DEBUG(dbgs () << " NO\n");
     return nullptr;
     }
-  dbgs () << " OK\n";
+  LLVM_DEBUG(dbgs () << " OK\n");
   return &*Sym;
 }
 
diff --git a/llvm/tools/dsymutil/MachODebugMapParser.cpp b/llvm/tools/dsymutil/MachODebugMapParser.cpp
index edcf92d22f5..344443817c7 100644
--- a/llvm/tools/dsymutil/MachODebugMapParser.cpp
+++ b/llvm/tools/dsymutil/MachODebugMapParser.cpp
@@ -18,6 +18,8 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 
+#define DEBUG_TYPE "dsymutil"
+
 namespace {
 using namespace llvm;
 using namespace llvm::dsymutil;
@@ -153,7 +155,7 @@ void MachODebugMapParser::switchToNewDebugMapObject(
 
   CurrentDebugMapObject =
       &Result->addDebugMapObject(Path, Timestamp, MachO::N_OSO);
-dbgs () << " loading symbols for : " + Path.str() + "\n";
+  LLVM_DEBUG(dbgs () << " loading symbols for : " + Path.str() + "\n");
   loadCurrentObjectFileSymbols(*Object);
 }
 
@@ -457,7 +459,7 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols(
     uint64_t Addr = Sym.getValue();
     Expected<StringRef> Name = Sym.getName();
     if (!Name) {
-dbgs() << " <empty name>\n";
+      LLVM_DEBUG(dbgs() << " <empty name>\n");
       // TODO: Actually report errors helpfully.
       consumeError(Name.takeError());
       continue;
@@ -477,7 +479,7 @@ dbgs() << " <empty name>\n";
       CurrentObjectAddresses[*Name] = Addr;
     Expected<SymbolRef::Type> TypeOrErr = Sym.getType();
     if (!TypeOrErr) {
-dbgs() << " bade type?\n";
+      LLVM_DEBUG(dbgs() << " bad type?\n");
       // TODO: Actually report errors helpfully.
       consumeError(TypeOrErr.takeError());
       continue;
@@ -501,7 +503,7 @@ dbgs() << " bade type?\n";
     StringRef SectName;
     Section->getName(SectName);
     if (SectName == "__debug_info") {
-dbgs() << *Name << " " << SectName << format(" 0x%llx\n", Addr);
+      LLVM_DEBUG(dbgs() << *Name << " " << SectName << format(" 0x%llx\n", Addr));
       CurrentDebugMapObject->addSymbol(*Name, Addr, 0, 0);
     }
   }
