Skip to content

Commit 39df4a9

Browse files
Merge pull request #2784 from adrian-prantl/75030678
Reject Objective-C types in SwiftLanguage::GetPossibleFormattersMatch…
2 parents 2895d0c + 9a9c311 commit 39df4a9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,15 @@ std::vector<ConstString> SwiftLanguage::GetPossibleFormattersMatches(
884884
if (use_dynamic == lldb::eNoDynamicValues)
885885
return result;
886886

887+
// There is no point in attempting to format Clang types here, since
888+
// FormatManager will try to format all Swift types also as
889+
// Objective-C types and vice versa. Due to the incomplete
890+
// ClangImporter implementation for C++, continuing here for
891+
// Objective-C++ types can actually lead to crashes that can be
892+
// avoided by just formatting those types as Objective-C types.
893+
if (valobj.GetObjectRuntimeLanguage() == eLanguageTypeObjC)
894+
return result;
895+
887896
SwiftASTContextLock scratch_ctx_lock(&valobj.GetExecutionContextRef());
888897
CompilerType compiler_type(valobj.GetCompilerType());
889898

0 commit comments

Comments
 (0)