-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Swift: Make tracer config handle resource-dirs passed to clang #20639
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: while this works, it's slightly at odds with the comment, that speaks about an
-Xccpreceding-resource-dir. So maybewould be more semantically correct in a pedantic way?
(looking back, it might also be good to somehow shorten the
resource_dir_indexname, I wouldn't mind justposorfound)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(notice one doesn't need to do bound checking in Lua, because referencing out-of-bounds indexes in a table will just give
nil, including on0and negative indexes)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the if-case do we still need to check that
args[resource_dir_index + 1]exists? Just to be sure we end up in the backup case ifargs[resource_dir_index + 1]is missingIs there specific code you're referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about that. Even if we did the fallback on a truncated args vector ending with
-resource-dir(which is an ill-formed command line we shouldn't ever encounter), we currently returnnilhere which is probably a bad thing. So maybe the full pedantic code should bethis goes for the fallback early if
-resource-diris the last argument, takes its direct successor if the preceding one is not-Xcc(which also covers the case in which it isnil, whenfound == 1), and takes theclangresource dir only for a well formed-Xcc -resource-dir -Xcc <path>/clangsequence. And it covers the devilish case in which someone very sadistic is pointing-resource-dirto a local-Xccdirectory 😆I was referring to my suggestion, where doing
args[pos - 1] == '-Xcc'doesn't need bound checkingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've implemented your fully pedantic review suggestion 😄