[PATCH] D63263: [clang-tidy] Fixed abseil-duration-unnecessary-conversion tests for c++17

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 13 06:39:41 PDT 2019


jvikstrom created this revision.
jvikstrom added reviewers: hokein, gribozavr.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

Fixed abseil-duration-unnecessary-conversion tests for c++17


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63263

Files:
  clang-tools-extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp
  clang-tools-extra/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp


Index: clang-tools-extra/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp
+++ clang-tools-extra/test/clang-tidy/abseil-duration-unnecessary-conversion.cpp
@@ -1,5 +1,4 @@
-// RUN: %check_clang_tidy -std=c++11,c++14 %s abseil-duration-unnecessary-conversion %t -- -- -I %S/Inputs
-// FIXME: Fix the checker to work in C++17 mode.
+// RUN: %check_clang_tidy -std=c++11-or-later %s abseil-duration-unnecessary-conversion %t -- -- -I %S/Inputs
 
 #include "absl/time/time.h"
 
Index: clang-tools-extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp
+++ clang-tools-extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp
@@ -30,10 +30,9 @@
 
     // Matcher which matches the current scale's factory with a `1` argument,
     // e.g. `absl::Seconds(1)`.
-    auto factory_matcher = cxxConstructExpr(hasArgument(
-        0,
+    auto factory_matcher = ignoringElidableConstructorCall(
         callExpr(callee(functionDecl(hasName(DurationFactory))),
-                 hasArgument(0, ignoringImpCasts(integerLiteral(equals(1)))))));
+                 hasArgument(0, ignoringImpCasts(integerLiteral(equals(1))))));
 
     // Matcher which matches either inverse function and binds its argument,
     // e.g. `absl::ToDoubleSeconds(dur)`.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63263.204519.patch
Type: text/x-patch
Size: 1556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190613/ca2e3b33/attachment.bin>


More information about the cfe-commits mailing list