@@ -2705,17 +2705,18 @@ SwiftASTContext::CreateInstance(const SymbolContext &sc,
27052705
27062706 CompileUnit *cu = sc.comp_unit ;
27072707 const char *key = TypeSystemSwiftTypeRef::DeriveKeyFor (sc);
2708+ bool swift_context = cu && cu->GetLanguage () == eLanguageTypeSwift;
27082709 std::string m_description;
27092710 {
27102711 StreamString ss;
27112712 ss << " SwiftASTContext" ;
27122713 if (for_expressions)
27132714 ss << " ForExpressions" ;
27142715 ss << " (module: " << ' "' << key << " \" , " << " cu: " << ' "' ;
2715- if (cu)
2716+ if (cu && swift_context )
27162717 ss << cu->GetPrimaryFile ().GetFilename ();
27172718 else
2718- ss << " null " ;
2719+ ss << " * " ;
27192720 ss << ' "' << ' )' ;
27202721 m_description = ss.GetString ();
27212722 }
@@ -2795,7 +2796,8 @@ SwiftASTContext::CreateInstance(const SymbolContext &sc,
27952796 ModuleList module_module;
27962797 if (!target_sp)
27972798 module_module.Append (module_sp);
2798- ModuleList &modules = target_sp ? target_sp->GetImages () : module_module;
2799+ ModuleList &modules =
2800+ (target_sp && swift_context) ? target_sp->GetImages () : module_module;
27992801 const size_t num_images = modules.GetSize ();
28002802
28012803 // Set the SDK path prior to doing search paths. Otherwise when we
@@ -3131,7 +3133,8 @@ SwiftASTContext::CreateInstance(const SymbolContext &sc,
31313133 }
31323134 }
31333135 };
3134- scan_module (module_sp, 0 );
3136+ if (swift_context)
3137+ scan_module (module_sp, 0 );
31353138 for (size_t mi = 0 ; mi != num_images; ++mi) {
31363139 auto image_sp = modules.GetModuleAtIndex (mi);
31373140 if (!visited_modules.count (image_sp.get ()))
0 commit comments