|
17 | 17 | #include "SwiftMetadataCache.h"
|
18 | 18 |
|
19 | 19 | #include "Plugins/ExpressionParser/Clang/ClangUtil.h"
|
| 20 | +#include "Plugins/Language/Swift/LogChannelSwift.h" |
20 | 21 | #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
|
21 | 22 | #include "Plugins/TypeSystem/Swift/SwiftDemangle.h"
|
22 | 23 | #include "lldb/Core/ValueObjectMemory.h"
|
|
41 | 42 |
|
42 | 43 | #include <sstream>
|
43 | 44 |
|
| 45 | +#define HEALTH_LOG(FMT, ...) \ |
| 46 | + do { \ |
| 47 | + LLDB_LOG(GetLog(LLDBLog::Types), FMT, ##__VA_ARGS__); \ |
| 48 | + LLDB_LOG(lldb_private::GetSwiftHealthLog(), FMT, ##__VA_ARGS__); \ |
| 49 | + } while (0) |
| 50 | + |
44 | 51 | using namespace lldb;
|
45 | 52 | using namespace lldb_private;
|
46 | 53 |
|
@@ -328,10 +335,9 @@ class LLDBTypeInfoProvider : public swift::remote::TypeInfoProvider {
|
328 | 335 | bool is_imported =
|
329 | 336 | ts->IsImportedType(swift_type.GetOpaqueQualType(), &clang_type);
|
330 | 337 | if (!is_imported || !clang_type) {
|
331 |
| - LLDB_LOG(GetLog(LLDBLog::Types), |
332 |
| - "[LLDBTypeInfoProvider] Could not find clang debug type info " |
333 |
| - "for {0}", |
334 |
| - mangledName); |
| 338 | + HEALTH_LOG("[LLDBTypeInfoProvider] Could not find clang debug type info " |
| 339 | + "for {0}", |
| 340 | + mangledName); |
335 | 341 | return nullptr;
|
336 | 342 | }
|
337 | 343 |
|
@@ -630,8 +636,8 @@ GetExistentialSyntheticChildren(std::shared_ptr<TypeSystemSwiftTypeRef> ts,
|
630 | 636 | /// Log the fact that a type kind is not supported.
|
631 | 637 | void LogUnimplementedTypeKind(const char *function, CompilerType type) {
|
632 | 638 | // When running the test suite assert that all cases are covered.
|
633 |
| - LLDB_LOG(GetLog(LLDBLog::Types), "{0}: unimplemented type info in {1}", |
634 |
| - type.GetMangledTypeName(), function); |
| 639 | + HEALTH_LOG("{0}: unimplemented type info in {1}", type.GetMangledTypeName(), |
| 640 | + function); |
635 | 641 | #ifndef NDEBUG
|
636 | 642 | llvm::dbgs() << function << ": unimplemented type info in"
|
637 | 643 | << type.GetMangledTypeName() << "\n";
|
@@ -1768,17 +1774,15 @@ bool SwiftLanguageRuntimeImpl::GetDynamicTypeAndAddress_Class(
|
1768 | 1774 | ts.GetDescriptorFinder());
|
1769 | 1775 |
|
1770 | 1776 | if (!typeref) {
|
1771 |
| - LLDB_LOGF(log, |
1772 |
| - "could not read typeref for type: %s (instance_ptr = 0x%" PRIx64 |
1773 |
| - ")", |
1774 |
| - class_type.GetMangledTypeName().GetCString(), instance_ptr); |
| 1777 | + HEALTH_LOG("could not read typeref for type: {0} (instance_ptr = {0:x})", |
| 1778 | + class_type.GetMangledTypeName(), instance_ptr); |
1775 | 1779 | return false;
|
1776 | 1780 | }
|
1777 | 1781 | swift::Demangle::Demangler dem;
|
1778 | 1782 | swift::Demangle::NodePointer node = typeref->getDemangling(dem);
|
1779 | 1783 | CompilerType dynamic_type = ts.RemangleAsType(dem, node);
|
1780 |
| - LLDB_LOGF(log, "dynamic type of instance_ptr 0x%" PRIx64 " is %s", |
1781 |
| - instance_ptr, class_type.GetMangledTypeName().GetCString()); |
| 1784 | + LLDB_LOG(log, "dynamic type of instance_ptr {0:x} is {1}", instance_ptr, |
| 1785 | + class_type.GetMangledTypeName()); |
1782 | 1786 | class_type_or_name.SetCompilerType(dynamic_type);
|
1783 | 1787 |
|
1784 | 1788 | #ifndef NDEBUG
|
|
0 commit comments