LLVM
22.0.0git
include
llvm
Demangle
StringViewExtras.h
Go to the documentation of this file.
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-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// There are two copies of this file in the source tree. The one under
10
// libcxxabi is the original and the one under llvm is the copy. Use
11
// cp-to-llvm.sh to update the copy. See README.txt for more details.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#ifndef DEMANGLE_STRINGVIEW_H
16
#define DEMANGLE_STRINGVIEW_H
17
18
#include "
DemangleConfig.h
"
19
20
#include <string_view>
21
22
DEMANGLE_NAMESPACE_BEGIN
23
24
inline
bool
starts_with
(std::string_view self,
char
C
)
noexcept
{
25
return
!self.empty() && *self.begin() ==
C
;
26
}
27
28
inline
bool
starts_with
(std::string_view haystack,
29
std::string_view needle)
noexcept
{
30
if
(needle.size() > haystack.size())
31
return
false
;
32
haystack.remove_suffix(haystack.size() - needle.size());
33
return
haystack == needle;
34
}
35
36
DEMANGLE_NAMESPACE_END
37
38
#endif
C
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
DemangleConfig.h
DEMANGLE_NAMESPACE_END
#define DEMANGLE_NAMESPACE_END
Definition
DemangleConfig.h:98
DEMANGLE_NAMESPACE_BEGIN
#define DEMANGLE_NAMESPACE_BEGIN
Definition
DemangleConfig.h:97
starts_with
DEMANGLE_NAMESPACE_BEGIN bool starts_with(std::string_view self, char C) noexcept
Definition
StringViewExtras.h:24
Generated on
for LLVM by
1.14.0