Skip to content

[upstreaming] Revert check_swift parameter to IsPossibleDynamicType #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lldb/include/lldb/Symbol/ClangASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,8 +590,7 @@ class ClangASTContext : public TypeSystem {

bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *target_type, // Can pass nullptr
bool check_cplusplus, bool check_objc,
bool check_swift) override;
bool check_cplusplus, bool check_objc) override;

bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;

Expand Down
5 changes: 2 additions & 3 deletions lldb/include/lldb/Symbol/CompilerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,11 @@ class CompilerType {

bool
IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
return IsPossibleDynamicType(target_type, true, false, false);
return IsPossibleDynamicType(target_type, true, false);
}

bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
bool check_cplusplus, bool check_objc,
bool check_swift) const;
bool check_cplusplus, bool check_objc) const;

bool IsPointerToScalarType() const;

Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/Symbol/SwiftASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,7 @@ class SwiftASTContext : public TypeSystem {

bool IsPossibleDynamicType(void *type,
CompilerType *target_type, // Can pass NULL
bool check_cplusplus, bool check_objc,
bool check_swift) override;
bool check_cplusplus, bool check_objc) override;

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

Expand Down
3 changes: 1 addition & 2 deletions lldb/include/lldb/Symbol/TypeSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ class TypeSystem : public PluginInterface {

virtual bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *target_type, // Can pass NULL
bool check_cplusplus, bool check_objc,
bool check_swift) = 0;
bool check_cplusplus, bool check_objc) = 0;

virtual bool IsPointerType(lldb::opaque_compiler_type_t type,
CompilerType *pointee_type) = 0;
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Core/ValueObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ bool ValueObject::IsPossibleDynamicType() {
if (process)
return process->IsPossibleDynamicValue(*this);
else
return GetCompilerType().IsPossibleDynamicType(nullptr, true, true, true);
return GetCompilerType().IsPossibleDynamicType(nullptr, true, true);
}

bool ValueObject::IsRuntimeSupportValue() {
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,11 @@ ObjCLanguage::GetPossibleFormattersMatches(ValueObject &valobj,

const bool check_cpp = false;
const bool check_objc = true;
const bool check_swift = false;
bool canBeObjCDynamic = compiler_type.IsPossibleDynamicType(
nullptr, check_cpp, check_objc, check_swift);
bool canBeObjCDynamic =
compiler_type.IsPossibleDynamicType(nullptr, check_cpp, check_objc);

if (canBeObjCDynamic) {
bool is_clang_type = llvm::isa<ClangASTContext>(compiler_type.GetTypeSystem());
if (canBeObjCDynamic && is_clang_type) {
do {
lldb::ProcessSP process_sp = valobj.GetProcessSP();
if (!process_sp)
Expand Down
3 changes: 1 addition & 2 deletions lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,8 @@ std::vector<ConstString> SwiftLanguage::GetPossibleFormattersMatches(

const bool check_cpp = false;
const bool check_objc = false;
const bool check_swift = true;
bool canBeSwiftDynamic = compiler_type.IsPossibleDynamicType(
nullptr, check_cpp, check_objc, check_swift);
nullptr, check_cpp, check_objc);

if (canBeSwiftDynamic) {
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ char ItaniumABILanguageRuntime::ID = 0;
bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
const bool check_cxx = true;
const bool check_objc = false;
const bool check_swift = false;
return in_value.GetCompilerType().IsPossibleDynamicType(
nullptr, check_cxx, check_objc, check_swift);
nullptr, check_cxx, check_objc);
}

TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ bool AppleObjCRuntime::CouldHaveDynamicValue(ValueObject &in_value,
return in_value.GetCompilerType().IsPossibleDynamicType(
nullptr,
false, // do not check C++
true, // check ObjC
allow_swift);
true); // check ObjC
}

bool AppleObjCRuntime::GetDynamicTypeAndAddress(
Expand Down
10 changes: 5 additions & 5 deletions lldb/source/Symbol/ClangASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3714,7 +3714,7 @@ bool ClangASTContext::IsPolymorphicClass(lldb::opaque_compiler_type_t type) {
bool ClangASTContext::IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
CompilerType *dynamic_pointee_type,
bool check_cplusplus,
bool check_objc, bool check_swift) {
bool check_objc) {
clang::QualType pointee_qual_type;
if (type) {
clang::QualType qual_type(GetCanonicalQualType(type));
Expand Down Expand Up @@ -3770,26 +3770,26 @@ bool ClangASTContext::IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
->getUnderlyingType()
.getAsOpaquePtr(),
dynamic_pointee_type, check_cplusplus,
check_objc, check_swift);
check_objc);

case clang::Type::Auto:
return IsPossibleDynamicType(llvm::cast<clang::AutoType>(qual_type)
->getDeducedType()
.getAsOpaquePtr(),
dynamic_pointee_type, check_cplusplus,
check_objc, check_swift);
check_objc);

case clang::Type::Elaborated:
return IsPossibleDynamicType(llvm::cast<clang::ElaboratedType>(qual_type)
->getNamedType()
.getAsOpaquePtr(),
dynamic_pointee_type, check_cplusplus,
check_objc, check_swift);
check_objc);

case clang::Type::Paren:
return IsPossibleDynamicType(
llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr(),
dynamic_pointee_type, check_cplusplus, check_objc, check_swift);
dynamic_pointee_type, check_cplusplus, check_objc);
default:
break;
}
Expand Down
8 changes: 4 additions & 4 deletions lldb/source/Symbol/CompilerType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@ bool CompilerType::IsPolymorphicClass() const {
}

bool CompilerType::IsPossibleDynamicType(CompilerType *dynamic_pointee_type,
bool check_cplusplus, bool check_objc,
bool check_swift) const {
bool check_cplusplus,
bool check_objc) const {
if (IsValid())
return m_type_system->IsPossibleDynamicType(
m_type, dynamic_pointee_type, check_cplusplus, check_objc, check_swift);
return m_type_system->IsPossibleDynamicType(m_type, dynamic_pointee_type,
check_cplusplus, check_objc);
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions lldb/source/Symbol/SwiftASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5314,10 +5314,10 @@ bool SwiftASTContext::IsPolymorphicClass(void *type) { return false; }
bool SwiftASTContext::IsPossibleDynamicType(void *type,
CompilerType *dynamic_pointee_type,
bool check_cplusplus,
bool check_objc, bool check_swift) {
bool check_objc) {
VALID_OR_RETURN(false);

if (type && check_swift) {
if (type) {
auto can_type = GetCanonicalSwiftType(type);

if (can_type->getClassOrBoundGenericClass() ||
Expand Down
2 changes: 1 addition & 1 deletion lldb/source/Target/SwiftLanguageRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2629,7 +2629,7 @@ bool SwiftLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
// disable it.
return !in_value.IsBaseClass();
}
return var_type.IsPossibleDynamicType(nullptr, false, false, true);
return var_type.IsPossibleDynamicType(nullptr, false, false);
}

CompilerType
Expand Down