diff options
author | Hyrum Wright <hwright@google.com> | 2019-02-02 19:57:37 +0000 |
---|---|---|
committer | Hyrum Wright <hwright@google.com> | 2019-02-02 19:57:37 +0000 |
commit | d3156cee564b7dfb0c4147656562e30befd259ae (patch) | |
tree | c2ebb8ed24ee7cc65bfd05e968dc20947e435116 | |
parent | 2a24769502cdd179f17d94fd650299bfd0e3d56b (diff) | |
download | clang-tools-extra-d3156cee564b7dfb0c4147656562e30befd259ae.tar.gz |
[clang-tidy] Rename time lookup functions; NFC
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@352964 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | clang-tidy/abseil/DurationAdditionCheck.cpp | 4 | ||||
-rw-r--r-- | clang-tidy/abseil/DurationRewriter.cpp | 2 | ||||
-rw-r--r-- | clang-tidy/abseil/DurationRewriter.h | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/clang-tidy/abseil/DurationAdditionCheck.cpp b/clang-tidy/abseil/DurationAdditionCheck.cpp index 51b9f577..60047096 100644 --- a/clang-tidy/abseil/DurationAdditionCheck.cpp +++ b/clang-tidy/abseil/DurationAdditionCheck.cpp @@ -22,7 +22,7 @@ void DurationAdditionCheck::registerMatchers(MatchFinder *Finder) { Finder->addMatcher( binaryOperator(hasOperatorName("+"), hasEitherOperand(expr(ignoringParenImpCasts( - callExpr(callee(functionDecl(TimeFactoryFunction()) + callExpr(callee(functionDecl(TimeConversionFunction()) .bind("function_decl"))) .bind("call"))))) .bind("binop"), @@ -43,7 +43,7 @@ void DurationAdditionCheck::check(const MatchFinder::MatchResult &Result) { if (!Scale) return; - llvm::StringRef TimeFactory = getTimeFactoryForScale(*Scale); + llvm::StringRef TimeFactory = getTimeInverseForScale(*Scale); FixItHint Hint; if (Call == Binop->getLHS()->IgnoreParenImpCasts()) { diff --git a/clang-tidy/abseil/DurationRewriter.cpp b/clang-tidy/abseil/DurationRewriter.cpp index fb974f6c..c3e40789 100644 --- a/clang-tidy/abseil/DurationRewriter.cpp +++ b/clang-tidy/abseil/DurationRewriter.cpp @@ -104,7 +104,7 @@ llvm::StringRef getDurationFactoryForScale(DurationScale Scale) { } /// Returns the Time factory function name for a given `Scale`. -llvm::StringRef getTimeFactoryForScale(DurationScale scale) { +llvm::StringRef getTimeInverseForScale(DurationScale scale) { switch (scale) { case DurationScale::Hours: return "absl::ToUnixHours"; diff --git a/clang-tidy/abseil/DurationRewriter.h b/clang-tidy/abseil/DurationRewriter.h index 36dd5396..54a60f60 100644 --- a/clang-tidy/abseil/DurationRewriter.h +++ b/clang-tidy/abseil/DurationRewriter.h @@ -31,9 +31,6 @@ enum class DurationScale : std::uint8_t { /// constructing a `Duration` for that scale. llvm::StringRef getDurationFactoryForScale(DurationScale Scale); -/// Returns the Time factory function name for a given `Scale`. -llvm::StringRef getTimeFactoryForScale(DurationScale scale); - // Determine if `Node` represents a literal floating point or integral zero. bool IsLiteralZero(const ast_matchers::MatchFinder::MatchResult &Result, const Expr &Node); @@ -75,6 +72,9 @@ llvm::Optional<DurationScale> getScaleForTimeInverse(llvm::StringRef Name); const std::pair<llvm::StringRef, llvm::StringRef> & getDurationInverseForScale(DurationScale Scale); +/// Returns the Time inverse function name for a given `Scale`. +llvm::StringRef getTimeInverseForScale(DurationScale scale); + /// Assuming `Node` has type `double` or `int` representing a time interval of /// `Scale`, return the expression to make it a suitable `Duration`. std::string rewriteExprFromNumberToDuration( @@ -107,7 +107,7 @@ AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>, } AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>, - TimeFactoryFunction) { + TimeConversionFunction) { using namespace clang::ast_matchers; return functionDecl(hasAnyName( "::absl::ToUnixHours", "::absl::ToUnixMinutes", "::absl::ToUnixSeconds", |