diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.cpp b/clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.cpp index 11d6017..ef06a9e 100644 --- a/clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.cpp +++ b/clang-tools-extra/clang-tidy/abseil/DurationConversionCastCheck.cpp @@ -41,7 +41,7 @@ void DurationConversionCastCheck::check( const auto *FuncDecl = Result.Nodes.getNodeAs<FunctionDecl>("func_decl"); const auto *Arg = Result.Nodes.getNodeAs<Expr>("arg"); - StringRef ConversionFuncName = FuncDecl->getName(); + const StringRef ConversionFuncName = FuncDecl->getName(); std::optional<DurationScale> Scale = getScaleForDurationInverse(ConversionFuncName); @@ -51,7 +51,8 @@ void DurationConversionCastCheck::check( // Casting a double to an integer. if (MatchedCast->getTypeAsWritten()->isIntegerType() && ConversionFuncName.contains("Double")) { - llvm::StringRef NewFuncName = getDurationInverseForScale(*Scale).second; + const llvm::StringRef NewFuncName = + getDurationInverseForScale(*Scale).second; diag(MatchedCast->getBeginLoc(), "duration should be converted directly to an integer rather than " @@ -66,7 +67,8 @@ void DurationConversionCastCheck::check( // Casting an integer to a double. if (MatchedCast->getTypeAsWritten()->isRealFloatingType() && ConversionFuncName.contains("Int64")) { - llvm::StringRef NewFuncName = getDurationInverseForScale(*Scale).first; + const llvm::StringRef NewFuncName = + getDurationInverseForScale(*Scale).first; diag(MatchedCast->getBeginLoc(), "duration should be converted directly to " "a floating-point number rather than " |
