| /llvm-project/clang-tools-extra/test/clang-tidy/checkers/bugprone/ |
| H A D | stringview-nullptr.cpp | 123 using string_view = basic_string_view<char>; typedef 127 using SV = std::string_view; // Used in some places for shorter line length 129 void function(std::string_view); 130 void function(std::string_view, std::string_view); 135 (void)(std::string_view(nullptr)) /* a1 */; in temporary_construction() 139 (void)(std::string_view((nullptr))) /* a2 */; in temporary_construction() 143 (void)(std::string_view({nullptr})) /* a3 */; in temporary_construction() 147 (void)(std::string_view({(nullptr)})) /* a4 */; in temporary_construction() 151 (void)(std::string_view({})) /* a5 */; // Default `const CharT*` in temporary_construction() 158 (void)(std::string_view{nullptr}) /* a6 */; in temporary_construction() [all …]
|
| H A D | dangling-handle.cpp | 72 typedef basic_string_view string_view; typedef 90 std::string_view view1 = std::string(); in Positives() 94 std::string_view view_2 = ReturnsAString(); in Positives() 102 std::string_view view3 = true ? "A" : str_ref; in Positives() 108 std::string_view view4(ReturnsAString()); in Positives() 112 std::string_view view5 = std::string("test"); in Positives() 116 std::string_view view6 = std::string{"test"}; in Positives() 128 std::string_view ReturnStatements(int i, std::string value_arg, in ReturnStatements() 161 std::string_view view() { return value; } in ReturnStatements() 165 (void)[&]()->std::string_view { in ReturnStatements() [all …]
|
| H A D | string-constructor.cpp | 24 typedef basic_string_view<char> string_view; typedef 67 std::string_view q0("test", 0); in TestView() 69 std::string_view q1(kText, -4); in TestView() 71 std::string_view q2("test", 200); in TestView() 73 std::string_view q3(kText, 200); in TestView() 75 std::string_view q4(kText2, 200); in TestView() 77 std::string_view q5(kText3, 0x1000000); in TestView() 79 std::string_view q6(nullptr); in TestView() 81 std::string_view q7 = 0; in TestView() 90 std::string_view StringViewFromZero() { in StringViewFromZero() [all …]
|
| /llvm-project/libc/test/src/__support/CPP/ |
| H A D | stringview_test.cpp | 1 //===-- Unittests for string_view -----------------------------------------===// 9 #include "src/__support/CPP/string_view.h" 12 using LIBC_NAMESPACE::cpp::string_view; 15 string_view v; in TEST() 19 v = string_view(""); in TEST() 23 v = string_view("abc", 0); in TEST() 27 v = string_view("123456789"); in TEST() 32 string_view v("abc"); in TEST() 33 ASSERT_EQ(v, string_view("abc")); in TEST() 34 ASSERT_NE(v, string_view()); in TEST() [all...] |
| /llvm-project/clang-tools-extra/test/clang-tidy/checkers/abseil/ |
| H A D | string-find-str-contains.cpp | 37 typedef basic_string_view<char> string_view; typedef 44 class string_view { class 46 string_view(); 47 string_view(const string_view &); 48 string_view(const char *); 49 ~string_view(); 50 int find(string_view s, int pos = 0); 61 std::string_view foo_ssv(std::string_view); 62 absl::string_view foo_asv(absl::string_view); 64 std::string_view bar_ssv(); [all …]
|
| H A D | redundant-strcat-calls.cpp | 6 class string_view { class 10 string_view(); 11 string_view(const char *); 12 string_view(const std::string &); 13 string_view(const char *, int); 14 string_view(string_view, int); 24 bool operator==(string_view A, string_view B); 31 AlphaNum(const string_view &pc);
|
| H A D | faster-strsplit-delimiter.cpp | 5 class string_view { class 7 string_view(); 8 string_view(const char *); 20 strings_internal::Splitter StrSplit(absl::string_view, Delim) { in StrSplit() argument 24 strings_internal::Splitter StrSplit(absl::string_view, Delim, Pred) { in StrSplit() argument 30 explicit ByAnyChar(absl::string_view); 76 absl::StrSplit("ABC", "A", [](absl::string_view) { return true; }); in SplitDelimiters() argument 123 FunctionTemplate<absl::string_view>(); in FunctionTemplateCaller()
|
| /llvm-project/llvm/include/llvm/Demangle/ |
| H A D | MicrosoftDemangle.h | 16 #include <string_view> 146 llvm::getArm64ECInsertionPointInMangledName(std::string_view MangledName); 154 SymbolNode *parse(std::string_view &MangledName); 156 TagTypeNode *parseTagUniqueName(std::string_view &MangledName); 164 SymbolNode *demangleEncodedSymbol(std::string_view &MangledName, 166 SymbolNode *demangleDeclarator(std::string_view &MangledName); 167 SymbolNode *demangleMD5Name(std::string_view &MangledName); 168 SymbolNode *demangleTypeinfoName(std::string_view &MangledName); 170 VariableSymbolNode *demangleVariableEncoding(std::string_view &MangledName, 172 FunctionSymbolNode *demangleFunctionEncoding(std::string_view [all...] |
| H A D | Demangle.h | 15 #include <string_view> 36 char *itaniumDemangle(std::string_view mangled_name, bool ParseParams = true); 55 char *microsoftDemangle(std::string_view mangled_name, size_t *n_read, 59 getArm64ECInsertionPointInMangledName(std::string_view MangledName); 62 char *rustDemangle(std::string_view MangledName); 65 char *dlangDemangle(std::string_view MangledName); 72 std::string demangle(std::string_view MangledName); 74 bool nonMicrosoftDemangle(std::string_view MangledName, std::string &Result,
|
| /llvm-project/libcxx/test/std/strings/string.view/ |
| H A D | range_concept_conformance.compile.pass.cpp | 18 static_assert(std::same_as<std::ranges::iterator_t<std::string_view>, std::string_view::iterator>); 19 static_assert(std::ranges::common_range<std::string_view>); 20 static_assert(std::ranges::random_access_range<std::string_view>); 21 static_assert(std::ranges::contiguous_range<std::string_view>); 22 static_assert(std::ranges::view<std::string_view> && std::ranges::enable_view<std::string_view>); 23 static_assert(std::ranges::sized_range<std::string_view>); 24 static_assert(std::ranges::borrowed_range<std::string_view>); 25 static_assert(std::ranges::viewable_range<std::string_view>); 27 static_assert(std::same_as<std::ranges::iterator_t<std::string_view const>, std::string_view::const… 28 static_assert(std::ranges::common_range<std::string_view const>); [all …]
|
| /llvm-project/llvm/lib/Demangle/ |
| H A D | DLangDemangle.cpp | 36 Demangler(std::string_view Mangled); 58 void parseMangle(OutputBuffer *Demangled, std::string_view &Mangled); 68 void decodeNumber(std::string_view &Mangled, unsigned long &Ret); 81 bool decodeBackrefPos(std::string_view &Mangled, long &Ret); 91 bool decodeBackref(std::string_view &Mangled, std::string_view &Ret); 101 void parseSymbolBackref(OutputBuffer *Demangled, std::string_view &Mangled); 110 void parseTypeBackref(std::string_view &Mangled); 119 bool isSymbolName(std::string_view Mangled); 128 void parseIdentifier(OutputBuffer *Demangled, std::string_view &Mangled); 139 void parseLName(OutputBuffer *Demangled, std::string_view &Mangled, [all …]
|
| H A D | MicrosoftDemangle.cpp | 28 #include <string_view> 34 static bool startsWithDigit(std::string_view S) { in startsWithDigit() 43 static bool consumeFront(std::string_view &S, char C) { in consumeFront() 50 static bool consumeFront(std::string_view &S, std::string_view C) { in consumeFront() 57 static bool consumeFront(std::string_view &S, std::string_view PrefixA, in consumeFront() 58 std::string_view PrefixB, bool A) { in consumeFront() 59 const std::string_view &Prefix = A ? PrefixA : PrefixB; in consumeFront() 63 static bool startsWith(std::string_view in startsWith() [all...] |
| /llvm-project/libcxx/test/std/strings/string.view/string.view.cons/ |
| H A D | from_range.pass.cpp | 59 std::string_view sv = nc; in test() 61 static_assert(!std::is_constructible_v<std::string_view, in test() 91 static_assert(std::is_constructible_v<std::string_view, DeletedConversionOperator>); in test() 92 static_assert(std::is_constructible_v<std::string_view, const DeletedConversionOperator>); in test() 93 static_assert(std::is_constructible_v<std::string_view, DeletedConstConversionOperator>); in test() 94 static_assert(std::is_constructible_v<std::string_view, const DeletedConstConversionOperator>); in test() 121 static_assert(std::is_constructible_v<std::string_view, std::vector<char>&>); 122 static_assert(std::is_constructible_v<std::string_view, const std::vector<char>&>); 123 static_assert(std::is_constructible_v<std::string_view, std::vector<char>&&>); 124 static_assert(std::is_constructible_v<std::string_view, const std::vector<char>&&>); [all …]
|
| /llvm-project/libcxx/test/std/ranges/range.adaptors/range.lazy.split/ |
| H A D | types.h | 24 std::string_view view_; 27 constexpr CopyableView(std::string_view v) : view_(v) {} in CopyableView() 28 …constexpr forward_iterator<std::string_view::const_iterator> begin() const { return forward_iterat… in begin() 29 …constexpr forward_iterator<std::string_view::const_iterator> end() const { return forward_iterator… in end() 40 std::string_view view_; 43 constexpr ForwardView(std::string_view v) : view_(v) {} in ForwardView() 46 …constexpr forward_iterator<std::string_view::const_iterator> begin() const { return forward_iterat… in begin() 47 …constexpr forward_iterator<std::string_view::const_iterator> end() const { return forward_iterator… in end() 61 constexpr ForwardDiffView(const char* ptr) : ForwardDiffView(std::string_view(ptr)) {} in ForwardDiffView() 62 constexpr ForwardDiffView(std::string_view v) { in ForwardDiffView() [all …]
|
| H A D | base.pass.cpp | 22 std::string_view view_; 25 constexpr MoveOnlyView(std::string_view v) : view_(v) {} in MoveOnlyView() 28 constexpr std::string_view::const_iterator begin() const { return view_.begin(); } in begin() 29 constexpr std::string_view::const_iterator end() const { return view_.end(); } in end() 43 std::string_view v_; 45 constexpr ViewWithInitTracking(std::string_view v) : v_(v) {} in ViewWithInitTracking() 73 std::ranges::lazy_split_view<View, std::string_view> v(str, " "); in test() 83 const std::ranges::lazy_split_view<View, std::string_view> v(str, " "); in test() 93 std::ranges::lazy_split_view<View, std::string_view> v(str, " "); in test() 103 const std::ranges::lazy_split_view<View, std::string_view> v(str, " "); in test()
|
| H A D | end.pass.cpp | 23 std::string_view view_; 26 constexpr ForwardViewCommonIfConst(std::string_view v) : view_(v) {} in ForwardViewCommonIfConst() 33 …constexpr forward_iterator<std::string_view::const_iterator> begin() const { return forward_iterat… in begin() 34 …constexpr forward_iterator<std::string_view::const_iterator> end() const { return forward_iterator… in end() 39 std::string_view view_; 42 constexpr ForwardViewNonCommonRange(std::string_view v) : view_(v) {} in ForwardViewNonCommonRange() 49 …constexpr forward_iterator<std::string_view::const_iterator> begin() const { return forward_iterat… in begin() 52 bool operator==(forward_iterator<std::string_view::const_iterator>, std::default_sentinel_t) { retu… in operator ==()
|
| /llvm-project/libc/src/__support/CPP/ |
| H A D | string_view.h | 1 //===-- Standalone implementation std::string_view --------------*- C++ -*-===// 20 // This is very simple alternate of the std::string_view class. There is no 25 class string_view { 46 LIBC_INLINE bool equals(string_view Other) const { in equals() 66 LIBC_INLINE constexpr string_view() : Data(nullptr), Len(0) {} 71 LIBC_INLINE constexpr string_view(const char *Str) in string_view() 75 LIBC_INLINE constexpr string_view(const char *Str, size_t N) in string_view() 80 // Returns the size of the string_view. in size() 83 // Returns whether the string_view is empty. in empty() 102 LIBC_INLINE int compare(string_view Othe in compare() 65 LIBC_INLINE constexpr string_view() : Data(nullptr), Len(0) {} string_view() function 70 LIBC_INLINE constexpr string_view(const char *Str) string_view() function 74 LIBC_INLINE constexpr string_view(const char *Str, size_t N) string_view() function [all...] |
| H A D | string.h | 15 #include "src/__support/CPP/string_view.h" 64 LIBC_INLINE string(const string_view &view) in string() 86 LIBC_INLINE string &operator=(const string_view &view) { 121 LIBC_INLINE operator string_view() const { 122 return string_view(buffer_, size_); in reserve() 170 return string_view(lhs) == string_view(rhs); 173 return string_view(lhs) != string_view(rhs); 176 return string_view(lh 118 LIBC_INLINE operator string_view() const { string_view() function [all...] |
| /llvm-project/clang/test/SemaCXX/ |
| H A D | static-assert-cxx26.cpp | 55 struct string_view { struct 58 constexpr string_view(const char* Str) : S(__builtin_strlen(Str)), D(Str) {} in string_view() argument 59 constexpr string_view(int Size, const char* Str) : S(Size), D(Str) {} in string_view() argument 68 constexpr string_view operator+(auto, string_view S) { in operator +() argument 85 static_assert(false, string_view("test")); // expected-error {{static assertion failed: test}} 86 static_assert(false, "Literal" + string_view("test")); // expected-error {{static assertion failed:… 87 static_assert(false, L"Wide Literal" + string_view("test")); // expected-error {{static assertion f… 88 static_assert(false, "Wild" "Literal" "Concatenation" + string_view("test")); // expected-error {{s… 89 static_assert(false, "Wild" "Literal" L"Concatenation" + string_view("test")); // expected-error {{… 90 static_assert(false, "Wild" u"Literal" L"Concatenation" + string_view("test")); // expected-error {… [all …]
|
| /llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string_view/ |
| H A D | main.cpp | 5 static size_t touch_string(std::string_view &in_str_view) { in touch_string() 13 std::string_view empty(""); in main() 15 std::string_view q(q_source); in main() 16 std::string_view Q("quite a long std::strin with lots of info inside it"); in main() 17 std::string_view TheVeryLongOne( in main() 88 std::string_view IHaveEmbeddedZeros("a\0b\0c\0d", 7); in main() 95 std::string_view *null_str = nullptr; in main() 98 std::string_view oops = hello + "World\n"; in main() 102 std::string_view *not_a_string_view = nullptr; in main()
|
| /llvm-project/libcxx/test/std/utilities/template.bitset/bitset.cons/ |
| H A D | string_view_ctor.pass.cpp | 32 std::string_view s("xxx1010101010xxxx"); in test_string_ctor() 38 std::string_view s("xxx1010101010xxxx"); in test_string_ctor() 44 std::string_view s("xxx1010101010xxxx"); in test_string_ctor() 50 std::string_view s("xxx1010101010xxxx"); in test_string_ctor() 56 std::string_view s("xxx1010101010xxxx"); in test_string_ctor() 62 std::string_view s("xxxbababababaxxxx"); in test_string_ctor() 70 static_assert(!std::is_convertible_v<std::string_view, std::bitset<N>>); in test_string_ctor() 71 static_assert(std::is_constructible_v<std::bitset<N>, std::string_view>); in test_string_ctor() 73 std::string_view s("1010101010"); in test_string_ctor() 82 std::string_view s("xxx1010101010"); in test_string_ctor() [all …]
|
| /llvm-project/libc/test/integration/src/pthread/ |
| H A D | pthread_name_test.cpp | 9 #include "src/__support/CPP/string_view.h" 26 using string_view = LIBC_NAMESPACE::cpp::string_view; typedef 53 ASSERT_EQ(string_view(MAIN_THREAD_NAME), in TEST_MAIN() 54 string_view(reinterpret_cast<const char *>(thread_name_buffer))); in TEST_MAIN() 63 ASSERT_EQ(string_view(CHILD_THREAD_NAME), in TEST_MAIN() 64 string_view(reinterpret_cast<const char *>(thread_name_buffer))); in TEST_MAIN() 73 string_view(CHILD_THREAD_NAME), in TEST_MAIN() 74 string_view(reinterpret_cast<const char *>(child_thread_name_buffer))); in TEST_MAIN()
|
| /llvm-project/clang-tools-extra/test/clang-tidy/checkers/readability/ |
| H A D | redundant-string-init.cpp | 33 typedef basic_string_view<char> string_view; typedef 65 std::string_view a = ""; in fview() 68 std::string_view b(""); in fview() 71 std::string_view c = R"()"; in fview() 74 std::string_view d(R"()"); in fview() 77 std::string_view e{""}; in fview() 80 std::string_view f = {""}; in fview() 84 std::string_view u = "u"; in fview() 85 std::string_view w("w"); in fview() 86 std::string_view x = R"(x)"; in fview() [all …]
|
| /llvm-project/libc/test/UnitTest/ |
| H A D | LibcTest.cpp | 13 #include "src/__support/CPP/string_view.h" 70 cpp::string_view describeValue(const cpp::string &Value) { return Value; } in describeValue() 71 cpp::string_view describeValue(cpp::string_view Value) { return Value; } in describeValue() 77 cpp::string_view OpString) -> bool { in test() 250 TEST_SPECIALIZATION(LIBC_NAMESPACE::cpp::string_view); 274 Ctx, TestCond::EQ, LHS ? cpp::string_view(LHS) : cpp::string_view(), in testStrEq() 275 RHS ? cpp::string_view(RHS) : cpp::string_view(), LHSSt in testStrEq() [all...] |
| /llvm-project/libc/src/__support/StringUtil/ |
| H A D | signal_to_string.cpp | 13 #include "src/__support/CPP/string_view.h" 45 cpp::string_view build_signal_string(int sig_num, cpp::span<char> buffer) { in build_signal_string() 46 cpp::string_view base_str; in build_signal_string() 48 base_str = cpp::string_view("Real-time signal"); in build_signal_string() 51 base_str = cpp::string_view("Unknown signal"); in build_signal_string() 68 cpp::string_view get_signal_string(int sig_num) { in get_signal_string() 73 cpp::string_view get_signal_string(int sig_num, cpp::span<char> buffer) { in get_signal_string()
|