Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WIP AST node visitor#1922

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
duckdoom5 wants to merge3 commits intomono:main
base:main
Choose a base branch
Loading
fromduckdoom5:feat/ast-node-visitor

Conversation

@duckdoom5
Copy link
Contributor

@duckdoom5duckdoom5 commentedMar 6, 2025
edited
Loading

Draft implementation for using clang's AST node visitor. (Not fully functional nor complete)

The current implementation is based on clang'sJSONNodeDumper, but the plan is to replace all the stringified properties with setting the raw data on nodes.

So this works like:

  • <clang does node iteration>
  • <clang callsVisit(const clang::<BaseType>*)> (eg.void ASTNodeVisitor::Visit(const Stmt* S))
  • We callInnerStmtVisitor::Visit()
  • <clang does inner node iteration>
  • <clang callsVisit<MostDerivedType>>
  • We override this visitor call (See visitor implementation startinghere)
  • We check if the node has already been processed
  • If not add a new node, and callConvert<MostDerivedType>(clang::<NodeType>, AST::<NodeType>)
  • Convert... will then callConvert...Impl on itself and it's base types
  • See the conversion implementations, startinghere
    • Also not that theConvert...Impl is the exact same code as is generated intoParseExpr/Stmt.h, in other words, with a little bit of work it should be possible to apply this for expr/stmt parsing right now

@duckdoom5duckdoom5 marked this pull request as draftMarch 6, 2025 09:44
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@duckdoom5

[8]ページ先頭

©2009-2025 Movatter.jp