Skip to content
This repository has been 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

Conversation

bulbazord
Copy link
Collaborator

I removed clang from CompilerType, so removing swift seems like the natural
progression.

@bulbazord
Copy link
Collaborator Author

@swift-ci please test

@bulbazord
Copy link
Collaborator Author

Hmm, looks like the swift-lldb merge is ahead of the swift-llvm merge. LLDB is using llvm::Regex::isValid(), but the patch adding that hasn't yet made it into swift-llvm.

Copy link
Member

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the motivation behind this patch?

Could you achieve the same by perhaps having a
class SwiftCompilerType : public CompilerType that does provide this constructor?

@adrian-prantl
Copy link
Member

Can you post a link to the review were you removed clang from CompilerType? I'd like to read up on that to better understand what's going on.

@bulbazord
Copy link
Collaborator Author

bulbazord commented Aug 20, 2019

What's the motivation behind this patch?

Could you achieve the same by perhaps having a
class SwiftCompilerType : public CompilerType that does provide this constructor?

My motivation is more decoupling of swift from non-plugin libraries (lldbSymbol in this case). I think that we could probably have a SwiftCompilerType. If that's what we went with, I'd like for it to live in the SwiftExpressionParser plugin to avoid adding more swift-specific bits to non-plugin libraries.

Can you post a link to the review were you removed clang from CompilerType? I'd like to read up on that to better understand what's going on.

Review was here: https://reviews.llvm.org/D66102

@adrian-prantl
Copy link
Member

Thanks, I posted the same question on the llvm review. Whatever interface we decide on there should probably also be used here. That said, I don't think this necessarily needs to hold up this patch.

@bulbazord
Copy link
Collaborator Author

Sounds good. Whatever happens on llvm.org, I'll mirror here for swift. I think landing this in the meantime should be okay (assuming I can get a build on swift-ci).

@@ -814,7 +816,8 @@ 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::GetSwiftASTContext(&ast_context),
result_type.getPointer());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dangerous, because it is not necessarily equivalent to the original code. Without having read the context, there is no guarantee that ast_context is equivalent to result_type->getASTContext(). There are many concurrent SwiftASTContexts floating around.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. In that case, we should almost always be asking the swift::Type for its ASTContext when constructing a CompilerType then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, then a wrapper or something would be a great idea. It would cut down on boilerplate significantly.

@adrian-prantl
Copy link
Member

Yeah, I feel like the wrapper makes much more sense in the Swift case than in the Clang case.

@bulbazord
Copy link
Collaborator Author

@swift-ci please test

Copy link
Member

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so the wrapper already was there?

@bulbazord
Copy link
Collaborator Author

I just added the wrapper actually. Not too bad to do it, even if a bit repetitive.

@bulbazord
Copy link
Collaborator Author

@swift-ci please test

2 similar comments
@bulbazord
Copy link
Collaborator Author

@swift-ci please test

@bulbazord
Copy link
Collaborator Author

@swift-ci please test

@bulbazord
Copy link
Collaborator Author

@swift-ci please test

1 similar comment
@bulbazord
Copy link
Collaborator Author

@swift-ci please test

@@ -725,6 +725,8 @@ class SwiftASTContext : public TypeSystem {
lldb::StackFrameWP &stack_frame_wp,
swift::SourceFile *source_file, Status &error);

static CompilerType GetSwiftCompilerType(swift::Type swift_type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the "Swift" in the name redundant?
Should it be SwiftASTContext::GetCompilerType(...)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is somewhat redundant. I need to update this PR, I can rename it when I do that.

@bulbazord bulbazord force-pushed the too-much-typing branch 2 times, most recently from ed9b28f to 94cc320 Compare September 12, 2019 23:19
@bulbazord
Copy link
Collaborator Author

@swift-ci please test

2 similar comments
@bulbazord
Copy link
Collaborator Author

@swift-ci please test

@bulbazord
Copy link
Collaborator Author

@swift-ci please test

I removed clang from CompilerType, so removing swift seems like the natural
progression
@bulbazord
Copy link
Collaborator Author

@swift-ci please test

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants