[PATCH] D63253: [clang-tidy] Made abseil-faster-strsplit-delimiter tests pass on C++17
Dmitri Gribenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 08:14:56 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363273: [clang-tidy] Made abseil-faster-strsplit-delimiter tests pass on C++17 (authored by gribozavr, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D63253?vs=204495&id=204549#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63253/new/
https://reviews.llvm.org/D63253
Files:
clang-tools-extra/trunk/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/abseil-faster-strsplit-delimiter.cpp
Index: clang-tools-extra/trunk/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
@@ -20,21 +20,6 @@
AST_MATCHER(StringLiteral, lengthIsOne) { return Node.getLength() == 1; }
-::internal::Matcher<Expr>
-constructExprWithArg(llvm::StringRef ClassName,
- const ::internal::Matcher<Expr> &Arg) {
- auto ConstrExpr = cxxConstructExpr(hasType(recordDecl(hasName(ClassName))),
- hasArgument(0, ignoringParenCasts(Arg)));
-
- return anyOf(ConstrExpr, cxxBindTemporaryExpr(has(ConstrExpr)));
-}
-
-::internal::Matcher<Expr>
-copyConstructExprWithArg(llvm::StringRef ClassName,
- const ::internal::Matcher<Expr> &Arg) {
- return constructExprWithArg(ClassName, constructExprWithArg(ClassName, Arg));
-}
-
llvm::Optional<std::string> makeCharacterLiteral(const StringLiteral *Literal) {
std::string Result;
{
@@ -74,11 +59,17 @@
// Binds to a string_view (either absl or std) that was passed by value and
// contructed from string literal.
- auto StringViewArg =
- copyConstructExprWithArg("::absl::string_view", SingleChar);
+ auto StringViewArg = ignoringElidableConstructorCall(ignoringImpCasts(
+ cxxConstructExpr(hasType(recordDecl(hasName("::absl::string_view"))),
+ hasArgument(0, ignoringParenImpCasts(SingleChar)))));
+ // Need to ignore the elidable constructor as otherwise there is no match for
+ // c++14 and earlier.
auto ByAnyCharArg =
- expr(copyConstructExprWithArg("::absl::ByAnyChar", StringViewArg))
+ expr(has(ignoringElidableConstructorCall(
+ ignoringParenCasts(cxxBindTemporaryExpr(has(cxxConstructExpr(
+ hasType(recordDecl(hasName("::absl::ByAnyChar"))),
+ hasArgument(0, StringViewArg))))))))
.bind("ByAnyChar");
// Find uses of absl::StrSplit(..., "x") and absl::StrSplit(...,
Index: clang-tools-extra/trunk/test/clang-tidy/abseil-faster-strsplit-delimiter.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/abseil-faster-strsplit-delimiter.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/abseil-faster-strsplit-delimiter.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -std=c++11,c++14 %s abseil-faster-strsplit-delimiter %t
+// RUN: %check_clang_tidy -std=c++11-or-later %s abseil-faster-strsplit-delimiter %t
// FIXME: Fix the checker to work in C++17 mode.
namespace absl {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63253.204549.patch
Type: text/x-patch
Size: 2710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190613/7db0ec6d/attachment.bin>
More information about the llvm-commits
mailing list