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

[Symbol] Remove swift from CompilerType #1903

Open
wants to merge 1 commit into
base: upstream-with-swift
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/lldb/Symbol/CompilerType.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <string>
#include <vector>

#include "lldb/Core/SwiftForward.h"
#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"

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

CompilerType(const CompilerType &rhs)
: m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
Expand Down
2 changes: 2 additions & 0 deletions include/lldb/Symbol/SwiftASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ class SwiftASTContext : public TypeSystem {
lldb::StackFrameWP &stack_frame_wp,
swift::SourceFile *source_file, Status &error);

static CompilerType GetCompilerType(swift::Type swift_type);

protected:
/// This map uses the string value of ConstStrings as the key, and the TypeBase
/// * as the value. Since the ConstString strings are uniqued, we can use
Expand Down
12 changes: 7 additions & 5 deletions source/Plugins/ExpressionParser/Swift/SwiftASTManipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ void SwiftASTManipulator::FindVariableDeclarations(
auto type = var_decl->getDeclContext()->mapTypeIntoContext(
var_decl->getInterfaceType());
persistent_info.m_name = name;
persistent_info.m_type = {type.getPointer()};
persistent_info.m_type = SwiftASTContext::GetCompilerType(type);
persistent_info.m_decl = var_decl;

m_variables.push_back(persistent_info);
Expand Down Expand Up @@ -815,7 +815,7 @@ void SwiftASTManipulator::InsertResult(
SwiftASTManipulator::ResultLocationInfo &result_info) {
swift::ASTContext &ast_context = m_source_file.getASTContext();

CompilerType return_ast_type(result_type.getPointer());
CompilerType return_ast_type = SwiftASTContext::GetCompilerType(result_type);

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

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

CompilerType error_ast_type(error_type.getPointer());
CompilerType error_ast_type =
SwiftASTContext::GetCompilerType(error_type);

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

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

CompilerType return_ast_type(result_type.getPointer());
CompilerType return_ast_type =
SwiftASTContext::GetCompilerType(result_type);
swift::Identifier result_var_name =
ast_context.getIdentifier(GetResultName());
SwiftASTManipulatorBase::VariableMetadataSP metadata_sp(
Expand Down Expand Up @@ -1000,7 +1002,7 @@ bool SwiftASTManipulator::FixupResultAfterTypeChecking(Status &error) {
continue;

swift::Type error_type = var_decl->getInterfaceType();
CompilerType error_ast_type(error_type.getPointer());
CompilerType error_ast_type = SwiftASTContext::GetCompilerType(error_type);
SwiftASTManipulatorBase::VariableMetadataSP error_metadata_sp(
new VariableMetadataError());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

// Project includes
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/SwiftForward.h"
#include "lldb/Core/Value.h"
#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Symbol/TaggedASTType.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef liblldb_SwiftREPLMaterializer_h
#define liblldb_SwiftREPLMaterializer_h

#include "lldb/Core/SwiftForward.h"
#include "lldb/Expression/Materializer.h"

namespace lldb_private {
Expand Down
2 changes: 1 addition & 1 deletion source/Plugins/Language/Swift/SwiftFormatters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ bool lldb_private::formatters::swift::SIMDVector_SummaryProvider(
if (generic_args.size() != 1)
return false;
auto swift_arg_type = generic_args[0];
CompilerType arg_type(swift_arg_type);
CompilerType arg_type = SwiftASTContext::GetCompilerType(swift_arg_type);

llvm::Optional<uint64_t> opt_arg_size = arg_type.GetByteSize(nullptr);
if (!opt_arg_size)
Expand Down
4 changes: 2 additions & 2 deletions source/Plugins/Language/Swift/SwiftLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,8 @@ std::unique_ptr<Language::TypeScavenger> SwiftLanguage::GetTypeScavenger() {
} else if (local_results.empty() && module &&
name_parts.size() == 1 &&
name_parts.front() == module->getName().str())
results.insert(
CompilerType(swift::ModuleType::get(module)));
results.insert(SwiftASTContext::GetCompilerType(
swift::ModuleType::get(module)));
}
};

Expand Down
3 changes: 2 additions & 1 deletion source/Plugins/SymbolFile/DWARF/DWARFASTParserSwift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ lldb::TypeSP DWARFASTParserSwift::ParseTypeFromDWARF(const SymbolContext &sc,
return {};
}
preferred_name = name;
compiler_type = {swift_ast_ctx->TheRawPointerType};
compiler_type =
SwiftASTContext::GetCompilerType(swift_ast_ctx->TheRawPointerType);
}
}

Expand Down
9 changes: 0 additions & 9 deletions source/Symbol/CompilerType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "lldb/Core/Debugger.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Symbol/SwiftASTContext.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
Expand All @@ -24,21 +23,13 @@
#include <iterator>
#include <mutex>

#include "swift/AST/Type.h"
#include "swift/AST/Types.h"

using namespace lldb;
using namespace lldb_private;

CompilerType::CompilerType(TypeSystem *type_system,
lldb::opaque_compiler_type_t type)
: m_type(type), m_type_system(type_system) {}

CompilerType::CompilerType(swift::Type qual_type)
: m_type(qual_type.getPointer()),
m_type_system(
SwiftASTContext::GetSwiftASTContext(&qual_type->getASTContext())) {}

CompilerType::~CompilerType() {}

// Tests
Expand Down
Loading