clang-tools 19.0.0git
Classes | Namespaces | Functions
DurationRewriter.cpp File Reference
#include <cmath>
#include <optional>
#include "DurationRewriter.h"
#include "clang/Tooling/FixIt.h"
#include "llvm/ADT/IndexedMap.h"

Go to the source code of this file.

Classes

struct  clang::tidy::abseil::DurationScale2IndexFunctor
 

Namespaces

namespace  clang
 ===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
 
namespace  clang::tidy
 
namespace  clang::tidy::abseil
 

Functions

static std::optional< llvm::APSInt > clang::tidy::abseil::truncateIfIntegral (const FloatingLiteral &FloatLiteral)
 Returns an integer if the fractional part of a FloatingLiteral is 0.
 
const std::pair< llvm::StringRef, llvm::StringRef > & clang::tidy::abseil::getDurationInverseForScale (DurationScale Scale)
 Given a Scale return the fully qualified inverse functions for it.
 
static std::optional< std::string > clang::tidy::abseil::rewriteInverseDurationCall (const MatchFinder::MatchResult &Result, DurationScale Scale, const Expr &Node)
 If Node is a call to the inverse of Scale, return that inverse's argument, otherwise std::nullopt.
 
static std::optional< std::string > clang::tidy::abseil::rewriteInverseTimeCall (const MatchFinder::MatchResult &Result, DurationScale Scale, const Expr &Node)
 If Node is a call to the inverse of Scale, return that inverse's argument, otherwise std::nullopt.
 
llvm::StringRef clang::tidy::abseil::getDurationFactoryForScale (DurationScale Scale)
 Returns the factory function name for a given Scale.
 
llvm::StringRef clang::tidy::abseil::getTimeFactoryForScale (DurationScale Scale)
 Given a 'Scale', return the appropriate factory function call for constructing a Time for that scale.
 
llvm::StringRef clang::tidy::abseil::getTimeInverseForScale (DurationScale Scale)
 Returns the Time factory function name for a given Scale.
 
bool clang::tidy::abseil::isLiteralZero (const MatchFinder::MatchResult &Result, const Expr &Node)
 Returns true if Node is a value which evaluates to a literal 0.
 
std::optional< std::string > clang::tidy::abseil::stripFloatCast (const ast_matchers::MatchFinder::MatchResult &Result, const Expr &Node)
 Possibly strip a floating point cast expression.
 
std::optional< std::string > clang::tidy::abseil::stripFloatLiteralFraction (const MatchFinder::MatchResult &Result, const Expr &Node)
 
std::string clang::tidy::abseil::simplifyDurationFactoryArg (const MatchFinder::MatchResult &Result, const Expr &Node)
 
std::optional< DurationScale > clang::tidy::abseil::getScaleForDurationInverse (llvm::StringRef Name)
 Given the name of an inverse Duration function (e.g., ToDoubleSeconds), return its DurationScale, or std::nullopt if a match is not found.
 
std::optional< DurationScale > clang::tidy::abseil::getScaleForTimeInverse (llvm::StringRef Name)
 Given the name of an inverse Time function (e.g., ToUnixSeconds), return its DurationScale, or std::nullopt if a match is not found.
 
std::string clang::tidy::abseil::rewriteExprFromNumberToDuration (const ast_matchers::MatchFinder::MatchResult &Result, DurationScale Scale, const Expr *Node)
 Assuming Node has type double or int representing a time interval of Scale, return the expression to make it a suitable Duration.
 
std::string clang::tidy::abseil::rewriteExprFromNumberToTime (const ast_matchers::MatchFinder::MatchResult &Result, DurationScale Scale, const Expr *Node)
 Assuming Node has a type int representing a time instant of Scale since The Epoch, return the expression to make it a suitable Time.
 
bool clang::tidy::abseil::isInMacro (const MatchFinder::MatchResult &Result, const Expr *E)