Skip to content
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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

willcrozi
Copy link

@willcrozi willcrozi commented Feb 23, 2022

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 remaining project/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 to clang.

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.

This allows for passing in option values with quoted spaces such as include paths.
@willcrozi willcrozi marked this pull request as draft February 23, 2022 12:02
@willcrozi willcrozi marked this pull request as ready for review September 18, 2022 11:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant