[clang-tools-extra] r352964 - [clang-tidy] Rename time lookup functions; NFC
Hyrum Wright via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 2 11:57:38 PST 2019
Author: hwright
Date: Sat Feb 2 11:57:37 2019
New Revision: 352964
URL: http://llvm.org/viewvc/llvm-project?rev=352964&view=rev
Log:
[clang-tidy] Rename time lookup functions; NFC
Modified:
clang-tools-extra/trunk/clang-tidy/abseil/DurationAdditionCheck.cpp
clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp
clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h
Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationAdditionCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationAdditionCheck.cpp?rev=352964&r1=352963&r2=352964&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationAdditionCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationAdditionCheck.cpp Sat Feb 2 11:57:37 2019
@@ -22,7 +22,7 @@ void DurationAdditionCheck::registerMatc
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
if (!Scale)
return;
- llvm::StringRef TimeFactory = getTimeFactoryForScale(*Scale);
+ llvm::StringRef TimeFactory = getTimeInverseForScale(*Scale);
FixItHint Hint;
if (Call == Binop->getLHS()->IgnoreParenImpCasts()) {
Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp?rev=352964&r1=352963&r2=352964&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.cpp Sat Feb 2 11:57:37 2019
@@ -104,7 +104,7 @@ llvm::StringRef getDurationFactoryForSca
}
/// 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";
Modified: clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h?rev=352964&r1=352963&r2=352964&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h (original)
+++ clang-tools-extra/trunk/clang-tidy/abseil/DurationRewriter.h Sat Feb 2 11:57:37 2019
@@ -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> getScaleFo
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::inter
}
AST_MATCHER_FUNCTION(ast_matchers::internal::Matcher<FunctionDecl>,
- TimeFactoryFunction) {
+ TimeConversionFunction) {
using namespace clang::ast_matchers;
return functionDecl(hasAnyName(
"::absl::ToUnixHours", "::absl::ToUnixMinutes", "::absl::ToUnixSeconds",
More information about the cfe-commits
mailing list