Author: Pavel Labath
Date: 2022-01-28T10:41:10+01:00
New Revision: 2d75f627221e434c9ff64cdd2c47da9dcb437967

URL: 
https://github.com/llvm/llvm-project/commit/2d75f627221e434c9ff64cdd2c47da9dcb437967
DIFF: 
https://github.com/llvm/llvm-project/commit/2d75f627221e434c9ff64cdd2c47da9dcb437967.diff

LOG: [lldb] Convert DWARF log to the new API

This also deletes some dead log statements (log initialization commented
out).

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
    lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
    lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
    lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
index 4e09b523b7781..ec4057efbbc54 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -122,8 +122,7 @@ void AppleDWARFIndex::GetTypes(
   if (!m_apple_types_up)
     return;
 
-  Log *log = LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                          DWARF_LOG_LOOKUPS);
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
   const bool has_tag = m_apple_types_up->GetHeader().header_data.ContainsAtom(
       DWARFMappedHash::eAtomTypeTag);
   const bool has_qualified_name_hash =

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index be555c130bfee..2daffecee58e9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -443,8 +443,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const 
SymbolContext &sc,
   if (!die)
     return nullptr;
 
-  Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                        DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
 
   SymbolFileDWARF *dwarf = die.GetDWARF();
   if (log) {
@@ -548,8 +547,7 @@ lldb::TypeSP
 DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
                                        const DWARFDIE &die,
                                        ParsedDWARFTypeAttributes &attrs) {
-  Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                        DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
   SymbolFileDWARF *dwarf = die.GetDWARF();
   const dw_tag_t tag = die.Tag();
   LanguageType cu_language = SymbolFileDWARF::GetLanguage(*die.GetCU());
@@ -771,8 +769,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext 
&sc,
 TypeSP DWARFASTParserClang::ParseEnum(const SymbolContext &sc,
                                       const DWARFDIE &die,
                                       ParsedDWARFTypeAttributes &attrs) {
-  Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                        DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
   SymbolFileDWARF *dwarf = die.GetDWARF();
   const dw_tag_t tag = die.Tag();
   TypeSP type_sp;
@@ -900,8 +897,7 @@ ConvertDWARFCallingConventionToClang(const 
ParsedDWARFTypeAttributes &attrs) {
     break;
   }
 
-  Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                        DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
   LLDB_LOG(log, "Unsupported DW_AT_calling_convention value: {0}",
            attrs.calling_convention);
   // Use the default calling convention as a fallback.
@@ -910,8 +906,7 @@ ConvertDWARFCallingConventionToClang(const 
ParsedDWARFTypeAttributes &attrs) {
 
 TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
                            ParsedDWARFTypeAttributes &attrs) {
-  Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                        DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
 
   SymbolFileDWARF *dwarf = die.GetDWARF();
   const dw_tag_t tag = die.Tag();
@@ -1562,8 +1557,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   const dw_tag_t tag = die.Tag();
   SymbolFileDWARF *dwarf = die.GetDWARF();
   LanguageType cu_language = SymbolFileDWARF::GetLanguage(*die.GetCU());
-  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_TYPE_COMPLETION |
-                                          DWARF_LOG_LOOKUPS);
+  Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
 
   // UniqueDWARFASTType is large, so don't create a local variables on the
   // stack, put it on the heap. This function is often called recursively and
@@ -2214,12 +2208,6 @@ bool DWARFASTParserClang::CompleteTypeFromDWARF(const 
DWARFDIE &die,
 
   const dw_tag_t tag = die.Tag();
 
-  Log *log =
-      nullptr; // 
(LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
-  if (log)
-    dwarf->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
-        log, "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...",
-        die.GetID(), die.GetTagAsCString(), type->GetName().AsCString());
   assert(clang_type);
   DWARFAttributes attributes;
   switch (tag) {
@@ -3452,30 +3440,6 @@ DWARFASTParserClang::ResolveNamespaceDIE(const DWARFDIE 
&die) {
       namespace_decl = m_ast.GetUniqueNamespaceDeclaration(
           namespace_name, containing_decl_ctx, GetOwningClangModule(die),
           is_inline);
-      Log *log =
-          nullptr; // (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
-      if (log) {
-        SymbolFileDWARF *dwarf = die.GetDWARF();
-        if (namespace_name) {
-          dwarf->GetObjectFile()->GetModule()->LogMessage(
-              log,
-              "ASTContext => %p: 0x%8.8" PRIx64
-              ": DW_TAG_namespace with DW_AT_name(\"%s\") => "
-              "clang::NamespaceDecl *%p (original = %p)",
-              static_cast<void *>(&m_ast.getASTContext()), die.GetID(),
-              namespace_name, static_cast<void *>(namespace_decl),
-              static_cast<void *>(namespace_decl->getOriginalNamespace()));
-        } else {
-          dwarf->GetObjectFile()->GetModule()->LogMessage(
-              log,
-              "ASTContext => %p: 0x%8.8" PRIx64
-              ": DW_TAG_namespace (anonymous) => clang::NamespaceDecl *%p "
-              "(original = %p)",
-              static_cast<void *>(&m_ast.getASTContext()), die.GetID(),
-              static_cast<void *>(namespace_decl),
-              static_cast<void *>(namespace_decl->getOriginalNamespace()));
-        }
-      }
 
       if (namespace_decl)
         LinkDeclContextToDIE((clang::DeclContext *)namespace_decl, die);
@@ -3580,23 +3544,12 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
   }
   const uint32_t src_size = src_name_to_die.GetSize();
   const uint32_t dst_size = dst_name_to_die.GetSize();
-  Log *log = nullptr; // (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO |
-                      // DWARF_LOG_TYPE_COMPLETION));
 
   // Is everything kosher so we can go through the members at top speed?
   bool fast_path = true;
 
-  if (src_size != dst_size) {
-    if (src_size != 0 && dst_size != 0) {
-      LLDB_LOGF(log,
-                "warning: trying to unique class DIE 0x%8.8x to 0x%8.8x, "
-                "but they didn't have the same size (src=%d, dst=%d)",
-                src_class_die.GetOffset(), dst_class_die.GetOffset(), src_size,
-                dst_size);
-    }
-
+  if (src_size != dst_size)
     fast_path = false;
-  }
 
   uint32_t idx;
 
@@ -3605,15 +3558,8 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
       src_die = src_name_to_die.GetValueAtIndexUnchecked(idx);
       dst_die = dst_name_to_die.GetValueAtIndexUnchecked(idx);
 
-      if (src_die.Tag() != dst_die.Tag()) {
-        LLDB_LOGF(log,
-                  "warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, "
-                  "but 0x%8.8x (%s) tags didn't match 0x%8.8x (%s)",
-                  src_class_die.GetOffset(), dst_class_die.GetOffset(),
-                  src_die.GetOffset(), src_die.GetTagAsCString(),
-                  dst_die.GetOffset(), dst_die.GetTagAsCString());
+      if (src_die.Tag() != dst_die.Tag())
         fast_path = false;
-      }
 
       const char *src_name = src_die.GetMangledName();
       const char *dst_name = dst_die.GetMangledName();
@@ -3622,12 +3568,6 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
       if (src_name == dst_name || (strcmp(src_name, dst_name) == 0))
         continue;
 
-      LLDB_LOGF(log,
-                "warning: tried to unique class DIE 0x%8.8x to 0x%8.8x, "
-                "but 0x%8.8x (%s) names didn't match 0x%8.8x (%s)",
-                src_class_die.GetOffset(), dst_class_die.GetOffset(),
-                src_die.GetOffset(), src_name, dst_die.GetOffset(), dst_name);
-
       fast_path = false;
     }
   }
@@ -3649,33 +3589,13 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
 
       clang::DeclContext *src_decl_ctx =
           src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
-      if (src_decl_ctx) {
-        LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
-                  static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
-                  dst_die.GetOffset());
+      if (src_decl_ctx)
         dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
-      } else {
-        LLDB_LOGF(log,
-                  "warning: tried to unique decl context from 0x%8.8x for "
-                  "0x%8.8x, but none was found",
-                  src_die.GetOffset(), dst_die.GetOffset());
-      }
 
       Type *src_child_type =
           dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()];
