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

Commit 94cc320

Browse files
committed
[Symbol] Remove swift from CompilerType
I removed clang from CompilerType, so removing swift seems like the natural progression
1 parent a618f5e commit 94cc320

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
@@ -738,6 +738,8 @@ class SwiftASTContext : public TypeSystem {
738738
lldb::StackFrameWP &stack_frame_wp,
739739
swift::SourceFile *source_file, Status &error);
740740

741+
static CompilerType GetCompilerType(swift::Type swift_type);
742+
741743
protected:
742744
/// This map uses the string value of ConstStrings as the key, and the TypeBase
743745
/// * 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
@@ -748,7 +748,7 @@ void SwiftASTManipulator::FindVariableDeclarations(
748748
auto type = var_decl->getDeclContext()->mapTypeIntoContext(
749749
var_decl->getInterfaceType());
750750
persistent_info.m_name = name;
751-
persistent_info.m_type = {type.getPointer()};
751+
persistent_info.m_type = SwiftASTContext::GetCompilerType(type);
752752
persistent_info.m_decl = var_decl;
753753

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

817-
CompilerType return_ast_type(result_type.getPointer());
817+
CompilerType return_ast_type = SwiftASTContext::GetCompilerType(result_type);
818818

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

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

858-
CompilerType error_ast_type(error_type.getPointer());
858+
CompilerType error_ast_type =
859+
SwiftASTContext::GetCompilerType(error_type);
859860

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

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

958-
CompilerType return_ast_type(result_type.getPointer());
959+
CompilerType return_ast_type =
960+
SwiftASTContext::GetCompilerType(result_type);
959961
swift::Identifier result_var_name =
960962
ast_context.getIdentifier(GetResultName());
961963
SwiftASTManipulatorBase::VariableMetadataSP metadata_sp(
@@ -999,7 +1001,7 @@ bool SwiftASTManipulator::FixupResultAfterTypeChecking(Status &error) {
9991001
continue;
10001002

10011003
swift::Type error_type = var_decl->getInterfaceType();
1002-
CompilerType error_ast_type(error_type.getPointer());
1004+
CompilerType error_ast_type = SwiftASTContext::GetCompilerType(error_type);
10031005
SwiftASTManipulatorBase::VariableMetadataSP error_metadata_sp(
10041006
new VariableMetadataError());
10051007

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)