Skip to content

Commit ac9bb6a

Browse files
Merge pull request #7722 from adrian-prantl/dwarfimportersplit
Split DWARFImporterDelegate into two parts. NFC
2 parents 2c4ba34 + 47f25ae commit ac9bb6a

File tree

8 files changed

+367
-304
lines changed

8 files changed

+367
-304
lines changed

lldb/source/Plugins/TypeSystem/Swift/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
add_lldb_library(lldbPluginTypeSystemSwift PLUGIN
2-
DWARFImporterDelegate.cpp
2+
SwiftDWARFImporterForClangTypes.cpp
33
TypeSystemSwift.cpp
44
TypeSystemSwiftTypeRef.cpp
55
SwiftASTContext.cpp

lldb/source/Plugins/TypeSystem/Swift/DWARFImporterDelegate.cpp

Lines changed: 0 additions & 287 deletions
This file was deleted.

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "Plugins/TypeSystem/Swift/SwiftASTContext.h"
14+
#include "Plugins/TypeSystem/Swift/SwiftDWARFImporterForClangTypes.h"
1415
#include "Plugins/TypeSystem/Swift/StoringDiagnosticConsumer.h"
1516
#include "Plugins/ExpressionParser/Swift/SwiftPersistentExpressionState.h"
1617

@@ -2947,12 +2948,13 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
29472948
if (!clang_importer_options.OverrideResourceDir.empty()) {
29482949
// Create the DWARFImporterDelegate.
29492950
const auto &props = ModuleList::GetGlobalModuleListProperties();
2950-
swift::DWARFImporterDelegate *delegate = nullptr;
29512951
if (props.GetUseSwiftDWARFImporter())
2952-
delegate = &m_typeref_typesystem->GetDWARFImporterDelegate();
2952+
m_dwarfimporter_delegate_up =
2953+
std::make_unique<SwiftDWARFImporterDelegate>(*this);
29532954
auto importer_diags = getScopedDiagnosticConsumer();
29542955
clang_importer_ap = swift::ClangImporter::create(
2955-
*m_ast_context_ap, "", m_dependency_tracker.get(), delegate);
2956+
*m_ast_context_ap, "", m_dependency_tracker.get(),
2957+
m_dwarfimporter_delegate_up.get());
29562958

29572959
// Handle any errors.
29582960
if (!clang_importer_ap || importer_diags->HasErrors()) {

lldb/source/Plugins/TypeSystem/Swift/SwiftASTContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ namespace lldb_private {
8484
struct SourceModule;
8585
class SwiftASTContext;
8686
class ClangExternalASTSourceCallbacks;
87-
8887
CompilerType ToCompilerType(swift::Type qual_type);
8988

9089
namespace detail {
@@ -904,6 +903,7 @@ class SwiftASTContext : public TypeSystemSwift {
904903
swift::ClangImporter *m_clangimporter = nullptr;
905904
/// Wraps the clang::ASTContext owned by ClangImporter.
906905
std::shared_ptr<TypeSystemClang> m_clangimporter_typesystem;
906+
std::unique_ptr<swift::DWARFImporterDelegate> m_dwarfimporter_delegate_up;
907907
SwiftModuleMap m_swift_module_cache;
908908
SwiftTypeFromMangledNameMap m_mangled_name_to_type_map;
909909
SwiftMangledNameFromTypeMap m_type_to_mangled_name_map;

0 commit comments

Comments
 (0)