-      if (src_child_type) {
-        LLDB_LOGF(log,
-                  "uniquing type %p (uid=0x%" PRIx64
-                  ") from 0x%8.8x for 0x%8.8x",
-                  static_cast<void *>(src_child_type), src_child_type->GetID(),
-                  src_die.GetOffset(), dst_die.GetOffset());
+      if (src_child_type)
         dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = src_child_type;
-      } else {
-        LLDB_LOGF(log,
-                  "warning: tried to unique lldb_private::Type from "
-                  "0x%8.8x for 0x%8.8x, but none was found",
-                  src_die.GetOffset(), dst_die.GetOffset());
-      }
     }
   } else {
     // We must do this slowly.  For each member of the destination, look up a
@@ -3693,38 +3613,16 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
         if (src_die && (src_die.Tag() == dst_die.Tag())) {
           clang::DeclContext *src_decl_ctx =
               src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
-          if (src_decl_ctx) {
-            LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
-                      static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
-                      dst_die.GetOffset());
+          if (src_decl_ctx)
             dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
-          } else {
-            LLDB_LOGF(log,
-                      "warning: tried to unique decl context from 0x%8.8x "
-                      "for 0x%8.8x, but none was found",
-                      src_die.GetOffset(), dst_die.GetOffset());
-          }
 
           Type *src_child_type =
               dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()];
           if (src_child_type) {
-            LLDB_LOGF(
-                log,
-                "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 
0x%8.8x",
-                static_cast<void *>(src_child_type), src_child_type->GetID(),
-                src_die.GetOffset(), dst_die.GetOffset());
             dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] =
                 src_child_type;
