Skip to content
This repository was archived by the owner on Apr 2, 2020. It is now read-only.

Commit 5687e35

Browse files
committed
[Symbol] Remove swift from CompilerType
I removed clang from CompilerType, so removing swift seems like the natural progression
1 parent 2ebbca3 commit 5687e35

File tree

11 files changed

+167
-111
lines changed

11 files changed

+167
-111
lines changed

include/lldb/Symbol/CompilerType.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <string>
1414
#include <vector>
1515

16-
#include "lldb/Core/SwiftForward.h"
1716
#include "lldb/lldb-private.h"
1817
#include "llvm/ADT/APSInt.h"
1918

@@ -32,7 +31,6 @@ class CompilerType {
3231
public:
3332
// Constructors and Destructors
3433
CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
35-
CompilerType(swift::Type qual_type);
3634

3735
CompilerType(const CompilerType &rhs)
3836
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}

include/lldb/Symbol/SwiftASTContext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,8 @@ class SwiftASTContext : public TypeSystem {
739739
lldb::StackFrameWP &stack_frame_wp,
740740
swift::SourceFile *source_file, Status &error);
741741

742+
static CompilerType GetCompilerType(swift::Type swift_type);
743+
742744
protected:
743745
/// This map uses the string value of ConstStrings as the key, and the TypeBase
744746
/// * as the value. Since the ConstString strings are uniqued, we can use

source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ void SwiftASTManipulator::FindVariableDeclarations(
749749
auto type = var_decl->getDeclContext()->mapTypeIntoContext(
750750
var_decl->getInterfaceType());
751751
persistent_info.m_name = name;
752-
persistent_info.m_type = {type.getPointer()};
752+
persistent_info.m_type = SwiftASTContext::GetCompilerType(type);
753753
persistent_info.m_decl = var_decl;
754754

755755
m_variables.push_back(persistent_info);
@@ -815,7 +815,7 @@ void SwiftASTManipulator::InsertResult(
815815
SwiftASTManipulator::ResultLocationInfo &result_info) {
816816
swift::ASTContext &ast_context = m_source_file.getASTContext();
817817

818-
CompilerType return_ast_type(result_type.getPointer());
818+
CompilerType return_ast_type = SwiftASTContext::GetCompilerType(result_type);
819819

820820
result_var->overwriteAccess(swift::AccessLevel::Public);
821821
result_var->overwriteSetterAccess(swift::AccessLevel::Public);
@@ -856,7 +856,8 @@ void SwiftASTManipulator::InsertError(swift::VarDecl *error_var,
856856

857857
swift::ASTContext &ast_context = m_source_file.getASTContext();
858858

859-
CompilerType error_ast_type(error_type.getPointer());
859+
CompilerType error_ast_type =
860+
SwiftASTContext::GetCompilerType(error_type);
860861

861862
error_var->overwriteAccess(swift::AccessLevel::Public);
862863
error_var->overwriteSetterAccess(swift::AccessLevel::Public);
@@ -956,7 +957,8 @@ bool SwiftASTManipulator::FixupResultAfterTypeChecking(Status &error) {
956957

957958
swift::ASTContext &ast_context = m_source_file.getASTContext();
958959

959-
CompilerType return_ast_type(result_type.getPointer());
960+
CompilerType return_ast_type =
961+
SwiftASTContext::GetCompilerType(result_type);
960962
swift::Identifier result_var_name =
961963
ast_context.getIdentifier(GetResultName());
962964
SwiftASTManipulatorBase::VariableMetadataSP metadata_sp(
@@ -1000,7 +1002,7 @@ bool SwiftASTManipulator::FixupResultAfterTypeChecking(Status &error) {
10001002
continue;
10011003

10021004
swift::Type error_type = var_decl->getInterfaceType();
1003-
CompilerType error_ast_type(error_type.getPointer());
1005+
CompilerType error_ast_type = SwiftASTContext::GetCompilerType(error_type);
10041006
SwiftASTManipulatorBase::VariableMetadataSP error_metadata_sp(
10051007
new VariableMetadataError());
10061008

source/Plugins/ExpressionParser/Swift/SwiftExpressionVariable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
// Project includes
3030
#include "lldb/Core/ClangForward.h"
31+
#include "lldb/Core/SwiftForward.h"
3132
#include "lldb/Core/Value.h"
3233
#include "lldb/Expression/ExpressionVariable.h"
3334
#include "lldb/Symbol/TaggedASTType.h"

source/Plugins/ExpressionParser/Swift/SwiftREPLMaterializer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef liblldb_SwiftREPLMaterializer_h
1414
#define liblldb_SwiftREPLMaterializer_h
1515

16+
#include "lldb/Core/SwiftForward.h"
1617
#include "lldb/Expression/Materializer.h"
1718

1819
namespace lldb_private {

source/Plugins/Language/Swift/SwiftFormatters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ bool lldb_private::formatters::swift::SIMDVector_SummaryProvider(
10441044
if (generic_args.size() != 1)
10451045
return false;
10461046
auto swift_arg_type = generic_args[0];
1047-
CompilerType arg_type(swift_arg_type);
1047+
CompilerType arg_type = SwiftASTContext::GetCompilerType(swift_arg_type);
10481048

10491049
llvm::Optional<uint64_t> opt_arg_size = arg_type.GetByteSize(nullptr);
10501050
if (!opt_arg_size)

source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,8 @@ std::unique_ptr<Language::TypeScavenger> SwiftLanguage::GetTypeScavenger() {
13151315
} else if (local_results.empty() && module &&
13161316
name_parts.size() == 1 &&
13171317
name_parts.front() == module->getName().str())
1318-
results.insert(
1319-
CompilerType(swift::ModuleType::get(module)));
1318+
results.insert(SwiftASTContext::GetCompilerType(
1319+
swift::ModuleType::get(module)));
13201320
}
13211321
};
13221322

source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
192192
return {};
193193
}
194194
preferred_name = name;
195-
compiler_type = {swift_ast_ctx->TheRawPointerType};
195+
compiler_type =
196+
SwiftASTContext::GetCompilerType(swift_ast_ctx->TheRawPointerType);
196197
}
197198
}
198199

source/Symbol/CompilerType.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include "lldb/Core/Debugger.h"
1212
#include "lldb/Core/StreamFile.h"
13-
#include "lldb/Symbol/SwiftASTContext.h"
1413
#include "lldb/Symbol/Type.h"
1514
#include "lldb/Target/ExecutionContext.h"
1615
#include "lldb/Target/Process.h"
@@ -24,21 +23,13 @@
2423
#include <iterator>
2524
#include <mutex>
2625

27-
#include "swift/AST/Type.h"
28-
#include "swift/AST/Types.h"
29-
3026
using namespace lldb;
3127
using namespace lldb_private;
3228

3329
CompilerType::CompilerType(TypeSystem *type_system,
3430
lldb::opaque_compiler_type_t type)
3531
: m_type(type), m_type_system(type_system) {}
3632

37-
CompilerType::CompilerType(swift::Type qual_type)
38-
: m_type(qual_type.getPointer()),
39-
m_type_system(
40-
SwiftASTContext::GetSwiftASTContext(&qual_type->getASTContext())) {}
41-
4233
CompilerType::~CompilerType() {}
4334

4435
// Tests

0 commit comments

Comments
 (0)