-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Move
sycl::detail::split_string
to sycl/source/detail (#13271)
It doesn't need to be part of ABI - only used internally under `sycl/source/`. Make it `inline` and operate on `std::string_view` while on it.
- Loading branch information
1 parent
9480738
commit 13b72b3
Showing
11 changed files
with
48 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//==------------ split_string.hpp ------------------------------------------==// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <string_view> | ||
#include <vector> | ||
|
||
namespace sycl { | ||
inline namespace _V1 { | ||
namespace detail { | ||
inline std::vector<std::string> split_string(std::string_view str, | ||
char delimeter) { | ||
std::vector<std::string> Result; | ||
size_t Start = 0; | ||
size_t End = 0; | ||
while ((End = str.find(delimeter, Start)) != std::string::npos) { | ||
Result.emplace_back(str.substr(Start, End - Start)); | ||
Start = End + 1; | ||
} | ||
// Get the last substring and ignore the null character so we wouldn't get | ||
// double null characters \0\0 at the end of the substring | ||
End = str.find('\0'); | ||
if (Start < End) { | ||
std::string LastSubStr(str.substr(Start, End - Start)); | ||
// In case str has a delimeter at the end, the substring will be empty, so | ||
// we shouldn't add it to the final vector | ||
if (!LastSubStr.empty()) | ||
Result.push_back(LastSubStr); | ||
} | ||
return Result; | ||
} | ||
} // namespace detail | ||
} // namespace _V1 | ||
} // namespace sycl |
This file contains 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
This file contains 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