Skip to content

[lldb] Fix latent compiler warnings #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 10, 2020

Conversation

kastiglione
Copy link

This fixes warnings identified using the LLVM_ENABLE_WARNINGS fix in https://reviews.llvm.org/D87243.

This is a follow up to the removal of unused code in #1749.

return swift_flags;
LLVM_FALLTHROUGH;
Copy link
Author

Choose a reason for hiding this comment

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

Most of the cases in this switch use a fallthrough. Adrian do you know if it's correct for this one to be a return, not a fall through?

Comment on lines +499 to +500
if ((m_return_valobj_sp = SwiftLanguageRuntime::CalculateErrorValue(
frame_sp, persistent_variable_name))) {
Copy link
Author

Choose a reason for hiding this comment

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

Another case of assignment inside an if. This one looks like it should be assignment, not equality.

Choose a reason for hiding this comment

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

Is the problem here that it's not a declaration? I.e., would if (auto m_return_valobj_sp = SwiftLa...) trigger a warning?

Copy link
Author

@kastiglione kastiglione Sep 10, 2020

Choose a reason for hiding this comment

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

Correct, a declaration would not trigger the warning. I don't know the history, but it seems clang uses additional parenthesis as a way of saying "this assignment inside an if is intentional". I see there are a number of uses of this pattern in swift and llvm.

@kastiglione
Copy link
Author

@swift-ci test

@kastiglione
Copy link
Author

@swift-ci test

Copy link

@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.

This is good stuff. I think that in the future, it would be useful to create one commit per warning — but we can keep this one as is.

Comment on lines +499 to +500
if ((m_return_valobj_sp = SwiftLanguageRuntime::CalculateErrorValue(
frame_sp, persistent_variable_name))) {

Choose a reason for hiding this comment

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

Is the problem here that it's not a declaration? I.e., would if (auto m_return_valobj_sp = SwiftLa...) trigger a warning?

@kastiglione
Copy link
Author

I'll remember that for next time. Hopefully there won't be a next time, once https://reviews.llvm.org/D87243 is accepted we'll see warnings during development and hopefully they get fixed before committing.

@kastiglione
Copy link
Author

@swift-ci test Linux platform

@kastiglione kastiglione merged commit ba98a03 into swift/master Sep 10, 2020
@kastiglione kastiglione deleted the dl/lldb-Fix-latent-compiler-warnings branch September 10, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants