|
17 | 17 |
|
18 | 18 | #include "Plugins/ExpressionParser/Clang/ClangUtil.h"
|
19 | 19 | #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
|
| 20 | +#include "Plugins/TypeSystem/Swift/SwiftDemangle.h" |
20 | 21 | #include "lldb/Symbol/Function.h"
|
21 | 22 | #include "lldb/Symbol/Variable.h"
|
22 | 23 | #include "lldb/Symbol/VariableList.h"
|
@@ -3123,31 +3124,30 @@ TypeAndOrName SwiftLanguageRuntimeImpl::FixUpDynamicType(
|
3123 | 3124 |
|
3124 | 3125 | bool SwiftLanguageRuntimeImpl::IsTaggedPointer(lldb::addr_t addr,
|
3125 | 3126 | CompilerType type) {
|
3126 |
| - swift::CanType swift_can_type = GetCanonicalSwiftType(type); |
3127 |
| - if (!swift_can_type) |
| 3127 | + Demangler dem; |
| 3128 | + auto *root = dem.demangleSymbol(type.GetMangledTypeName().GetStringRef()); |
| 3129 | + using Kind = Node::Kind; |
| 3130 | + auto *unowned_node = swift_demangle::nodeAtPath( |
| 3131 | + root, {Kind::TypeMangling, Kind::Type, Kind::Unowned}); |
| 3132 | + if (!unowned_node) |
3128 | 3133 | return false;
|
3129 |
| - switch (swift_can_type->getKind()) { |
3130 |
| - case swift::TypeKind::UnownedStorage: { |
3131 |
| - Target &target = m_process.GetTarget(); |
3132 |
| - llvm::Triple triple = target.GetArchitecture().GetTriple(); |
3133 |
| - // On Darwin the Swift runtime stores unowned references to |
3134 |
| - // Objective-C objects as a pointer to a struct that has the |
3135 |
| - // actual object pointer at offset zero. The least significant bit |
3136 |
| - // of the reference pointer indicates whether the reference refers |
3137 |
| - // to an Objective-C or Swift object. |
3138 |
| - // |
3139 |
| - // This is a property of the Swift runtime(!). In the future it |
3140 |
| - // may be necessary to check for the version of the Swift runtime |
3141 |
| - // (or indirectly by looking at the version of the remote |
3142 |
| - // operating system) to determine how to interpret references. |
3143 |
| - if (triple.isOSDarwin()) |
3144 |
| - // Check whether this is a reference to an Objective-C object. |
3145 |
| - if ((addr & 1) == 1) |
3146 |
| - return true; |
3147 |
| - } break; |
3148 |
| - default: |
3149 |
| - break; |
3150 |
| - } |
| 3134 | + |
| 3135 | + Target &target = m_process.GetTarget(); |
| 3136 | + llvm::Triple triple = target.GetArchitecture().GetTriple(); |
| 3137 | + // On Darwin the Swift runtime stores unowned references to |
| 3138 | + // Objective-C objects as a pointer to a struct that has the |
| 3139 | + // actual object pointer at offset zero. The least significant bit |
| 3140 | + // of the reference pointer indicates whether the reference refers |
| 3141 | + // to an Objective-C or Swift object. |
| 3142 | + // |
| 3143 | + // This is a property of the Swift runtime(!). In the future it |
| 3144 | + // may be necessary to check for the version of the Swift runtime |
| 3145 | + // (or indirectly by looking at the version of the remote |
| 3146 | + // operating system) to determine how to interpret references. |
| 3147 | + if (triple.isOSDarwin()) |
| 3148 | + // Check whether this is a reference to an Objective-C object. |
| 3149 | + if ((addr & 1) == 1) |
| 3150 | + return true; |
3151 | 3151 | return false;
|
3152 | 3152 | }
|
3153 | 3153 |
|
|
0 commit comments