Skip to content

Commit d9b6a86

Browse files
authored
Merge pull request #230 from Teemperor/RemoveCheckSwift
[upstreaming] Revert check_swift parameter to IsPossibleDynamicType
2 parents 629098f + 3c2cd5c commit d9b6a86

File tree

15 files changed

+30
-43
lines changed

15 files changed

+30
-43
lines changed

lldb/include/lldb/Symbol/ClangASTContext.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,7 @@ class ClangASTContext : public TypeSystem {
581581

582582
bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
583583
CompilerType *target_type, // Can pass nullptr
584-
bool check_cplusplus, bool check_objc,
585-
bool check_swift) override;
584+
bool check_cplusplus, bool check_objc) override;
586585

587586
bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
588587

lldb/include/lldb/Symbol/CompilerType.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,11 @@ class CompilerType {
112112

113113
bool
114114
IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
115-
return IsPossibleDynamicType(target_type, true, false, false);
115+
return IsPossibleDynamicType(target_type, true, false);
116116
}
117117

118118
bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
119-
bool check_cplusplus, bool check_objc,
120-
bool check_swift) const;
119+
bool check_cplusplus, bool check_objc) const;
121120

122121
bool IsPointerToScalarType() const;
123122

lldb/include/lldb/Symbol/SwiftASTContext.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,7 @@ class SwiftASTContext : public TypeSystem {
438438

439439
bool IsPossibleDynamicType(void *type,
440440
CompilerType *target_type, // Can pass NULL
441-
bool check_cplusplus, bool check_objc,
442-
bool check_swift) override;
441+
bool check_cplusplus, bool check_objc) override;
443442

444443
bool IsPointerType(void *type, CompilerType *pointee_type) override;
445444

lldb/include/lldb/Symbol/TypeSystem.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ class TypeSystem : public PluginInterface {
197197

198198
virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
199199
CompilerType *target_type, // Can pass NULL
200-
bool check_cplusplus, bool check_objc,
201-
bool check_swift) = 0;
200+
bool check_cplusplus, bool check_objc) = 0;
202201

203202
virtual bool IsPointerType(lldb::opaque_compiler_type_t type,
204203
CompilerType *pointee_type) = 0;

lldb/source/Core/ValueObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ bool ValueObject::IsPossibleDynamicType() {
18181818
if (process)
18191819
return process->IsPossibleDynamicValue(*this);
18201820
else
1821-
return GetCompilerType().IsPossibleDynamicType(nullptr, true, true, true);
1821+
return GetCompilerType().IsPossibleDynamicType(nullptr, true, true);
18221822
}
18231823

18241824
bool ValueObject::IsRuntimeSupportValue() {

lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -884,11 +884,11 @@ ObjCLanguage::GetPossibleFormattersMatches(ValueObject &valobj,
884884

885885
const bool check_cpp = false;
886886
const bool check_objc = true;
887-
const bool check_swift = false;
888-
bool canBeObjCDynamic = compiler_type.IsPossibleDynamicType(
889-
nullptr, check_cpp, check_objc, check_swift);
887+
bool canBeObjCDynamic =
888+
compiler_type.IsPossibleDynamicType(nullptr, check_cpp, check_objc);
890889

891-
if (canBeObjCDynamic) {
890+
bool is_clang_type = llvm::isa<ClangASTContext>(compiler_type.GetTypeSystem());
891+
if (canBeObjCDynamic && is_clang_type) {
892892
do {
893893
lldb::ProcessSP process_sp = valobj.GetProcessSP();
894894
if (!process_sp)

lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,8 @@ std::vector<ConstString> SwiftLanguage::GetPossibleFormattersMatches(
886886

887887
const bool check_cpp = false;
888888
const bool check_objc = false;
889-
const bool check_swift = true;
890889
bool canBeSwiftDynamic = compiler_type.IsPossibleDynamicType(
891-
nullptr, check_cpp, check_objc, check_swift);
890+
nullptr, check_cpp, check_objc);
892891

893892
if (canBeSwiftDynamic) {
894893
do {

lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ char ItaniumABILanguageRuntime::ID = 0;
4848
bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
4949
const bool check_cxx = true;
5050
const bool check_objc = false;
51-
const bool check_swift = false;
52-
return in_value.GetCompilerType().IsPossibleDynamicType(
53-
nullptr, check_cxx, check_objc, check_swift);
51+
return in_value.GetCompilerType().IsPossibleDynamicType(nullptr, check_cxx,
52+
check_objc);
5453
}
5554

5655
TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,10 @@ Address *AppleObjCRuntime::GetPrintForDebuggerAddr() {
241241
}
242242

243243
bool AppleObjCRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
244-
return CouldHaveDynamicValue(in_value,
245-
/* allow_swift = */ false);
246-
}
247-
248-
bool AppleObjCRuntime::CouldHaveDynamicValue(ValueObject &in_value,
249-
bool allow_swift) {
250244
return in_value.GetCompilerType().IsPossibleDynamicType(
251245
nullptr,
252246
false, // do not check C++
253-
true, // check ObjC
254-
allow_swift);
247+
true); // check ObjC
255248
}
256249

257250
bool AppleObjCRuntime::GetDynamicTypeAndAddress(

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
4747

4848
bool CouldHaveDynamicValue(ValueObject &in_value) override;
4949

50-
virtual bool CouldHaveDynamicValue(ValueObject &in_value, bool allow_swift);
51-
5250
bool GetDynamicTypeAndAddress(ValueObject &in_value,
5351
lldb::DynamicValueType use_dynamic,
5452
TypeAndOrName &class_type_or_name,

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process,
436436
bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
437437
ValueObject &in_value, lldb::DynamicValueType use_dynamic,
438438
TypeAndOrName &class_type_or_name, Address &address,
439-
Value::ValueType &value_type, bool allow_swift) {
439+
Value::ValueType &value_type) {
440440
// We should never get here with a null process...
441441
assert(m_process != nullptr);
442442

@@ -455,7 +455,7 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
455455
value_type = Value::ValueType::eValueTypeScalar;
456456

457457
// Make sure we can have a dynamic value before starting...
458-
if (CouldHaveDynamicValue(in_value, allow_swift)) {
458+
if (CouldHaveDynamicValue(in_value)) {
459459
// First job, pull out the address at 0 offset from the object That will
460460
// be the ISA pointer.
461461
ClassDescriptorSP objc_class_sp(GetNonKVOClassDescriptor(in_value));

lldb/source/Symbol/ClangASTContext.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,7 +3677,7 @@ bool ClangASTContext::IsPolymorphicClass(lldb::opaque_compiler_type_t type) {
36773677
bool ClangASTContext::IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
36783678
CompilerType *dynamic_pointee_type,
36793679
bool check_cplusplus,
3680-
bool check_objc, bool check_swift) {
3680+
bool check_objc) {
36813681
clang::QualType pointee_qual_type;
36823682
if (type) {
36833683
clang::QualType qual_type(GetCanonicalQualType(type));
@@ -3733,26 +3733,26 @@ bool ClangASTContext::IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
37333733
->getUnderlyingType()
37343734
.getAsOpaquePtr(),
37353735
dynamic_pointee_type, check_cplusplus,
3736-
check_objc, check_swift);
3736+
check_objc);
37373737

37383738
case clang::Type::Auto:
37393739
return IsPossibleDynamicType(llvm::cast<clang::AutoType>(qual_type)
37403740
->getDeducedType()
37413741
.getAsOpaquePtr(),
37423742
dynamic_pointee_type, check_cplusplus,
3743-
check_objc, check_swift);
3743+
check_objc);
37443744

37453745
case clang::Type::Elaborated:
37463746
return IsPossibleDynamicType(llvm::cast<clang::ElaboratedType>(qual_type)
37473747
->getNamedType()
37483748
.getAsOpaquePtr(),
37493749
dynamic_pointee_type, check_cplusplus,
3750-
check_objc, check_swift);
3750+
check_objc);
37513751

37523752
case clang::Type::Paren:
37533753
return IsPossibleDynamicType(
37543754
llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
3755-
dynamic_pointee_type, check_cplusplus, check_objc, check_swift);
3755+
dynamic_pointee_type, check_cplusplus, check_objc);
37563756
default:
37573757
break;
37583758
}

lldb/source/Symbol/CompilerType.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,11 @@ bool CompilerType::IsPolymorphicClass() const {
221221
}
222222

223223
bool CompilerType::IsPossibleDynamicType(CompilerType *dynamic_pointee_type,
224-
bool check_cplusplus, bool check_objc,
225-
bool check_swift) const {
224+
bool check_cplusplus,
225+
bool check_objc) const {
226226
if (IsValid())
227-
return m_type_system->IsPossibleDynamicType(
228-
m_type, dynamic_pointee_type, check_cplusplus, check_objc, check_swift);
227+
return m_type_system->IsPossibleDynamicType(m_type, dynamic_pointee_type,
228+
check_cplusplus, check_objc);
229229
return false;
230230
}
231231

lldb/source/Symbol/SwiftASTContext.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5320,11 +5320,13 @@ bool SwiftASTContext::IsPolymorphicClass(void *type) { return false; }
53205320
bool SwiftASTContext::IsPossibleDynamicType(void *type,
53215321
CompilerType *dynamic_pointee_type,
53225322
bool check_cplusplus,
5323-
bool check_objc, bool check_swift) {
5323+
bool check_objc) {
53245324
VALID_OR_RETURN(false);
53255325

5326-
if (type && check_swift) {
5326+
if (type) {
53275327
auto can_type = GetCanonicalSwiftType(type);
5328+
if (!can_type)
5329+
return false;
53285330

53295331
if (can_type->getClassOrBoundGenericClass() ||
53305332
can_type->isAnyExistentialType())

lldb/source/Target/SwiftLanguageRuntime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2632,7 +2632,7 @@ bool SwiftLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
26322632
// disable it.
26332633
return !in_value.IsBaseClass();
26342634
}
2635-
return var_type.IsPossibleDynamicType(nullptr, false, false, true);
2635+
return var_type.IsPossibleDynamicType(nullptr, false, false);
26362636
}
26372637

26382638
CompilerType

0 commit comments

Comments
 (0)