aboutsummaryrefslogtreecommitdiff
path: root/runtimes
diff options
context:
space:
mode:
authorAlexander Richardson <alexrichardson@google.com>2023-10-04 15:11:37 -0700
committerGitHub <noreply@github.com>2023-10-04 18:11:37 -0400
commite5994229541bbe78c3e6eb548224b46f8c3c91be (patch)
tree843aa0402e4bc8cab8ab9a5edb1980c4eb5e4d6f /runtimes
parent5099dc341f7fa9baec160c2991072eb445469d46 (diff)
downloadllvm-e5994229541bbe78c3e6eb548224b46f8c3c91be.zip
llvm-e5994229541bbe78c3e6eb548224b46f8c3c91be.tar.gz
llvm-e5994229541bbe78c3e6eb548224b46f8c3c91be.tar.bz2
[runtimes] Fix parsing of LIB{CXX,CXXABI,UNWIND}_TEST_PARAMS (#67691)
Since 78d649a417b48cb8a2ba2e755f0e7c8fb8b1bb83 the recommended way to pass an executor is to use the _TEST_PARAMS variable, which means we now pass more complicated value (including ones that may contain multiple `=`) as part of this variable. However, the `REGEX REPLACE` being used has greedy matches so everything up to the last = becomes part of the variable name which results in invalid syntax in the generated lit config file. This was noticed due to builder failures for those using the CrossWinToARMLinux.cmake cache file. --------- Co-authored-by: Vladimir Vereschaka <vvereschaka@accesssoftek.com>
Diffstat (limited to 'runtimes')
-rw-r--r--runtimes/cmake/Modules/HandleLitArguments.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/runtimes/cmake/Modules/HandleLitArguments.cmake b/runtimes/cmake/Modules/HandleLitArguments.cmake
new file mode 100644
index 0000000..ccd5dcc
--- /dev/null
+++ b/runtimes/cmake/Modules/HandleLitArguments.cmake
@@ -0,0 +1,20 @@
+
+macro(serialize_lit_param output_var param value)
+ string(APPEND ${output_var} "config.${param} = ${value}\n")
+endmacro()
+
+macro(serialize_lit_string_param output_var param value)
+ # Ensure that all quotes in the value are escaped for a valid python string.
+ string(REPLACE "\"" "\\\"" _escaped_value "${value}")
+ string(APPEND ${output_var} "config.${param} = \"${_escaped_value}\"\n")
+endmacro()
+
+macro(serialize_lit_params_list output_var list)
+ foreach(param IN LISTS ${list})
+ string(FIND "${param}" "=" _eq_index)
+ string(SUBSTRING "${param}" 0 ${_eq_index} name)
+ string(SUBSTRING "${param}" ${_eq_index} -1 value)
+ string(SUBSTRING "${value}" 1 -1 value) # strip the leading =
+ serialize_lit_string_param("${output_var}" "${name}" "${value}")
+ endforeach()
+endmacro()