This repository has been archived by the owner on Jan 26, 2024. It is now read-only.
RTC options: don't split quoted sections of string values #30
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.
This PR changes the splitting logic for runtime-compiler (RTC) options of type
OT_CSTRING
so that any spaces within double-quoted sections are not treated as the split point.This allows for passing in option values with quoted sections such as include paths that include spaces, allowing projects using ROCm run-time compilation to be more robust if the user's environment has paths with spaces.
As an example, previously the option string:
-I INCLUDE_PATH="/path/to/some project/include"
would result in a parsed option value of-IINCLUDE_PATH="/path/to/some
and then an option parsing error on the remainingproject/include
section. This problem occurs even if the entire option value is quoted, e.g.-I "INCLUDE_PATH=/path/to/some project/include"
since the splitting logic (in compiler/lib/utils/options.cpp:getOptionDesc()) was not keeping track of quoted sections.After this PR the parsed option value will be as desired:
-IINCLUDE_PATH="/path/to/some project/include"
meaning the quoted section is preserved and passed toclang
.The new quote handling works as a loop until it finds an unquoted space, meaning it can handle multiple quoted sections in the input string. Currently no attempt has been made to handle escaped quotes/spaces.
I've tested this with a stripped down version of the code in the compiler/libs/utils directory but ran into problems getting a full ROCm installation built from source, and so currently I'm unable to fully test.