@@ -2860,6 +2860,37 @@ bool Target::IsSwiftREPL() {
28602860 GetProcessLaunchInfo ().GetArg0 ().endswith (" repl_swift" );
28612861}
28622862
2863+ bool Target::IsSwiftCxxInteropEnabled () {
2864+ switch (m_is_swift_cxx_interop_enabled) {
2865+ case eLazyBoolYes:
2866+ return true ;
2867+ case eLazyBoolNo:
2868+ return false ;
2869+ case eLazyBoolCalculate:
2870+ break ;
2871+ }
2872+
2873+ EnableSwiftCxxInterop interop_enabled = GetEnableSwiftCxxInterop ();
2874+ switch (interop_enabled) {
2875+ case eEnableSwiftCxxInterop:
2876+ m_is_swift_cxx_interop_enabled = eLazyBoolYes;
2877+ break ;
2878+ case eDisableSwiftCxxInterop:
2879+ m_is_swift_cxx_interop_enabled = eLazyBoolNo;
2880+ break ;
2881+ case eAutoDetectSwiftCxxInterop: {
2882+ if (GetImages ().IsEmpty ())
2883+ m_is_swift_cxx_interop_enabled = eLazyBoolNo;
2884+ else
2885+ m_is_swift_cxx_interop_enabled =
2886+ GetImages ().GetModuleAtIndex (0 )->IsSwiftCxxInteropEnabled ()
2887+ ? eLazyBoolYes
2888+ : eLazyBoolNo;
2889+ }
2890+ }
2891+ return m_is_swift_cxx_interop_enabled == eLazyBoolYes;
2892+ }
2893+
28632894#endif // LLDB_ENABLE_SWIFT
28642895
28652896void Target::SettingsInitialize () { Process::SettingsInitialize (); }
@@ -4385,6 +4416,13 @@ static constexpr OptionEnumValueElement g_memory_module_load_level_values[] = {
43854416 },
43864417};
43874418
4419+ static constexpr OptionEnumValueElement g_enable_swift_cxx_interop_values[] = {
4420+ {eAutoDetectSwiftCxxInterop, " auto" ,
4421+ " Automatically detect if C++ interop mode should be enabled." },
4422+ {eEnableSwiftCxxInterop, " true" , " Enable C++ interop." },
4423+ {eDisableSwiftCxxInterop, " false" , " Disable C++ interop." },
4424+ };
4425+
43884426#define LLDB_PROPERTIES_target
43894427#include " TargetProperties.inc"
43904428
@@ -4605,16 +4643,14 @@ bool TargetProperties::GetSwiftEnableBareSlashRegex() const {
46054643 return true ;
46064644}
46074645
4608- bool TargetProperties::GetSwiftEnableCxxInterop () const {
4609- const Property *exp_property = m_collection_sp->GetPropertyAtIndex (
4610- nullptr , false , ePropertyExperimental);
4611- OptionValueProperties *exp_values =
4612- exp_property->GetValue ()->GetAsProperties ();
4613- if (exp_values)
4614- return exp_values->GetPropertyAtIndexAsBoolean (
4615- nullptr , ePropertySwiftEnableCxxInterop, false );
4646+ EnableSwiftCxxInterop TargetProperties::GetEnableSwiftCxxInterop () const {
4647+ const uint32_t idx = ePropertySwiftEnableCxxInterop;
46164648
4617- return false ;
4649+ EnableSwiftCxxInterop enable_interop =
4650+ (EnableSwiftCxxInterop)m_experimental_properties_up->GetValueProperties ()
4651+ ->GetPropertyAtIndexAsEnumeration (
4652+ nullptr , idx, g_target_properties[idx].default_uint_value );
4653+ return enable_interop;
46184654}
46194655
46204656bool TargetProperties::GetSwiftAutoImportFrameworks () const {
0 commit comments