LLVM 22.0.0git
llvm::BinaryOperation Class Reference

Class representing a single binary operation in the AST of an expression. More...

#include "FileCheck/FileCheckImpl.h"

Inheritance diagram for llvm::BinaryOperation:
[legend]

Public Member Functions

 BinaryOperation (StringRef ExpressionStr, binop_eval_t EvalBinop, std::unique_ptr< ExpressionAST > LeftOp, std::unique_ptr< ExpressionAST > RightOp)
Expected< APInteval () const override
 Evaluates the value of the binary operation represented by this AST, using EvalBinop on the result of recursively evaluating the operands.
Expected< ExpressionFormatgetImplicitFormat (const SourceMgr &SM) const override
Public Member Functions inherited from llvm::ExpressionAST
 ExpressionAST (StringRef ExpressionStr)
virtual ~ExpressionAST ()=default
StringRef getExpressionStr () const

Detailed Description

Class representing a single binary operation in the AST of an expression.

Definition at line 308 of file FileCheckImpl.h.

Constructor & Destructor Documentation

◆ BinaryOperation()

llvm::BinaryOperation::BinaryOperation ( StringRef ExpressionStr,
binop_eval_t EvalBinop,
std::unique_ptr< ExpressionAST > LeftOp,
std::unique_ptr< ExpressionAST > RightOp )
inline

Definition at line 320 of file FileCheckImpl.h.

References llvm::ExpressionAST::ExpressionAST().

Member Function Documentation

◆ eval()

Expected< APInt > BinaryOperation::eval ( ) const
overridevirtual

Evaluates the value of the binary operation represented by this AST, using EvalBinop on the result of recursively evaluating the operands.

Returns
the expression value or an error if an undefined numeric variable is used in one of the operands.

Implements llvm::ExpressionAST.

Definition at line 202 of file FileCheck.cpp.

References llvm::APInt::getBitWidth(), llvm::joinErrors(), nextAPIntBitWidth(), llvm::APInt::sext(), llvm::Error::success(), and llvm::Expected< T >::takeError().

◆ getImplicitFormat()

Expected< ExpressionFormat > BinaryOperation::getImplicitFormat ( const SourceMgr & SM) const
overridevirtual
Returns
the implicit format of this AST, if any, a diagnostic against SM if the implicit formats of the AST's components conflict, or no format if the AST has no implicit format (e.g. AST is made of a single literal).

Reimplemented from llvm::ExpressionAST.

Definition at line 241 of file FileCheck.cpp.

References llvm::ErrorDiagnostic::get(), llvm::ExpressionAST::getExpressionStr(), llvm::joinErrors(), llvm::ExpressionFormat::NoFormat, llvm::Error::success(), and llvm::Expected< T >::takeError().


The documentation for this class was generated from the following files: