Author: Felix Date: 2023-08-26T07:23:05Z New Revision: ffad4f8fcac5fa5e65b979ab2a2fcf903a66e5e2
URL: https://github.com/llvm/llvm-project/commit/ffad4f8fcac5fa5e65b979ab2a2fcf903a66e5e2 DIFF: https://github.com/llvm/llvm-project/commit/ffad4f8fcac5fa5e65b979ab2a2fcf903a66e5e2.diff LOG: [clang-tidy] Container-size-empty fixed c++ version in tests to support string_literals operator The goal of this PR is to properly implement the std::string_literals::operator""s that was added in commit (4001ae175cbe) but was later changed in commit (ba52a10fca6fc7b791894c584233db012def68a5). The operator""s was added in c++14 but we were running tests under c++11 which would raise an error when compiling the file. Reviewed By: PiotrZSL Differential Revision: https://reviews.llvm.org/D158691 Added: Modified: clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp index a7e4977e767455..6f1c014feccb58 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/container-size-empty.cpp @@ -1,4 +1,4 @@ -// RUN: %check_clang_tidy %s readability-container-size-empty %t -- \ +// RUN: %check_clang_tidy -std=c++14-or-later %s readability-container-size-empty %t -- \ // RUN: -config="{CheckOptions: {readability-container-size-empty.ExcludedComparisonTypes: '::std::array;::IgnoredDummyType'}}" \ // RUN: -- -fno-delayed-template-parsing -isystem %clang_tidy_headers #include <string> @@ -23,7 +23,7 @@ template <typename T> struct set { } namespace string_literals{ -string operator""_s(const char *, size_t); +string operator""s(const char *, size_t); } } @@ -778,7 +778,7 @@ bool testIgnoredDummyType(const IgnoredDummyType& value) { bool testStringLiterals(const std::string& s) { using namespace std::string_literals; - return s == ""_s; + return s == ""s; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: the 'empty' method should be used // CHECK-FIXES: {{^ }}return s.empty() } @@ -786,5 +786,5 @@ bool testStringLiterals(const std::string& s) bool testNotEmptyStringLiterals(const std::string& s) { using namespace std::string_literals; - return s == "foo"_s; + return s == "foo"s; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits