diff --git a/clang/lib/Driver/ToolChains/ZOS.cpp b/clang/lib/Driver/ToolChains/ZOS.cpp --- a/clang/lib/Driver/ToolChains/ZOS.cpp +++ b/clang/lib/Driver/ToolChains/ZOS.cpp @@ -188,11 +188,10 @@ CmdArgs.push_back( Args.MakeArgString("//'" + LEHLQ + ".SCEELIB(CELQS003)'")); } else { - char *ld_side_deck = strdup(ld_env_var.str().c_str()); - ld_side_deck = strtok(ld_side_deck, ":"); - while (ld_side_deck != nullptr) { - CmdArgs.push_back(ld_side_deck); - ld_side_deck = strtok(nullptr, ":"); + SmallVector ld_side_deck; + ld_env_var.split(ld_side_deck, ":"); + for (StringRef ld_loc : ld_side_deck) { + CmdArgs.push_back((ld_loc.str()).c_str()); } } }