Skip to content

[ASTGen] Support macro expanded source files #77352

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 1 commit into from
Nov 5, 2024

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Nov 1, 2024

  • Move ExportedSourceFileRequest::evaluate() to ParseRequests.cpp
  • Pass the decl context and GeneatedSourceFileInfo::Kind to swift_ASTGen_parseSourceFile() to customize the parsing
  • Make ExportedSourceFile to hold an arbitrary Syntax node
  • Move round-trip checking into ExportedSourceFileRequest::evaluate()
  • Split parseSourceFileViaASTGen completely from C++ parsing logic (in ParseSourceFileRequest::evaluate())

@rintaro
Copy link
Member Author

rintaro commented Nov 2, 2024

swiftlang/swift-syntax#2889
@swift-ci Please smoke test

@rintaro rintaro marked this pull request as ready for review November 2, 2024 23:06
@rintaro rintaro force-pushed the astgen-macroexpansion branch from aca382e to 569ff61 Compare November 3, 2024 05:02
@rintaro
Copy link
Member Author

rintaro commented Nov 3, 2024

swiftlang/swift-syntax#2889
@swift-ci Please smoke test

@rintaro rintaro force-pushed the astgen-macroexpansion branch from 569ff61 to f14bb31 Compare November 4, 2024 17:27
@rintaro
Copy link
Member Author

rintaro commented Nov 4, 2024

@swift-ci Please smoke test


visitIfConfigElements(
node.statements,
of: CodeBlockItemSyntax.self,
split: Self.splitCodeBlockItemIfConfig
) { element in
let loc = self.generateSourceLoc(element)
let astNode = generate(codeBlockItem: element)
if (!isTopLevel) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!isTopLevel) {
if !isTopLevel {

* Make ExportedSourceFile hold any Syntax as the root node
* Move `ExportedSourceFileRequest::evaluate()` to `ParseRequests.cpp`
* Pass  the decl context and `GeneatedSourceFileInfo::Kind` to
  `swift_ASTGen_parseSourceFile()` to customize the parsing
* Make `ExportedSourceFile` to hold an arbitrary Syntax node
* Move round-trip checking into `ExportedSourceFileRequest::evaluate()`
* Split `parseSourceFileViaASTGen` completely from C++ parsing logic
  (in `ParseSourceFileRequest::evaluate()`)
* Remove 'ParserDiagnostics' experimental feature: Now that we have
  ParserASTGen mode which includes the swift-syntax parser diagnostics.
@rintaro rintaro force-pushed the astgen-macroexpansion branch from f14bb31 to e566a74 Compare November 5, 2024 19:01
@rintaro
Copy link
Member Author

rintaro commented Nov 5, 2024

@swift-ci Please smoke test

@rintaro rintaro enabled auto-merge November 5, 2024 20:39
@rintaro rintaro merged commit f80035a into swiftlang:main Nov 5, 2024
3 checks passed
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