LLVM 20.0.0git
Public Member Functions | List of all members
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:
Inheritance graph
[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
 
virtual Expected< APInteval () const =0
 Evaluates and.
 
virtual Expected< ExpressionFormatgetImplicitFormat (const SourceMgr &SM) const
 

Detailed Description

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

Definition at line 302 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 314 of file FileCheckImpl.h.

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 203 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 242 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: