| /llvm-project-15.0.7/clang-tools-extra/test/clang-tidy/checkers/abseil/ |
| H A D | duration-unnecessary-conversion.cpp | 9 d2 = absl::Hours(absl::ToDoubleHours(d1)); in f() 12 d2 = absl::Minutes(absl::ToDoubleMinutes(d1)); in f() 29 d2 = absl::Hours(absl::ToInt64Hours(d1)); in f() 48 d2 = absl::Hours(d1 / absl::Hours(1)); in f() 67 d2 = absl::Hours(absl::FDivDuration(d1, absl::Hours(1))); in f() 70 d2 = absl::Minutes(absl::FDivDuration(d1, absl::Minutes(1))); in f() 73 d2 = absl::Seconds(absl::FDivDuration(d1, absl::Seconds(1))); in f() 76 d2 = absl::Milliseconds(absl::FDivDuration(d1, absl::Milliseconds(1))); in f() 79 d2 = absl::Microseconds(absl::FDivDuration(d1, absl::Microseconds(1))); in f() 82 d2 = absl::Nanoseconds(absl::FDivDuration(d1, absl::Nanoseconds(1))); in f() [all …]
|
| H A D | time-subtraction.cpp | 8 absl::Time t; in f() 12 d = absl::Hours(absl::ToUnixHours(t) - x); in f() 15 d = absl::Minutes(absl::ToUnixMinutes(t) - x); in f() 18 d = absl::Seconds(absl::ToUnixSeconds(t) - x); in f() 21 d = absl::Milliseconds(absl::ToUnixMillis(t) - x); in f() 24 d = absl::Microseconds(absl::ToUnixMicros(t) - x); in f() 27 d = absl::Nanoseconds(absl::ToUnixNanos(t) - x); in f() 59 g(absl::Seconds(absl::ToUnixSeconds(t) - x)); in f() 62 g(absl::Seconds(x - absl::ToUnixSeconds(t))); in f() 73 d = absl::Seconds(absl::ToUnixMicros(t) - x); in f() [all …]
|
| H A D | duration-factory-scale.cpp | 9 absl::Duration d; in ScaleTest() 12 d = absl::Hours(0); in ScaleTest() 15 d = absl::Minutes(0); in ScaleTest() 18 d = absl::Seconds(0); in ScaleTest() 21 d = absl::Milliseconds(0); in ScaleTest() 24 d = absl::Microseconds(0); in ScaleTest() 27 d = absl::Nanoseconds(0); in ScaleTest() 30 d = absl::Seconds(0.0); in ScaleTest() 36 d = absl::Seconds(int{0}); in ScaleTest() 97 d = absl::Seconds(60); in ScaleTest() [all …]
|
| H A D | upgrade-duration-conversions.cpp | 18 absl::Duration d; in arithmeticOperatorBasicPositive() 71 absl::Duration d; in arithmeticOperatorBasicNegative() 128 void templateForOpsSpecialization<absl::Duration>(absl::Duration d) { in templateForOpsSpecialization() 135 absl::Duration d; in arithmeticNonTypeTemplateParamSpecialization() 140 absl::Duration d; in arithmeticNonTypeTemplateParamSpecialization() 147 absl::Duration d; in templateOpsFix() 156 absl::Duration d; in templateOpsWarnOnly() 173 absl::Duration d; 197 absl::Duration d; in templateOpsInstantiationBeforeDefinition() 210 absl::Duration d; in arithmeticTemplateAndMacro() [all …]
|
| H A D | duration-factory-float.cpp | 6 absl::Duration d; in ConvertFloatTest() 8 d = absl::Seconds(60.0); in ConvertFloatTest() 11 d = absl::Minutes(300.0); in ConvertFloatTest() 18 d = absl::Seconds(3.0f); in ConvertFloatTest() 21 d = absl::Seconds(3.); in ConvertFloatTest() 35 d = ::absl::Seconds(1); in ConvertFloatTest() 37 d = ::absl::Hours(1); in ConvertFloatTest() 47 d = absl::Seconds(x); in ConvertFloatTest() 49 d = absl::Minutes(y); in ConvertFloatTest() 61 absl::Duration d; in InTemplate() [all …]
|
| H A D | faster-strsplit-delimiter.cpp | 3 namespace absl { namespace 42 absl::StrSplit("ABC", "A"); in SplitDelimiters() 46 absl::StrSplit("ABC", "\x01"); in SplitDelimiters() 62 absl::StrSplit("ABC", R"( in SplitDelimiters() 71 absl::StrSplit("ABC", absl::ByAnyChar("\n")); in SplitDelimiters() 76 absl::StrSplit("ABC", "A", [](absl::string_view) { return true; }); in SplitDelimiters() 82 absl::StrSplit("ABC", absl::ByAnyChar("")); in SplitDelimiters() 83 absl::StrSplit("ABC", absl::ByAnyChar(" \t")); in SplitDelimiters() 86 absl::StrSplit("ABC", "'"); in SplitDelimiters() 94 absl::StrSplit("ABC", absl::MaxSplits("\t", 1)); in SplitDelimiters() [all …]
|
| H A D | duration-addition.cpp | 6 absl::Time t; in f() 9 i = absl::ToUnixHours(t) + 5; in f() 12 i = absl::ToUnixMinutes(t) + 5; in f() 15 i = absl::ToUnixSeconds(t) + 5; in f() 18 i = absl::ToUnixMillis(t) + 5; in f() 24 i = absl::ToUnixNanos(t) + 5; in f() 28 i = 3 + absl::ToUnixHours(t); in f() 48 i = absl::ToUnixMicros(t) + absl::ToInt64Microseconds(absl::Seconds(1)); in f() 79 i += absl::ToInt64Microseconds(absl::Seconds(1)); in f() 88 void foo(absl::Time t) { in foo() [all …]
|
| H A D | duration-comparison.cpp | 7 absl::Duration d1, d2; in f() 9 absl::Time t1, t2; in f() 12 b = x > absl::ToDoubleSeconds(d1); in f() 15 b = x >= absl::ToDoubleSeconds(d1); in f() 18 b = x == absl::ToDoubleSeconds(d1); in f() 21 b = x <= absl::ToDoubleSeconds(d1); in f() 24 b = x < absl::ToDoubleSeconds(d1); in f() 30 b = absl::ToDoubleSeconds(d1) > absl::ToDoubleSeconds(d2); in f() 72 b = x < absl::ToDoubleHours(d1); in f() 92 b = x < absl::ToInt64Hours(d1); in f() [all …]
|
| H A D | duration-subtraction.cpp | 7 absl::Duration d, d1, d2; in f() 9 x = absl::ToDoubleSeconds(d) - 1.0; in f() 12 x = absl::ToDoubleSeconds(d) - absl::ToDoubleSeconds(d1); in f() 18 x = absl::ToDoubleHours(d) - 1.0; in f() 21 x = absl::ToDoubleMinutes(d) - 1; in f() 35 #define THIRTY absl::Seconds(30) in f() 47 x = absl::ToDoubleSeconds(d) - absl::ToDoubleSeconds(absl::Seconds(5)); in f() 50 x = absl::ToDoubleSeconds(d) - absl::ToDoubleSeconds(absl::Seconds(absl::ToDoubleSeconds(d1))); in f() 57 x = absl::ToDoubleSeconds(d) + 1.0; in f() 58 x = absl::ToDoubleSeconds(d) * 1.0; in f() [all …]
|
| H A D | time-comparison.cpp | 7 absl::Duration d1, d2; in f() 9 absl::Time t1, t2; in f() 12 b = x > absl::ToUnixSeconds(t1); in f() 15 b = x >= absl::ToUnixSeconds(t1); in f() 18 b = x == absl::ToUnixSeconds(t1); in f() 21 b = x <= absl::ToUnixSeconds(t1); in f() 24 b = x < absl::ToUnixSeconds(t1); in f() 30 b = absl::ToUnixSeconds(t1) > absl::ToUnixSeconds(t2); in f() 35 b = absl::ToUnixSeconds(t1) < x; in f() 72 b = x < absl::ToUnixHours(t1); in f() [all …]
|
| H A D | duration-conversion-cast.cpp | 6 absl::Duration d1; in f() 10 i = static_cast<int>(absl::ToDoubleHours(d1)); in f() 13 x = static_cast<float>(absl::ToInt64Hours(d1)); in f() 16 i = static_cast<int>(absl::ToDoubleMinutes(d1)); in f() 19 x = static_cast<float>(absl::ToInt64Minutes(d1)); in f() 22 i = static_cast<int>(absl::ToDoubleSeconds(d1)); in f() 48 i = int(absl::ToDoubleHours(d1)); in f() 51 x = float(absl::ToInt64Microseconds(d1)); in f() 56 i = (int) absl::ToDoubleHours(d1); in f() 59 x = (float) absl::ToInt64Microseconds(d1); in f() [all …]
|
| H A D | no-internal-dependencies.cpp | 12 absl::strings_internal::InternalFunction(); in DirectAcess() 15 absl::strings_internal::InternalTemplateFunction<std::string>("a"); in DirectAcess() 20 friend struct absl::container_internal::InternalStruct; 24 namespace absl { namespace 33 std::string Str = absl::StringsFunction("a"); in CorrectUsage() 34 absl::SomeContainer b; in CorrectUsage() 37 namespace absl { namespace 39 std::string Str = absl::StringsFunction("a"); 42 #define USE_EXTERNAL(x) absl::strings_internal::Internal##x() 50 class A : absl::container_internal::InternalStruct {}; [all …]
|
| H A D | string-find-str-contains.cpp | 42 namespace absl { namespace 63 absl::string_view foo_asv(absl::string_view); 66 absl::string_view bar_asv(); 97 absl::string_view asv; in basic_tests() 134 absl::string_view asv; in mismatched_npos() 173 absl::string_view asv, asv2; in subexpression_tests() 218 absl::string_view asv; in string_literal_and_char_ptr_tests() 243 absl::string_view asv; in char_param_tests() 265 absl::string_view asv; in no_nonzero_pos() 277 absl::string_view asv; in no_count() [all …]
|
| H A D | cleanup-ctad.cpp | 23 namespace absl { namespace 73 absl::Cleanup<cleanup_internal::Tag, Callback> MakeCleanup(Callback callback) { in MakeCleanup() 80 auto a = absl::MakeCleanup([] {}); in test() 84 auto b = absl::MakeCleanup(std::function<void()>([] {})); in test() 88 const auto c = absl::MakeCleanup([] {}); in test() 92 const auto d = absl::MakeCleanup(std::function<void()>([] {})); in test() 97 auto e = absl::MakeCleanup(([] {})); in test() 102 auto f = /* a */ absl::MakeCleanup(/* b */ [] { /* c */ } /* d */) /* e */; in test()
|
| /llvm-project-15.0.7/clang-tools-extra/docs/clang-tidy/checks/abseil/ |
| H A D | duration-unnecessary-conversion.rst | 14 absl::Duration d1; 15 absl::Duration d2 = absl::Seconds(absl::ToDoubleSeconds(d1)); 18 absl::Duration d2 = d1; 21 absl::Duration d2 = absl::Seconds(absl::FDivDuration(d1, absl::Seconds(1))); 24 absl::Duration d2 = d1; 31 absl::Duration d1; 32 absl::Duration d2 = absl::Hours(absl::ToInt64Hours(d1)); 35 absl::Duration d2 = d1; 38 absl::Duration d2 = absl::Seconds(d1 / absl::Seconds(1)); 48 absl::Duration d1; [all …]
|
| H A D | time-subtraction.rst | 13 ``absl::Time``. 14 - When the second argument is a ``absl::Time``. 17 the second operand could be either an ``absl::Time`` or an ``absl::Duration``. 19 subtracting an ``absl::Time`` from an ``absl::Duration`` is not defined. 26 absl::Time t; 28 // Original - absl::Duration result and first operand is an absl::Time. 29 absl::Duration d = absl::Seconds(absl::ToUnixSeconds(t) - x); 32 absl::Duration d = t - absl::FromUnixSeconds(x); 35 // Original - Second operand is an absl::Time. 36 int i = x - absl::ToUnixSeconds(t); [all …]
|
| H A D | duration-factory-scale.rst | 6 Checks for cases where arguments to ``absl::Duration`` factory functions are 9 ``absl::ZeroDuration()`` instead. 17 absl::Duration d = absl::Seconds(60 * x); 19 // Suggested - Use absl::Minutes instead. 20 absl::Duration d = absl::Minutes(x); 25 absl::Duration d = absl::Milliseconds(y / 1000.); 27 // Suggested - Use absl:::Seconds instead. 28 absl::Duration d = absl::Seconds(y); 32 absl::Duration d = absl::Hours(0); 34 // Suggested = Use absl::ZeroDuration instead [all …]
|
| H A D | duration-division.rst | 6 ``absl::Duration`` arithmetic works like it does with integers. That means that 7 division of two ``absl::Duration`` objects returns an ``int64`` with any fractional 14 absl::Duration d = absl::Seconds(3.5); 15 int64 sec1 = d / absl::Seconds(1); // Truncates toward 0. 16 int64 sec2 = absl::ToInt64Seconds(d); // Equivalent to division. 19 double dsec = d / absl::Seconds(1); // WRONG: Still truncates toward 0. 23 ``absl::FDivDuration()`` function, or one of the unit conversion functions such 24 as ``absl::ToDoubleSeconds()``. For example: 28 absl::Duration d = absl::Seconds(3.5); 29 double dsec1 = absl::FDivDuration(d, absl::Seconds(1)); // GOOD: No truncation. [all …]
|
| H A D | faster-strsplit-delimiter.rst | 6 Finds instances of ``absl::StrSplit()`` or ``absl::MaxSplits()`` where the 9 It will also catch code using ``absl::ByAnyChar()`` for just a single character 20 for (auto piece : absl::StrSplit(str, "B")) { 23 // overload of absl::StrSplit() to be used. 24 for (auto piece : absl::StrSplit(str, 'B')) { 28 for (auto piece : absl::StrSplit(str, absl::ByAnyChar("B"))) { 31 // overload of absl::StrSplit() to be used and we do not need absl::ByAnyChar 33 for (auto piece : absl::StrSplit(str, 'B')) { 37 for (auto piece : absl::StrSplit(str, absl::MaxSplits("B", 1))) { 40 // overload of absl::StrSplit() to be used. [all …]
|
| H A D | duration-subtraction.rst | 7 ``absl::Duration`` domain. When subtracting two values, and the first one is 8 known to be a conversion from ``absl::Duration``, we can infer that the second 9 should also be interpreted as an ``absl::Duration``, and make that inference 18 absl::Duration d; 19 double result = absl::ToDoubleSeconds(d) - x; 21 // Suggestion - Subtraction in the absl::Duration domain instead 22 double result = absl::ToDoubleSeconds(d - absl::Seconds(x)); 25 absl::Duration d1, d2; 26 double result = absl::ToDoubleSeconds(d1) - absl::ToDoubleSeconds(d2); 28 // Suggestion - Subtraction in the absl::Duration domain instead [all …]
|
| H A D | redundant-strcat-calls.rst | 6 Suggests removal of unnecessary calls to ``absl::StrCat`` when the result is 7 being passed to another call to ``absl::StrCat`` or ``absl::StrAppend``. 16 std::string s = absl::StrCat("A", absl::StrCat("B", absl::StrCat("C", "D"))); 19 std::string s = absl::StrCat("A", "B", "C", "D"); 22 absl::StrAppend(&s, absl::StrCat("E", "F", "G")); 25 absl::StrAppend(&s, "E", "F", "G");
|
| H A D | duration-factory-float.rst | 7 ``absl::Duration`` factory functions are called when the more-efficient 19 absl::Duration d = absl::Seconds(10.0); 22 absl::Duration d = absl::Seconds(10); 26 absl::Duration d = absl::Seconds(static_cast<double>(10)); 29 absl::Duration d = absl::Seconds(10);
|
| H A D | duration-addition.rst | 6 Check for cases where addition should be performed in the ``absl::Time`` domain. 7 When adding two values, and one is known to be an ``absl::Time``, we can infer 8 that the other should be interpreted as an ``absl::Duration`` of a similar 17 absl::Time t; 18 int result = absl::ToUnixSeconds(t) + x; 20 // Suggestion - Addition in the absl::Time domain 21 int result = absl::ToUnixSeconds(t + absl::Seconds(x));
|
| H A D | duration-comparison.rst | 6 Checks for comparisons which should be in the ``absl::Duration`` domain instead 20 absl::Duration d; 21 if (x < absl::ToDoubleSeconds(d)) ... 23 // Suggested - Compare in the absl::Duration domain instead 24 if (absl::Seconds(x) < d) ... 29 absl::Duration d; 30 if (x < absl::ToInt64Microseconds(d)) ... 32 // Suggested - Compare in the absl::Duration domain instead 33 if (absl::Microseconds(x) < d) ...
|
| /llvm-project-15.0.7/clang-tools-extra/test/clang-tidy/checkers/bugprone/ |
| H A D | unchecked-optional-access.cpp | 5 void unchecked_value_access(const absl::optional<int> &opt) { in unchecked_value_access() 24 void checked_access(const absl::optional<int> &opt) { in checked_access() 36 void function_template_with_user(const absl::optional<T> &opt) { in function_template_with_user() 41 void function_template_user(const absl::optional<int> &opt) { in function_template_user() 53 const absl::optional<int> &opt) { in function_template_with_specialization() 60 void f(const absl::optional<int> &opt) { in f() 67 void f(const absl::optional<int> &opt) { in f() 74 void f(const absl::optional<int> &opt) { in f() 97 void multiple_unchecked_accesses(absl::optional<int> opt1, in multiple_unchecked_accesses() 98 absl::optional<int> opt2) { in multiple_unchecked_accesses() [all …]
|