Skip to content

Clean up dead code #1080

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 4 commits into from
Nov 29, 2022
Merged

Clean up dead code #1080

merged 4 commits into from
Nov 29, 2022

Conversation

jpsim
Copy link
Contributor

@jpsim jpsim commented Nov 15, 2022

I didn't touch any public or codegen'd declarations, only internal or lower declarations that weren't used in anywhere in this project, including tests.

I also opted to keep some of the unused code that serves as local development helpers, things like recursiveDescription since that seems best to keep around even if not used.

I'm happy to re-add anything that's useful to keep around.

By the way, these unused declarations were found using a SwiftLint rule that's still in development, partly powered by SwiftSyntax itself.

I didn't touch any public or codegen'd declarations, only internal or
lower declarations that weren't used in anywhere in this project,
including tests.

These unused declarations were found using a SwiftLint rule that's still
in development.
@jpsim jpsim requested a review from ahoppen as a code owner November 15, 2022 22:42
@@ -374,31 +374,6 @@ struct FileIDMacro: ExpressionMacro {
}
}

struct FileMacro: ExpressionMacro {
Copy link
Contributor

Choose a reason for hiding this comment

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

@DougGregor Do we still need this?

Copy link
Member

Choose a reason for hiding this comment

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

It can't really work until we get build configuration information into the macro evaluation context, so I'm fine with removing it.

@CodaFi
Copy link
Contributor

CodaFi commented Nov 17, 2022

@swift-ci test

@jpsim
Copy link
Contributor Author

jpsim commented Nov 17, 2022

Sorry @CodaFi, forgot to update for CMake. That's done now and builds cleanly for me with cmake -B build -G Ninja -S . -DCMAKE_BUILD_TYPE=Release and cmake --build build.

@CodaFi
Copy link
Contributor

CodaFi commented Nov 17, 2022

@swift-ci test

Even though I'm not sure how this can be used considering it's
`internal` and SwiftSyntax still compiles without it, but CI is clearly
failing when it's not there.

```
Undefined symbols for architecture x86_64:
  "(extension in SwiftSyntax):SwiftSyntax.SyntaxProtocol.withoutTrivia() -> A", referenced from:
      swiftASTGen.evaluateMacro(sourceFilePtr: Swift.UnsafePointer<Swift.UInt8>, sourceLocationPtr: Swift.UnsafePointer<Swift.UInt8>?, expandedSourcePointer: Swift.UnsafeMutablePointer<Swift.UnsafePointer<Swift.UInt8>?>, expandedSourceLength: Swift.UnsafeMutablePointer<Swift.Int>) -> Swift.Int in Macros.swift.o
ld: symbol(s) not found for architecture x86_64
```
@jpsim
Copy link
Contributor Author

jpsim commented Nov 17, 2022

That last failure is interesting.

Undefined symbols for architecture x86_64:
  "(extension in SwiftSyntax):SwiftSyntax.SyntaxProtocol.withoutTrivia() -> A", referenced from:
      swiftASTGen.evaluateMacro(sourceFilePtr: Swift.UnsafePointer<Swift.UInt8>, sourceLocationPtr: Swift.UnsafePointer<Swift.UInt8>?, expandedSourcePointer: Swift.UnsafeMutablePointer<Swift.UnsafePointer<Swift.UInt8>?>, expandedSourceLength: Swift.UnsafeMutablePointer<Swift.Int>) -> Swift.Int in Macros.swift.o
ld: symbol(s) not found for architecture x86_64

swiftASTGen.evaluateMacro is referring to some code that I had removed, but my tool couldn't detect that. I'm not even sure where that's happening or if it's possible to detect this statically.

@CodaFi
Copy link
Contributor

CodaFi commented Nov 17, 2022

@swift-ci test

@jpsim
Copy link
Contributor Author

jpsim commented Nov 18, 2022

@swift-ci test

1 similar comment
@DougGregor
Copy link
Member

@swift-ci test

@jpsim
Copy link
Contributor Author

jpsim commented Nov 28, 2022

@CodaFi looks like CI's back from vacation so I think this could be merged now.

@CodaFi
Copy link
Contributor

CodaFi commented Nov 28, 2022

@swift-ci test

@CodaFi CodaFi merged commit 7b008fe into swiftlang:main Nov 29, 2022
@jpsim jpsim deleted the jp-remove-dead-code branch November 29, 2022 15:58
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.

3 participants