Skip to content
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

API to list the declarations overlapping macro expansion #552

Merged
merged 12 commits into from
Jun 7, 2024

Conversation

kumarak
Copy link
Member

@kumarak kumarak commented Jun 4, 2024

No description provided.

@kumarak kumarak marked this pull request as draft June 4, 2024 14:42
@kumarak kumarak changed the title API to list declarations in Macro Expansion API to list the declarations overlapping macro expansion Jun 5, 2024
@kumarak kumarak requested a review from lkorenc June 5, 2024 12:17
@kumarak kumarak marked this pull request as ready for review June 5, 2024 12:18
bin/Examples/ListDeclarationInMacroExpansions.cpp Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/Stmt.cpp Outdated Show resolved Hide resolved
@kumarak kumarak force-pushed the kumarak/macro_exp_decl branch from ce7960a to c006465 Compare June 5, 2024 12:32
lib/Decl.cpp Outdated Show resolved Hide resolved
lib/Decl.cpp Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/Stmt.cpp Outdated Show resolved Hide resolved
lib/Stmt.cpp Outdated Show resolved Hide resolved
@kumarak kumarak requested review from lkorenc and pgoodman June 5, 2024 17:22
lib/Decl.cpp Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/SQLiteEntityProvider.cpp Outdated Show resolved Hide resolved
lib/Stmt.cpp Outdated Show resolved Hide resolved
lib/Token.cpp Outdated Show resolved Hide resolved
lib/Token.cpp Outdated Show resolved Hide resolved
lib/Token.cpp Outdated Show resolved Hide resolved
lib/Token.cpp Outdated Show resolved Hide resolved
lib/TokenContext.cpp Show resolved Hide resolved
lib/SQLiteEntityProvider.cpp Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
@kumarak kumarak force-pushed the kumarak/macro_exp_decl branch from 3604669 to 062aebe Compare June 6, 2024 17:20
@kumarak kumarak force-pushed the kumarak/macro_exp_decl branch from 062aebe to 77106e2 Compare June 6, 2024 17:21
@kumarak
Copy link
Member Author

kumarak commented Jun 6, 2024

The changes does not include parsed_tokens API in MacroSubstitution. That will need changes in PASTA to add serialize and deserialize APIs for the offset and num_tokens. I will have them in different PR and it will follow Fragment::parsed_tokens.

@pgoodman
Copy link
Contributor

pgoodman commented Jun 7, 2024

The changes does not include parsed_tokens API in MacroSubstitution. That will need changes in PASTA to add serialize and deserialize APIs for the offset and num_tokens. I will have them in different PR and it will follow Fragment::parsed_tokens.

Offline discussions have settled on a design where parsed_tokens will just use first_fully_substituted_token and last_fully_substituted_token, thus not requiring database changes.

@pgoodman
Copy link
Contributor

pgoodman commented Jun 7, 2024

Offline discussions have settled in the design of moving Decl::overlapping(MacroSubstitution &) to TokenRange::overlapping_declarations and similarly TokenRange::overlapping_statements. This can be const &methods. Then we can havesub.parsed_tokens().overlapping_declaratons()`.

@kumarak kumarak force-pushed the kumarak/macro_exp_decl branch from 9caaf8e to 22171bf Compare June 7, 2024 12:45
@kumarak
Copy link
Member Author

kumarak commented Jun 7, 2024

Update PR to implement parsed_tokens and move the overlapping & covering APIs to TokenRange. This way it will be more generic and can apply on any TokenRange.

bin/Bootstrap/PASTA.cpp Outdated Show resolved Hide resolved

void PrintDeclOverlappingMacroSubstitution(const mx::Fragment &fragment, const mx::Macro &macro) {
if (auto sub = mx::MacroSubstitution::from(macro)) {
for (auto decl : sub->parsed_tokens().overlapping_declarations()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Assign generator return value to local var before iterating.

include/multiplier/Frontend/Token.h Show resolved Hide resolved
include/multiplier/Frontend/Token.h Outdated Show resolved Hide resolved
include/multiplier/Frontend/Token.h Outdated Show resolved Hide resolved
include/multiplier/Frontend/Token.h Outdated Show resolved Hide resolved
include/multiplier/Frontend/Token.h Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
lib/DeclStmtUtil.h Outdated Show resolved Hide resolved
@kumarak kumarak merged commit 393c54f into main Jun 7, 2024
1 check passed
@kumarak kumarak deleted the kumarak/macro_exp_decl branch June 7, 2024 20:54
pgoodman pushed a commit that referenced this pull request Jun 17, 2024
* Add API to list declarations containing in macro expansions

* Update to overlapping and covering implementation

* Abstract out the common code to utility function

* Update python bindings

* address review comments and add checks for macro token reader

* Move overlapping APIs to TokenRange and update python bindings
pgoodman pushed a commit that referenced this pull request Jun 18, 2024
* index: Refactor vast codegen integration.

* index: Make codegen use vast visitor list.

* git: Bump VAST and use master branch.

* Bump vast.

* Delete most auto-generated files

* Re-generate auto-generated files.

* Re-generate Python bindings.

* Pass CXX flags to rocksdb build config (#551)

* API to list the declarations overlapping macro expansion (#552)

* Add API to list declarations containing in macro expansions

* Update to overlapping and covering implementation

* Abstract out the common code to utility function

* Update python bindings

* address review comments and add checks for macro token reader

* Move overlapping APIs to TokenRange and update python bindings

* index: Refactor vast codegen integration.

* index: Make codegen use vast visitor list.

* git: Bump VAST and use master branch.

* Bump vast.

* Delete most auto-generated files

* Re-generate auto-generated files.

* Re-generate Python bindings.

* Fix to use entity ids for names. Update code style to match most other code style in mx.

* Add aggregate type interface

* Bug fix.

* Bug fix

* Hopeful fix for misidentification of definitions.

* Make nested classes in template specializations into nested fragments so that they can be subject to replacement.

---------

Co-authored-by: Peter Goodman <[email protected]>
Co-authored-by: kumarak <[email protected]>
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