diff options
| author | 2023-07-19 17:14:55 -0400 | |
|---|---|---|
| committer | 2023-07-19 17:14:55 -0400 | |
| commit | 014ca709c939512569abc7765b031b496c62a884 (patch) | |
| tree | d43c24e639c9102e63c48a53ee3c8cefaee6f321 /externals/demangle/llvm/Demangle/StringViewExtras.h | |
| parent | Merge pull request #11114 from Kelebek1/warnings (diff) | |
| parent | demangle: Update to llvm/llvm-project@ecbc812e0cca (diff) | |
| download | yuzu-014ca709c939512569abc7765b031b496c62a884.tar.gz yuzu-014ca709c939512569abc7765b031b496c62a884.tar.xz yuzu-014ca709c939512569abc7765b031b496c62a884.zip | |
Merge pull request #11116 from lat9nq/clang-shadowing
general: Silence -Wshadow{,-uncaptured-local} warnings
Diffstat (limited to 'externals/demangle/llvm/Demangle/StringViewExtras.h')
| -rw-r--r-- | externals/demangle/llvm/Demangle/StringViewExtras.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/externals/demangle/llvm/Demangle/StringViewExtras.h b/externals/demangle/llvm/Demangle/StringViewExtras.h new file mode 100644 index 000000000..83685c304 --- /dev/null +++ b/externals/demangle/llvm/Demangle/StringViewExtras.h | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | //===--- StringViewExtras.h ----------*- mode:c++;eval:(read-only-mode) -*-===// | ||
| 2 | // Do not edit! See README.txt. | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-FileCopyrightText: Part of the LLVM Project | ||
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 7 | // | ||
| 8 | //===----------------------------------------------------------------------===// | ||
| 9 | // | ||
| 10 | // There are two copies of this file in the source tree. The one under | ||
| 11 | // libcxxabi is the original and the one under llvm is the copy. Use | ||
| 12 | // cp-to-llvm.sh to update the copy. See README.txt for more details. | ||
| 13 | // | ||
| 14 | //===----------------------------------------------------------------------===// | ||
| 15 | |||
| 16 | #ifndef DEMANGLE_STRINGVIEW_H | ||
| 17 | #define DEMANGLE_STRINGVIEW_H | ||
| 18 | |||
| 19 | #include "DemangleConfig.h" | ||
| 20 | |||
| 21 | #include <string_view> | ||
| 22 | |||
| 23 | DEMANGLE_NAMESPACE_BEGIN | ||
| 24 | |||
| 25 | inline bool starts_with(std::string_view self, char C) noexcept { | ||
| 26 | return !self.empty() && *self.begin() == C; | ||
| 27 | } | ||
| 28 | |||
| 29 | inline bool starts_with(std::string_view haystack, | ||
| 30 | std::string_view needle) noexcept { | ||
| 31 | if (needle.size() > haystack.size()) | ||
| 32 | return false; | ||
| 33 | haystack.remove_suffix(haystack.size() - needle.size()); | ||
| 34 | return haystack == needle; | ||
| 35 | } | ||
| 36 | |||
| 37 | DEMANGLE_NAMESPACE_END | ||
| 38 | |||
| 39 | #endif | ||