[PATCH] D63262: [clang-tidy] Made abseil-upgrade-duration-conversions tests pass on c++17
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 13 07:24:46 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL363270: [clang-tidy] Made abseil-upgrade-duration-conversions 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/D63262?vs=204517&id=204532#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63262/new/
https://reviews.llvm.org/D63262
Files:
clang-tools-extra/trunk/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
Index: clang-tools-extra/trunk/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
@@ -40,7 +40,8 @@
callee(functionDecl(
hasParent(functionTemplateDecl()),
unless(hasTemplateArgument(0, refersToType(builtinType()))),
- hasAnyName("operator*=", "operator/=")))),
+ hasAnyName("operator*=", "operator/="))))
+ .bind("OuterExpr"),
this);
// Match expressions like `a.operator*=(b)` and `a.operator/=(b)` where `a`
@@ -52,7 +53,8 @@
hasParent(functionTemplateDecl()),
unless(hasTemplateArgument(0, refersToType(builtinType()))),
hasAnyName("operator*=", "operator/="))),
- argumentCountIs(1), hasArgument(0, expr().bind("arg"))),
+ argumentCountIs(1), hasArgument(0, expr().bind("arg")))
+ .bind("OuterExpr"),
this);
// Match expressions like `a * b`, `a / b`, `operator*(a, b)`, and
@@ -66,7 +68,8 @@
argumentCountIs(2),
hasArgument(0, expr(hasType(
cxxRecordDecl(hasName("::absl::Duration"))))),
- hasArgument(1, expr().bind("arg"))),
+ hasArgument(1, expr().bind("arg")))
+ .bind("OuterExpr"),
this);
// Match expressions like `a * b` and `operator*(a, b)` where `a` is not of a
@@ -77,8 +80,9 @@
unless(hasTemplateArgument(0, refersToType(builtinType()))),
hasName("::absl::operator*"))),
argumentCountIs(2), hasArgument(0, expr().bind("arg")),
- hasArgument(1, expr(hasType(cxxRecordDecl(
- hasName("::absl::Duration")))))),
+ hasArgument(1, expr(hasType(
+ cxxRecordDecl(hasName("::absl::Duration"))))))
+ .bind("OuterExpr"),
this);
// For the factory functions, we match only the non-templated overloads that
@@ -103,8 +107,9 @@
has(implicitCastExpr(hasCastKind(CK_UserDefinedConversion)))),
hasParent(callExpr(
callee(functionDecl(DurationFactoryFunction(),
- unless(hasParent(functionTemplateDecl())))),
- hasArgument(0, expr().bind("arg"))))),
+ unless(hasParent(functionTemplateDecl())))),
+ hasArgument(0, expr().bind("arg")))))
+ .bind("OuterExpr"),
this);
}
@@ -117,7 +122,10 @@
const auto *ArgExpr = Result.Nodes.getNodeAs<Expr>("arg");
SourceLocation Loc = ArgExpr->getBeginLoc();
- if (!match(isInTemplateInstantiation(), *ArgExpr, *Result.Context).empty()) {
+ const auto *OuterExpr = Result.Nodes.getNodeAs<Expr>("OuterExpr");
+
+ if (!match(isInTemplateInstantiation(), *OuterExpr, *Result.Context)
+ .empty()) {
if (MatchedTemplateLocations.count(Loc.getRawEncoding()) == 0) {
// For each location matched in a template instantiation, we check if the
// location can also be found in `MatchedTemplateLocations`. If it is not
Index: clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/abseil-upgrade-duration-conversions.cpp
@@ -1,4 +1,4 @@
-// RUN: %check_clang_tidy -std=c++11,c++14 %s abseil-upgrade-duration-conversions %t -- -- -I%S/Inputs
+// RUN: %check_clang_tidy -std=c++11-or-later %s abseil-upgrade-duration-conversions %t -- -- -I%S/Inputs
// FIXME: Fix the checker to work in C++17 mode.
using int64_t = long long;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63262.204532.patch
Type: text/x-patch
Size: 3944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190613/7e29b372/attachment.bin>
More information about the cfe-commits
mailing list