-          } else {
-            LLDB_LOGF(log,
-                      "warning: tried to unique lldb_private::Type from "
-                      "0x%8.8x for 0x%8.8x, but none was found",
-                      src_die.GetOffset(), dst_die.GetOffset());
           }
         } else {
-          LLDB_LOGF(log, "warning: couldn't find a match for 0x%8.8x",
-                    dst_die.GetOffset());
-
           failures.push_back(dst_die);
         }
       }
@@ -3748,47 +3646,20 @@ bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
         // Both classes have the artificial types, link them
         clang::DeclContext *src_decl_ctx =
             src_dwarf_ast_parser->m_die_to_decl_ctx[src_die.GetDIE()];
-        if (src_decl_ctx) {
-          LLDB_LOGF(log, "uniquing decl context %p from 0x%8.8x for 0x%8.8x",
-                    static_cast<void *>(src_decl_ctx), src_die.GetOffset(),
-                    dst_die.GetOffset());
+        if (src_decl_ctx)
           dst_dwarf_ast_parser->LinkDeclContextToDIE(src_decl_ctx, dst_die);
-        } else {
-          LLDB_LOGF(log,
-                    "warning: tried to unique decl context from 0x%8.8x "
-                    "for 0x%8.8x, but none was found",
-                    src_die.GetOffset(), dst_die.GetOffset());
-        }
 
         Type *src_child_type =
             dst_die.GetDWARF()->GetDIEToType()[src_die.GetDIE()];
