[SymbolFile] Remove SymbolContext parameter from FindTypes.

This parameter was only ever used with the Module set, and
since a SymbolFile is tied to a module, the parameter turns
out to be entirely unnecessary.  Furthermore, it doesn't make
a lot of sense to ask a caller to ask SymbolFile which is tied
to Module X to find types for Module Y, but that possibility
was open with the previous interface.  By removing this
parameter from the API, it makes it harder to use incorrectly
as well as easier for an implementor to understand what it
needs to do.

llvm-svn: 351133
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index 183eae1..3198079 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -440,13 +440,12 @@
 
   ModuleSP module_sp(GetSP());
   if (type && module_sp) {
-    SymbolContext sc;
     TypeList type_list;
     const bool exact_match = false;
     ConstString name(type);
     llvm::DenseSet<SymbolFile *> searched_symbol_files;
     const uint32_t num_matches = module_sp->FindTypes(
-        sc, name, exact_match, UINT32_MAX, searched_symbol_files, type_list);
+        name, exact_match, UINT32_MAX, searched_symbol_files, type_list);
 
     if (num_matches > 0) {
       for (size_t idx = 0; idx < num_matches; idx++) {
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index e25fa31..98587e7 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1850,11 +1850,10 @@
     ModuleList &images = target_sp->GetImages();
     ConstString const_typename(typename_cstr);
     bool exact_match = false;
-    SymbolContext sc;
     TypeList type_list;
     llvm::DenseSet<SymbolFile *> searched_symbol_files;
     uint32_t num_matches =
-        images.FindTypes(sc, const_typename, exact_match, UINT32_MAX,
+        images.FindTypes(nullptr, const_typename, exact_match, UINT32_MAX,
                          searched_symbol_files, type_list);
 
     if (num_matches > 0) {
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index e2cde44..310bc84 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -382,7 +382,6 @@
     if (view_as_type_cstr && view_as_type_cstr[0]) {
       // We are viewing memory as a type
 
-      SymbolContext sc;
       const bool exact_match = false;
       TypeList type_list;
       uint32_t reference_count = 0;
@@ -467,17 +466,13 @@
       llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
       ConstString lookup_type_name(type_str.c_str());
       StackFrame *frame = m_exe_ctx.GetFramePtr();
+      ModuleSP search_first;
       if (frame) {
-        sc = frame->GetSymbolContext(eSymbolContextModule);
-        if (sc.module_sp) {
-          sc.module_sp->FindTypes(sc, lookup_type_name, exact_match, 1,
-                                  searched_symbol_files, type_list);
-        }
+        search_first = frame->GetSymbolContext(eSymbolContextModule).module_sp;
       }
-      if (type_list.GetSize() == 0) {
-        target->GetImages().FindTypes(sc, lookup_type_name, exact_match, 1,
-                                      searched_symbol_files, type_list);
-      }
+      target->GetImages().FindTypes(search_first.get(), lookup_type_name,
+                                    exact_match, 1, searched_symbol_files,
+                                    type_list);
 
       if (type_list.GetSize() == 0 && lookup_type_name.GetCString() &&
           *lookup_type_name.GetCString() == '$') {
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 4a4d0d2..ee55b22 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -1672,12 +1672,11 @@
     const uint32_t max_num_matches = UINT32_MAX;
     size_t num_matches = 0;
     bool name_is_fully_qualified = false;
-    SymbolContext sc;
 
     ConstString name(name_cstr);
     llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
     num_matches =
-        module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches,
+        module->FindTypes(name, name_is_fully_qualified, max_num_matches,
                           searched_symbol_files, type_list);
 
     if (num_matches) {
@@ -1715,11 +1714,8 @@
 }
 
 static size_t LookupTypeHere(CommandInterpreter &interpreter, Stream &strm,
-                             const SymbolContext &sym_ctx,
-                             const char *name_cstr, bool name_is_regex) {
-  if (!sym_ctx.module_sp)
-    return 0;
-
+                             Module &module, const char *name_cstr,
+                             bool name_is_regex) {
   TypeList type_list;
   const uint32_t max_num_matches = UINT32_MAX;
   size_t num_matches = 1;
@@ -1727,14 +1723,13 @@
 
   ConstString name(name_cstr);
   llvm::DenseSet<SymbolFile *> searched_symbol_files;
-  num_matches = sym_ctx.module_sp->FindTypes(
-      sym_ctx, name, name_is_fully_qualified, max_num_matches,
-      searched_symbol_files, type_list);
+  num_matches = module.FindTypes(name, name_is_fully_qualified, max_num_matches,
+                                 searched_symbol_files, type_list);
 
   if (num_matches) {
     strm.Indent();
     strm.PutCString("Best match found in ");
-    DumpFullpath(strm, &sym_ctx.module_sp->GetFileSpec(), 0);
+    DumpFullpath(strm, &module.GetFileSpec(), 0);
     strm.PutCString(":\n");
 
     TypeSP type_sp(type_list.GetTypeAtIndex(0));
@@ -3832,8 +3827,9 @@
       return false;
     case eLookupTypeType:
       if (!m_options.m_str.empty()) {
-        if (LookupTypeHere(m_interpreter, result.GetOutputStream(), sym_ctx,
-                           m_options.m_str.c_str(), m_options.m_use_regex)) {
+        if (LookupTypeHere(m_interpreter, result.GetOutputStream(),
+                           *sym_ctx.module_sp, m_options.m_str.c_str(),
+                           m_options.m_use_regex)) {
           result.SetStatus(eReturnStatusSuccessFinishResult);
           return true;
         }
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 3e3a1e0..b48d3cc 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -943,33 +943,33 @@
 }
 
 size_t Module::FindTypes_Impl(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches,
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, size_t max_matches,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
-  if (!sc.module_sp || sc.module_sp.get() == this) {
-    SymbolVendor *symbols = GetSymbolVendor();
-    if (symbols)
-      return symbols->FindTypes(sc, name, parent_decl_ctx, append, max_matches,
-                                searched_symbol_files, types);
-  }
+  SymbolVendor *symbols = GetSymbolVendor();
+  if (symbols)
+    return symbols->FindTypes(name, parent_decl_ctx, append, max_matches,
+                              searched_symbol_files, types);
   return 0;
 }
 
-size_t Module::FindTypesInNamespace(const SymbolContext &sc,
-                                    const ConstString &type_name,
+size_t Module::FindTypesInNamespace(const ConstString &type_name,
                                     const CompilerDeclContext *parent_decl_ctx,
                                     size_t max_matches, TypeList &type_list) {
   const bool append = true;
   TypeMap types_map;
   llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
   size_t num_types =
-      FindTypes_Impl(sc, type_name, parent_decl_ctx, append, max_matches,
+      FindTypes_Impl(type_name, parent_decl_ctx, append, max_matches,
                      searched_symbol_files, types_map);
-  if (num_types > 0)
+  if (num_types > 0) {
+    SymbolContext sc;
+    sc.module_sp = shared_from_this();
     sc.SortTypeList(types_map, type_list);
+  }
   return num_types;
 }
 
@@ -978,15 +978,14 @@
   TypeList type_list;
   llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
   const size_t num_matches =
-      FindTypes(sc, name, exact_match, 1, searched_symbol_files, type_list);
+      FindTypes(name, exact_match, 1, searched_symbol_files, type_list);
   if (num_matches)
     return type_list.GetTypeAtIndex(0);
   return TypeSP();
 }
 
 size_t Module::FindTypes(
-    const SymbolContext &sc, const ConstString &name, bool exact_match,
-    size_t max_matches,
+    const ConstString &name, bool exact_match, size_t max_matches,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeList &types) {
   size_t num_matches = 0;
@@ -1006,8 +1005,8 @@
     exact_match = type_scope.consume_front("::");
 
     ConstString type_basename_const_str(type_basename);
-    if (FindTypes_Impl(sc, type_basename_const_str, nullptr, append,
-                       max_matches, searched_symbol_files, typesmap)) {
+    if (FindTypes_Impl(type_basename_const_str, nullptr, append, max_matches,
+                       searched_symbol_files, typesmap)) {
       typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
                                      exact_match);
       num_matches = typesmap.GetSize();
@@ -1018,13 +1017,13 @@
     if (type_class != eTypeClassAny && !type_basename.empty()) {
       // The "type_name_cstr" will have been modified if we have a valid type
       // class prefix (like "struct", "class", "union", "typedef" etc).
-      FindTypes_Impl(sc, ConstString(type_basename), nullptr, append,
-                     UINT_MAX, searched_symbol_files, typesmap);
+      FindTypes_Impl(ConstString(type_basename), nullptr, append, UINT_MAX,
+                     searched_symbol_files, typesmap);
       typesmap.RemoveMismatchedTypes(type_scope, type_basename, type_class,
                                      exact_match);
       num_matches = typesmap.GetSize();
     } else {
-      num_matches = FindTypes_Impl(sc, name, nullptr, append, UINT_MAX,
+      num_matches = FindTypes_Impl(name, nullptr, append, UINT_MAX,
                                    searched_symbol_files, typesmap);
       if (exact_match) {
         std::string name_str(name.AsCString(""));
@@ -1034,8 +1033,11 @@
       }
     }
   }
-  if (num_matches > 0)
+  if (num_matches > 0) {
+    SymbolContext sc;
+    sc.module_sp = shared_from_this();
     sc.SortTypeList(typesmap, types);
+  }
   return num_matches;
 }
 
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 38eb29a..b8de86f 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -542,7 +542,7 @@
 }
 
 size_t
-ModuleList::FindTypes(const SymbolContext &sc, const ConstString &name,
+ModuleList::FindTypes(Module *search_first, const ConstString &name,
                       bool name_is_fully_qualified, size_t max_matches,
                       llvm::DenseSet<SymbolFile *> &searched_symbol_files,
                       TypeList &types) const {
@@ -550,14 +550,12 @@
 
   size_t total_matches = 0;
   collection::const_iterator pos, end = m_modules.end();
-  if (sc.module_sp) {
-    // The symbol context "sc" contains a module so we want to search that one
-    // first if it is in our list...
+  if (search_first) {
     for (pos = m_modules.begin(); pos != end; ++pos) {
-      if (sc.module_sp.get() == (*pos).get()) {
+      if (search_first == pos->get()) {
         total_matches +=
-            (*pos)->FindTypes(sc, name, name_is_fully_qualified, max_matches,
-                              searched_symbol_files, types);
+            search_first->FindTypes(name, name_is_fully_qualified, max_matches,
+                                    searched_symbol_files, types);
 
         if (total_matches >= max_matches)
           break;
@@ -566,15 +564,14 @@
   }
 
   if (total_matches < max_matches) {
-    SymbolContext world_sc;
     for (pos = m_modules.begin(); pos != end; ++pos) {
       // Search the module if the module is not equal to the one in the symbol
       // context "sc". If "sc" contains a empty module shared pointer, then the
       // comparison will always be true (valid_module_ptr != nullptr).
-      if (sc.module_sp.get() != (*pos).get())
+      if (search_first != pos->get())
         total_matches +=
-            (*pos)->FindTypes(world_sc, name, name_is_fully_qualified,
-                              max_matches, searched_symbol_files, types);
+            (*pos)->FindTypes(name, name_is_fully_qualified, max_matches,
+                              searched_symbol_files, types);
 
       if (total_matches >= max_matches)
         break;
diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp
index 1e8bc71..a752030 100644
--- a/lldb/source/DataFormatters/TypeFormat.cpp
+++ b/lldb/source/DataFormatters/TypeFormat.cpp
@@ -159,11 +159,10 @@
     if (!target_sp)
       return false;
     const ModuleList &images(target_sp->GetImages());
-    SymbolContext sc;
     TypeList types;
     llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
-    images.FindTypes(sc, m_enum_type, false, UINT32_MAX, searched_symbol_files,
-                     types);
+    images.FindTypes(nullptr, m_enum_type, false, UINT32_MAX,
+                     searched_symbol_files, types);
     if (types.GetSize() == 0)
       return false;
     for (lldb::TypeSP type_sp : types.Types()) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index 087798b..84771e5 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -332,11 +332,9 @@
 
         TypeList types;
 
-        SymbolContext null_sc;
         ConstString name(tag_decl->getName().str().c_str());
 
-        i->first->FindTypesInNamespace(null_sc, name, &i->second, UINT32_MAX,
-                                       types);
+        i->first->FindTypesInNamespace(name, &i->second, UINT32_MAX, types);
 
         for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; ++ti) {
           lldb::TypeSP type = types.GetTypeAtIndex(ti);
@@ -366,7 +364,6 @@
     } else {
       TypeList types;
 
-      SymbolContext null_sc;
       ConstString name(tag_decl->getName().str().c_str());
       CompilerDeclContext namespace_decl;
 
@@ -374,7 +371,7 @@
 
       bool exact_match = false;
       llvm::DenseSet<SymbolFile *> searched_symbol_files;
-      module_list.FindTypes(null_sc, name, exact_match, UINT32_MAX,
+      module_list.FindTypes(nullptr, name, exact_match, UINT32_MAX,
                             searched_symbol_files, types);
 
       for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; ++ti) {
@@ -854,15 +851,12 @@
       break;
 
     TypeList types;
-    SymbolContext null_sc;
     const bool exact_match = true;
     llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
     if (module_sp && namespace_decl)
-      module_sp->FindTypesInNamespace(null_sc, name, &namespace_decl, 1, types);
+      module_sp->FindTypesInNamespace(name, &namespace_decl, 1, types);
     else {
-      SymbolContext sc;
-      sc.module_sp = module_sp;
-      m_target->GetImages().FindTypes(sc, name, exact_match, 1,
+      m_target->GetImages().FindTypes(module_sp.get(), name, exact_match, 1,
                                       searched_symbol_files, types);
     }
 
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 128eb30..49a3d40 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -101,7 +101,7 @@
             llvm::DenseSet<SymbolFile *> searched_symbol_files;
             if (sc.module_sp) {
               num_matches = sc.module_sp->FindTypes(
-                  sc, ConstString(lookup_name), exact_match, 1,
+                  ConstString(lookup_name), exact_match, 1,
                   searched_symbol_files, class_types);
             }
 
@@ -109,7 +109,7 @@
             // list in the target and get as many unique matches as possible
             if (num_matches == 0) {
               num_matches = target.GetImages().FindTypes(
-                  sc, ConstString(lookup_name), exact_match, UINT32_MAX,
+                  nullptr, ConstString(lookup_name), exact_match, UINT32_MAX,
                   searched_symbol_files, class_types);
             }
 
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 105c088..4fc340b 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -558,7 +558,7 @@
       LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
   if (log)
-    log->Printf("AppleObjCDeclVendor::FindTypes [%u] ('%s', %s, %u, )",
+    log->Printf("AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
                 current_id, (const char *)name.AsCString(),
                 append ? "true" : "false", max_matches);
 
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 237bcf8..2cca7a6 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -153,10 +153,9 @@
 }
 
 uint32_t SymbolFileBreakpad::FindTypes(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append,
-    uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files,
-    TypeMap &types) {
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, uint32_t max_matches,
+    llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeMap &types) {
   if (!append)
     types.Clear();
   return types.GetSize();
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
index 1a71f22..68e8d11 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -113,7 +113,7 @@
   uint32_t FindFunctions(const RegularExpression &regex, bool include_inlines,
                          bool append, SymbolContextList &sc_list) override;
 
-  uint32_t FindTypes(const SymbolContext &sc, const ConstString &name,
+  uint32_t FindTypes(const ConstString &name,
                      const CompilerDeclContext *parent_decl_ctx, bool append,
                      uint32_t max_matches,
                      llvm::DenseSet<SymbolFile *> &searched_symbol_files,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index b39ab88..2a0a89f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2437,9 +2437,8 @@
 }
 
 uint32_t SymbolFileDWARF::FindTypes(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append,
-    uint32_t max_matches,
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, uint32_t max_matches,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
   // If we aren't appending the results to this list, then clear the list
@@ -2528,8 +2527,8 @@
         SymbolVendor *sym_vendor = external_module_sp->GetSymbolVendor();
         if (sym_vendor) {
           const uint32_t num_external_matches =
-              sym_vendor->FindTypes(sc, name, parent_decl_ctx, append,
-                                    max_matches, searched_symbol_files, types);
+              sym_vendor->FindTypes(name, parent_decl_ctx, append, max_matches,
+                                    searched_symbol_files, types);
           if (num_external_matches)
             return num_external_matches;
         }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 664cda0..d351289 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -193,8 +193,7 @@
       std::vector<lldb_private::ConstString> &mangled_names) override;
 
   uint32_t
-  FindTypes(const lldb_private::SymbolContext &sc,
-            const lldb_private::ConstString &name,
+  FindTypes(const lldb_private::ConstString &name,
             const lldb_private::CompilerDeclContext *parent_decl_ctx,
             bool append, uint32_t max_matches,
             llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 2e9b6c0..45350ae 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -1180,9 +1180,8 @@
 }
 
 uint32_t SymbolFileDWARFDebugMap::FindTypes(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append,
-    uint32_t max_matches,
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, uint32_t max_matches,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
   if (!append)
@@ -1191,18 +1190,11 @@
   const uint32_t initial_types_size = types.GetSize();
   SymbolFileDWARF *oso_dwarf;
 
-  if (sc.comp_unit) {
-    oso_dwarf = GetSymbolFile(sc);
-    if (oso_dwarf)
-      return oso_dwarf->FindTypes(sc, name, parent_decl_ctx, append,
-                                  max_matches, searched_symbol_files, types);
-  } else {
-    ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
-      oso_dwarf->FindTypes(sc, name, parent_decl_ctx, append, max_matches,
-                           searched_symbol_files, types);
-      return types.GetSize() >= max_matches;
-    });
-  }
+  ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool {
+    oso_dwarf->FindTypes(name, parent_decl_ctx, append, max_matches,
+                         searched_symbol_files, types);
+    return types.GetSize() >= max_matches;
+  });
 
   return types.GetSize() - initial_types_size;
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 04cc70d..176eade 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -116,8 +116,7 @@
                          bool include_inlines, bool append,
                          lldb_private::SymbolContextList &sc_list) override;
   uint32_t
-  FindTypes(const lldb_private::SymbolContext &sc,
-            const lldb_private::ConstString &name,
+  FindTypes(const lldb_private::ConstString &name,
             const lldb_private::CompilerDeclContext *parent_decl_ctx,
             bool append, uint32_t max_matches,
             llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index fa839d5..7e97e2b 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1219,10 +1219,9 @@
 }
 
 uint32_t SymbolFileNativePDB::FindTypes(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append,
-    uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files,
-    TypeMap &types) {
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, uint32_t max_matches,
+    llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeMap &types) {
   if (!append)
     types.Clear();
   if (!name)
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
index 6c3410e..dcf3fe3 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -139,7 +139,7 @@
   uint32_t FindFunctions(const RegularExpression &regex, bool include_inlines,
                          bool append, SymbolContextList &sc_list) override;
 
-  uint32_t FindTypes(const SymbolContext &sc, const ConstString &name,
+  uint32_t FindTypes(const ConstString &name,
                      const CompilerDeclContext *parent_decl_ctx, bool append,
                      uint32_t max_matches,
                      llvm::DenseSet<SymbolFile *> &searched_symbol_files,
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index c5658d5..ad25842 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1376,7 +1376,6 @@
 }
 
 uint32_t SymbolFilePDB::FindTypes(
-    const lldb_private::SymbolContext &sc,
     const lldb_private::ConstString &name,
     const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append,
     uint32_t max_matches,
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index 0eb4862..8128809 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -137,8 +137,7 @@
   void AddSymbols(lldb_private::Symtab &symtab) override;
 
   uint32_t
-  FindTypes(const lldb_private::SymbolContext &sc,
-            const lldb_private::ConstString &name,
+  FindTypes(const lldb_private::ConstString &name,
             const lldb_private::CompilerDeclContext *parent_decl_ctx,
             bool append, uint32_t max_matches,
             llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp
index d440878..6087374 100644
--- a/lldb/source/Symbol/SymbolFile.cpp
+++ b/lldb/source/Symbol/SymbolFile.cpp
@@ -140,9 +140,8 @@
 }
 
 uint32_t SymbolFile::FindTypes(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append,
-    uint32_t max_matches,
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, uint32_t max_matches,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
   if (!append)
diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp
index 26420f0..a9badc1 100644
--- a/lldb/source/Symbol/SymbolVendor.cpp
+++ b/lldb/source/Symbol/SymbolVendor.cpp
@@ -310,15 +310,15 @@
 }
 
 size_t SymbolVendor::FindTypes(
-    const SymbolContext &sc, const ConstString &name,
-    const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches,
+    const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+    bool append, size_t max_matches,
     llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
     TypeMap &types) {
   ModuleSP module_sp(GetModule());
   if (module_sp) {
     std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex());
     if (m_sym_file_ap.get())
-      return m_sym_file_ap->FindTypes(sc, name, parent_decl_ctx, append,
+      return m_sym_file_ap->FindTypes(name, parent_decl_ctx, append,
                                       max_matches, searched_symbol_files,
                                       types);
   }
diff --git a/lldb/source/Target/Language.cpp b/lldb/source/Target/Language.cpp
index 599b442..5c7a409 100644
--- a/lldb/source/Target/Language.cpp
+++ b/lldb/source/Target/Language.cpp
@@ -385,11 +385,10 @@
   Target *target = exe_scope->CalculateTarget().get();
   if (target) {
     const auto &images(target->GetImages());
-    SymbolContext null_sc;
     ConstString cs_key(key);
     llvm::DenseSet<SymbolFile *> searched_sym_files;
     TypeList matches;
-    images.FindTypes(null_sc, cs_key, false, UINT32_MAX, searched_sym_files,
+    images.FindTypes(nullptr, cs_key, false, UINT32_MAX, searched_sym_files,
                      matches);
     for (const auto &match : matches.Types()) {
       if (match.get()) {
diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp
index b1fcee6..8627da9 100644
--- a/lldb/source/Target/ObjCLanguageRuntime.cpp
+++ b/lldb/source/Target/ObjCLanguageRuntime.cpp
@@ -108,14 +108,13 @@
     if (!module_sp)
       return TypeSP();
 
-    const SymbolContext null_sc;
     const bool exact_match = true;
     const uint32_t max_matches = UINT32_MAX;
     TypeList types;
 
     llvm::DenseSet<SymbolFile *> searched_symbol_files;
     const uint32_t num_types = module_sp->FindTypes(
-        null_sc, name, exact_match, max_matches, searched_symbol_files, types);
+        name, exact_match, max_matches, searched_symbol_files, types);
 
     if (num_types) {
       uint32_t i;