File tree Expand file tree Collapse file tree 3 files changed +10
-19
lines changed
lldb/source/Plugins/TypeSystem Expand file tree Collapse file tree 3 files changed +10
-19
lines changed Original file line number Diff line number Diff line change @@ -759,22 +759,7 @@ void TypeSystemClang::CreateASTContext() {
759
759
760
760
TypeSystemClang *TypeSystemClang::GetASTContext (clang::ASTContext *ast) {
761
761
TypeSystemClang *clang_ast = GetASTMap ().Lookup (ast);
762
- // BEGIN SWIFT
763
- // FIXME: rdar://102525085
764
- // The following code existed only on swift-lldb. Presumably it's a
765
- // hack to wrap the clang::ASTContext owned by a ClangImporter in a
766
- // TypeSystemClang.
767
- if (!clang_ast) {
768
- // / rdar://102525085
769
- auto ts = std::make_shared<TypeSystemClang>(
770
- " ASTContext from TypeSystemClang::GetASTContext" , *ast);
771
- static std::vector<std::shared_ptr<TypeSystemClang>> g_adhoc_typesystems;
772
- g_adhoc_typesystems.push_back (ts);
773
-
774
- GetASTMap ().Insert (ast, ts.get ());
775
- clang_ast = ts.get ();
776
- }
777
- // END SWIFT
762
+ lldbassert (clang_ast && " Orphaned clang::ASTContext" );
778
763
return clang_ast;
779
764
}
780
765
Original file line number Diff line number Diff line change @@ -3063,9 +3063,12 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
3063
3063
3064
3064
// 4. Install the clang importer.
3065
3065
if (clang_importer_ap) {
3066
- m_clang_importer = (swift::ClangImporter *)clang_importer_ap.get ();
3066
+ m_clangimporter = (swift::ClangImporter *)clang_importer_ap.get ();
3067
3067
m_ast_context_ap->addModuleLoader (std::move (clang_importer_ap),
3068
3068
/* isClang=*/ true );
3069
+ m_clangimporter_typesystem = std::make_shared<TypeSystemClang>(
3070
+ " ClangImporter-owned clang::ASTContext for '" + m_description,
3071
+ m_clangimporter->getClangASTContext ());
3069
3072
}
3070
3073
3071
3074
// Set up the required state for the evaluator in the TypeChecker.
@@ -3097,7 +3100,7 @@ swift::ClangImporter *SwiftASTContext::GetClangImporter() {
3097
3100
VALID_OR_RETURN (nullptr );
3098
3101
3099
3102
GetASTContext ();
3100
- return m_clang_importer ;
3103
+ return m_clangimporter ;
3101
3104
}
3102
3105
3103
3106
const swift::SearchPathOptions *SwiftASTContext::GetSearchPathOptions () const {
Original file line number Diff line number Diff line change 24
24
#include " llvm/ADT/SmallVector.h"
25
25
#include " llvm/ADT/StringRef.h"
26
26
#include " llvm/Target/TargetOptions.h"
27
+ #include < memory>
27
28
28
29
namespace swift {
29
30
enum class IRGenDebugInfoLevel : unsigned ;
@@ -863,7 +864,9 @@ class SwiftASTContext : public TypeSystemSwift {
863
864
// / Owned by the AST.
864
865
swift::MemoryBufferSerializedModuleLoader *m_memory_buffer_module_loader =
865
866
nullptr ;
866
- swift::ClangImporter *m_clang_importer = nullptr ;
867
+ swift::ClangImporter *m_clangimporter = nullptr ;
868
+ // / Wraps the clang::ASTContext owned by ClangImporter.
869
+ std::shared_ptr<TypeSystemClang> m_clangimporter_typesystem;
867
870
SwiftModuleMap m_swift_module_cache;
868
871
SwiftTypeFromMangledNameMap m_mangled_name_to_type_map;
869
872
SwiftMangledNameFromTypeMap m_type_to_mangled_name_map;
You can’t perform that action at this time.
0 commit comments