-        if (src_child_type) {
-          LLDB_LOGF(
-              log,
-              "uniquing type %p (uid=0x%" PRIx64 ") from 0x%8.8x for 0x%8.8x",
-              static_cast<void *>(src_child_type), src_child_type->GetID(),
-              src_die.GetOffset(), dst_die.GetOffset());
+        if (src_child_type)
           dst_die.GetDWARF()->GetDIEToType()[dst_die.GetDIE()] = 
src_child_type;
-        } else {
-          LLDB_LOGF(log,
-                    "warning: tried to unique lldb_private::Type from "
-                    "0x%8.8x for 0x%8.8x, but none was found",
-                    src_die.GetOffset(), dst_die.GetOffset());
-        }
       }
     }
   }
 
   if (dst_size_artificial) {
     for (idx = 0; idx < dst_size_artificial; ++idx) {
-      ConstString dst_name_artificial =
-          dst_name_to_die_artificial.GetCStringAtIndex(idx);
       dst_die = dst_name_to_die_artificial.GetValueAtIndexUnchecked(idx);
-      LLDB_LOGF(log,
-                "warning: need to create artificial method for 0x%8.8x for "
-                "method '%s'",
-                dst_die.GetOffset(), dst_name_artificial.GetCString());
-
       failures.push_back(dst_die);
     }
   }

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
index ce514381ee396..03cbfd28ae741 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
@@ -138,7 +138,7 @@ llvm::Error DWARFDebugArangeSet::extract(const 
DWARFDataExtractor &data,
     }
   }
   if (num_terminators > 1) {
-    Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+    Log *log = GetLog(DWARFLog::DebugInfo);
     LLDB_LOG(log,
              "warning: DWARFDebugArangeSet at %#" PRIx64 " contains %u "
              "terminator entries",

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index 65923cb4ad6b8..a374991758581 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -40,7 +40,7 @@ void DWARFDebugAranges::extract(const DWARFDataExtractor 
&debug_aranges_data) {
   while (debug_aranges_data.ValidOffset(offset)) {
     const lldb::offset_t set_offset = offset;
     if (llvm::Error error = set.extract(debug_aranges_data, &offset)) {
-      Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+      Log *log = GetLog(DWARFLog::DebugInfo);
       LLDB_LOG_ERROR(log, std::move(error),
                      "DWARFDebugAranges::extract failed to extract "
                      ".debug_aranges set at offset %#" PRIx64,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 4a148e7744bb1..2350c8fc3d5be 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -77,7 +77,7 @@ void DebugNamesDWARFIndex::MaybeLogLookupError(llvm::Error 
error,
                                                llvm::StringRef name) {
   // Ignore SentinelErrors, log everything else.
   LLDB_LOG_ERROR(
-      LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS),
+      GetLog(DWARFLog::Lookups),
       handleErrors(std::move(error), [](const DebugNames::SentinelError &) {}),
       "Failed to parse index entries for index at {1:x}, name {2}: {0}",
       ni.getUnitOffset(), name);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
index 8076c719e9c46..aa3ed4afed254 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
@@ -21,19 +21,11 @@ enum class DWARFLog : Log::MaskType {
   TypeCompletion = Log::ChannelFlag<4>,
   LLVM_MARK_AS_BITMASK_ENUM(TypeCompletion)
 };
-#define DWARF_LOG_DEBUG_INFO ::lldb_private::DWARFLog::DebugInfo
-#define DWARF_LOG_DEBUG_LINE ::lldb_private::DWARFLog::DebugLine
-#define DWARF_LOG_LOOKUPS ::lldb_private::DWARFLog::Lookups
-#define DWARF_LOG_TYPE_COMPLETION ::lldb_private::DWARFLog::TypeCompletion
-#define DWARF_LOG_DEBUG_MAP ::lldb_private::DWARFLog::DebugMap
 
 class LogChannelDWARF {
 public:
   static void Initialize();
   static void Terminate();
-
-  static Log *GetLogIfAll(DWARFLog mask) { return GetLog(mask); }
-  static Log *GetLogIfAny(DWARFLog mask) { return GetLog(mask); }
 };
 
 template <> Log::Channel &LogChannelFor<DWARFLog>();

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index e15a22affcb25..e8fbd5dd664bd 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -136,7 +136,7 @@ void ManualDWARFIndex::Index() {
 
 void ManualDWARFIndex::IndexUnit(DWARFUnit &unit, SymbolFileDWARFDwo *dwp,
                                  IndexSet &set) {
-  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS);
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
     m_module.LogMessage(

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 02d1a6a4a8be2..027a4caf5555c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -138,7 +138,7 @@ static const llvm::DWARFDebugLine::LineTable *
 ParseLLVMLineTable(lldb_private::DWARFContext &context,
                    llvm::DWARFDebugLine &line, dw_offset_t line_offset,
                    dw_offset_t unit_offset) {
-  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+  Log *log = GetLog(DWARFLog::DebugInfo);
 
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVM();
   llvm::DWARFContext &ctx = context.GetAsLLVM();
@@ -162,7 +162,7 @@ static bool 
ParseLLVMLineTablePrologue(lldb_private::DWARFContext &context,
                                        llvm::DWARFDebugLine::Prologue 
&prologue,
                                        dw_offset_t line_offset,
                                        dw_offset_t unit_offset) {
-  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+  Log *log = GetLog(DWARFLog::DebugInfo);
   bool success = true;
   llvm::DWARFDataExtractor data = context.getOrLoadLineData().GetAsLLVM();
   llvm::DWARFContext &ctx = context.GetAsLLVM();
@@ -443,7 +443,7 @@ SymbolFileDWARF::GetTypeSystemForLanguage(LanguageType 
language) {
 }
 
 void SymbolFileDWARF::InitializeObject() {
-  Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+  Log *log = GetLog(DWARFLog::DebugInfo);
 
   InitializeFirstCodeAddress();
 
@@ -622,7 +622,7 @@ DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
   auto abbr = std::make_unique<DWARFDebugAbbrev>();
   llvm::Error error = abbr->parse(debug_abbrev_data);
   if (error) {
-    Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+    Log *log = GetLog(DWARFLog::DebugInfo);
     LLDB_LOG_ERROR(log, std::move(error),
                    "Unable to read .debug_abbrev section: {0}");
     return nullptr;
@@ -1030,7 +1030,7 @@ SymbolFileDWARF::GetTypeUnitSupportFiles(DWARFTypeUnit 
&tu) {
     llvm::DWARFContext &ctx = m_context.GetAsLLVM();
     llvm::DWARFDebugLine::Prologue prologue;
     auto report = [](llvm::Error error) {
-      Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+      Log *log = GetLog(DWARFLog::DebugInfo);
       LLDB_LOG_ERROR(log, std::move(error),
                      "SymbolFileDWARF::GetTypeUnitSupportFiles failed to parse 
"
                      "the line table prologue");
@@ -1488,7 +1488,7 @@ Type *SymbolFileDWARF::ResolveTypeUID(const DIERef 
&die_ref) {
 Type *SymbolFileDWARF::ResolveTypeUID(const DWARFDIE &die,
                                       bool assert_not_being_parsed) {
   if (die) {
-    Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+    Log *log = GetLog(DWARFLog::DebugInfo);
     if (log)
       GetObjectFile()->GetModule()->LogMessage(
           log, "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'",
@@ -1579,8 +1579,7 @@ bool SymbolFileDWARF::CompleteType(CompilerType 
&compiler_type) {
 
     Type *type = GetDIEToType().lookup(dwarf_die.GetDIE());
 
-    Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO |
-                                          DWARF_LOG_TYPE_COMPLETION));
+    Log *log = GetLog(DWARFLog::DebugInfo | DWARFLog::TypeCompletion);
     if (log)
       GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
           log, "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...",
@@ -2109,7 +2108,7 @@ bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile(
     return true; // The type systems match, return true
 
   // The namespace AST was valid, and it does not match...
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log)
     GetObjectFile()->GetModule()->LogMessage(
@@ -2122,7 +2121,7 @@ void SymbolFileDWARF::FindGlobalVariables(
     ConstString name, const CompilerDeclContext &parent_decl_ctx,
     uint32_t max_matches, VariableList &variables) {
   std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log)
     GetObjectFile()->GetModule()->LogMessage(
@@ -2204,7 +2203,7 @@ void SymbolFileDWARF::FindGlobalVariables(const 
RegularExpression &regex,
                                           uint32_t max_matches,
                                           VariableList &variables) {
   std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
     GetObjectFile()->GetModule()->LogMessage(
@@ -2316,7 +2315,7 @@ void SymbolFileDWARF::FindFunctions(ConstString name,
   // Module::LookupInfo::LookupInfo()
   assert((name_type_mask & eFunctionNameTypeAuto) == 0);
 
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
     GetObjectFile()->GetModule()->LogMessage(
@@ -2366,7 +2365,7 @@ void SymbolFileDWARF::FindFunctions(const 
RegularExpression &regex,
   LLDB_SCOPED_TIMERF("SymbolFileDWARF::FindFunctions (regex = '%s')",
                      regex.GetText().str().c_str());
 
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
     GetObjectFile()->GetModule()->LogMessage(
@@ -2414,7 +2413,7 @@ void SymbolFileDWARF::FindTypes(
   if (!searched_symbol_files.insert(this).second)
     return;
 
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
     if (parent_decl_ctx)
@@ -2529,7 +2528,7 @@ CompilerDeclContext
 SymbolFileDWARF::FindNamespace(ConstString name,
                                const CompilerDeclContext &parent_decl_ctx) {
   std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+  Log *log = GetLog(DWARFLog::Lookups);
 
   if (log) {
     GetObjectFile()->GetModule()->LogMessage(
@@ -2851,8 +2850,7 @@ TypeSP 
SymbolFileDWARF::FindDefinitionTypeForDWARFDeclContext(
     const dw_tag_t tag = dwarf_decl_ctx[0].tag;
 
     if (type_name) {
-      Log *log(LogChannelDWARF::GetLogIfAny(DWARF_LOG_TYPE_COMPLETION |
-                                            DWARF_LOG_LOOKUPS));
+      Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
       if (log) {
         GetObjectFile()->GetModule()->LogMessage(
             log,

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 6ee189e04250c..08bfe37fd92f7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -61,7 +61,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(
   if (!oso_objfile)
     return file_range_map;
 
-  Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
+  Log *log = GetLog(DWARFLog::DebugMap);
   LLDB_LOGF(
       log,
       "%p: SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap ('%s')",
@@ -281,7 +281,7 @@ void SymbolFileDWARFDebugMap::InitOSO() {
 
   Symtab *symtab = m_objfile_sp->GetSymtab();
   if (symtab) {
-    Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP));
+    Log *log = GetLog(DWARFLog::DebugMap);
 
     std::vector<uint32_t> oso_indexes;
     // When a mach-o symbol is encoded, the n_type field is encoded in bits


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to