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

Add line marker after macro expansion #27

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jan-christiansen
Copy link

This pull request adds a line marker to the end of a macro expansion to fix the line numbers of the code that follows the macro call.

I am not at all sure whether this is the best approach to solve this problem as I have little experience with the forms of macros that appear in Haskell code. However, I have tested this variant of cpphs with the 100 Haskell projects on GitHub with most stars and did not discover any problems in highlighting at least the top-level identifiers in the original source files, where the source positions were taken from the preprocessed file.

The problem that motivated this pull request was caused by https://github.com/clash-lang/clash-compiler/blob/47b8fa7c84825f94c3c84b3428f6766c8391f899/clash-lib/src/Clash/Core/Subst.hs#L448 and the macro at https://github.com/clash-lang/clash-compiler/blob/47b8fa7c84825f94c3c84b3428f6766c8391f899/clash-lib/src/ClashDebug.h#L5. In this example, the source positions of https://github.com/clash-lang/clash-compiler/blob/47b8fa7c84825f94c3c84b3428f6766c8391f899/clash-lib/src/Clash/Core/Subst.hs#L458 and all following are wrong.

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.

1 participant