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

feat: Improve il2cpp line mapping parser #595

Merged
merged 4 commits into from Jun 13, 2022
Merged

Conversation

loewenheim
Copy link
Contributor

The parser will now look for the next non-comment line when it encounters a source_info comment and take that as the cpp_line, instead of just taking the source_info comment line itself.

The parser will now look for the next non-comment line when it encounters
a source_info comment and take that as the cpp_line, instead of just taking
the source_info comment line itself.
@loewenheim loewenheim requested a review from a team as a code owner June 13, 2022 11:22
Copy link
Member

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

I wonder if we should be a bit more conservative, as in:

  • emit a mapping when you have two consecutive markers without any code line in between
  • emit a trailing mapping for the second testcase, when you don’t have any non-comment line at the end of a file

I’m not quite sure we should care about that, since realistically speaking those cases won’t happen in real life code, and since this is very much best effort, we might as well ignore those.

It might be good to have a larger unit test though, with a couple more mappings in it.

Some((cs_file, cs_line)) => {
let next_non_comment_line_nr = self.lines.find_map(|(nr, src_line)| {
Copy link
Member

Choose a reason for hiding this comment

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

Is find_map defined as being "short circuiting"? It would be bad if it exhausted the whole iterator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it stops as soon as it finds the first Some return value. It's equivalent to filter_map(…).next().

@codecov-commenter
Copy link

Codecov Report

Merging #595 (cfcfa27) into master (ad84061) will increase coverage by 0.15%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #595      +/-   ##
==========================================
+ Coverage   67.74%   67.90%   +0.15%     
==========================================
  Files         102      102              
  Lines       19043    19122      +79     
==========================================
+ Hits        12900    12984      +84     
+ Misses       6143     6138       -5     

@loewenheim loewenheim merged commit 9b26fc8 into master Jun 13, 2022
@loewenheim loewenheim deleted the feat/il2cpp-parsing branch June 13, 2022 13:30
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.

None yet

3 participants