Skip to content

[Parser] Decouple the parser from AST creation (part 2) #26478

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 22 commits into from
Aug 27, 2019
Merged

[Parser] Decouple the parser from AST creation (part 2) #26478

merged 22 commits into from
Aug 27, 2019

Conversation

jansvoboda11
Copy link
Contributor

Instead of creating the AST directly in the parser (and libSyntax or SwiftSyntax via SyntaxParsingContext), make Parser to explicitly create a tree of ParsedSyntaxNodes. Their OpaqueSyntaxNodes can be either libSyntax or SwiftSyntax. If AST is needed, it can be generated from the libSyntax tree.
This PR contains refactored type parsing.

This PR is a part of a Google Summer of Code 2019 project.

@rintaro rintaro self-assigned this Aug 5, 2019
@rintaro
Copy link
Member

rintaro commented Aug 13, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1ccc21c176c39ea7e02129479dbf88338d3304c1

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 1ccc21c176c39ea7e02129479dbf88338d3304c1

@rintaro
Copy link
Member

rintaro commented Aug 15, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 1ccc21c176c39ea7e02129479dbf88338d3304c1

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 1ccc21c176c39ea7e02129479dbf88338d3304c1

@rintaro
Copy link
Member

rintaro commented Aug 16, 2019

@swift-ci Please test

@rintaro
Copy link
Member

rintaro commented Aug 16, 2019

@jansvoboda11 I found that parsing the following source causes memory leak.

var foo: Bar<Baz,

Tested with (in Linux)

$ cd swift
$ cat test.swift
var foo: Bar<Baz,
$ utils/build-script -R --enable-lsan --debug-swift-stdlib --skip-build-benchmarks
$ ../build/Ninja-ReleaseAssert+stdlib-DebugAssert/swift-linux-x86_64/bin/swift -frontend -parse test.swift

Could you look into it? It seems that the parsed GenericArgumentSyntax (Baz,) is just discarded without Release().

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 0cc0f7a

@rintaro
Copy link
Member

rintaro commented Aug 16, 2019

Other leaking cases:

var foo: Bar<
let foo: Bar[{}
let foo: Bar &

@rintaro
Copy link
Member

rintaro commented Aug 23, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 0cc0f7a

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - a058d4256f5cb571368f031a43e6792b45b861bd

@rintaro
Copy link
Member

rintaro commented Aug 26, 2019

Linux failure is unrelated
@jansvoboda11 Mind resolving conflicts?

@jansvoboda11
Copy link
Contributor Author

Working on in right now.

@rintaro
Copy link
Member

rintaro commented Aug 26, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - a058d4256f5cb571368f031a43e6792b45b861bd

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - a058d4256f5cb571368f031a43e6792b45b861bd

@rintaro
Copy link
Member

rintaro commented Aug 26, 2019

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 02a323e

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 02a323e

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