Removed build_interpreter from main()#292
Merged
anutosh491 merged 3 commits intocompiler-research:mainfrom May 1, 2025
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
- Coverage 82.46% 82.00% -0.47%
==========================================
Files 20 20
Lines 958 950 -8
Branches 88 87 -1
==========================================
- Hits 790 779 -11
- Misses 168 171 +3
... and 1 file with indirect coverage changes
🚀 New features to boost your workflow:
|
anutosh491
reviewed
Apr 27, 2025
e71a7eb to
cce9ca4
Compare
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
anutosh491
approved these changes
Apr 27, 2025
Collaborator
There was a problem hiding this comment.
As I was going through the creation of the interpreter, i realized we anyways skip the first argument anways
Line 112 in 1158ecd
So having 1 arg in the container is equally good as nothing.
This makes build_interpreter redundant as we just make some change on the 0th element through it !
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In the main function, call to
build_interpreteris redundant. Instead calling directly toxcpp::interpreter::interpreterwill work fine.Reasoning
This sets first arg and then passes all the args to
xcpp::interpreter::interpreter. Butxcpp::interpreter::interpreteralways skips the first arg(if the argv is non-null).But, what if the argv is
nullptr??. It can happen if the user manually removes all the args fromkernel.json(including the program name).It can be show that if
we are not passing any argumentis same aswe are passing only one argument(i.e. the pgroam name).createInterpreter(Args(nullptr, nullptr));is same ascreateInterpreter(Args(argv + 1, argv + 1));.Proof