28 const auto *Binop = Result.Nodes.getNodeAs<BinaryOperator>(
"binop");
31 Result.Nodes.getNodeAs<FunctionDecl>(
"function_decl")->getName());
41 std::string LhsReplacement =
43 std::string RhsReplacement =
46 diag(Binop->getBeginLoc(),
"perform comparison in the duration domain")
47 << FixItHint::CreateReplacement(Binop->getSourceRange(),
48 (llvm::Twine(LhsReplacement) +
" " +
49 Binop->getOpcodeStr() +
" " +
std::optional< DurationScale > getScaleForDurationInverse(llvm::StringRef Name)
Given the name of an inverse Duration function (e.g., ToDoubleSeconds), return its DurationScale,...
std::string 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 ...