class BinaryOperator

Declaration

class BinaryOperator : public Expr { /* full declaration omitted */ };

Description

A builtin binary operation expression such as "x + y" or "x <= y". This expression node kind describes a builtin binary operation, such as "x + y" for integer values "x" and "y". The operands will already have been converted to appropriate types (e.g., by performing promotions or conversions). In C++, where operators may be overloaded, a different kind of expression node (CXXOperatorCallExpr) is used to express the invocation of an overloaded operator with operator syntax. Within a C++ template, whether BinaryOperator or CXXOperatorCallExpr is used to store an expression "x + y" depends on the subexpressions for x and y. If neither x or y is type-dependent, and the "+" operator resolves to a built-in operation, BinaryOperator will be used to express the computation (x and y may still be value-dependent). If either x or y is type-dependent, or if the "+" resolves to an overloaded operator, CXXOperatorCallExpr will be used to express the computation.

Declared at: clang/include/clang/AST/Expr.h:3807

Inherits from: Expr

Member Variables

private clang::Stmt* [2] SubExprs

Inherited from Stmt:

protected

Method Overview

Inherited from Expr:

Inherited from ValueStmt:

Inherited from Stmt:

Methods

BinaryOperator(
    const clang::ASTContext& Ctx,
    clang::Expr* lhs,
    clang::Expr* rhs,
    clang::BinaryOperator::Opcode opc,
    clang::QualType ResTy,
    clang::ExprValueKind VK,
    clang::ExprObjectKind OK,
    clang::SourceLocation opLoc,
    clang::FPOptionsOverride FPFeatures)

Description

Build a binary operator, assuming that appropriate storage has been allocated for the trailing objects when needed.

Declared at: clang/include/clang/AST/Expr.h:3831

Parameters

const clang::ASTContext& Ctx
clang::Expr* lhs
clang::Expr* rhs
clang::BinaryOperator::Opcode opc
clang::QualType ResTy
clang::ExprValueKind VK
clang::ExprObjectKind OK
clang::SourceLocation opLoc
clang::FPOptionsOverride FPFeatures

BinaryOperator(clang::Stmt::EmptyShell Empty)

Description

Construct an empty binary operator.

Declared at: clang/include/clang/AST/Expr.h:3836

Parameters

clang::Stmt::EmptyShell Empty

BinaryOperator(clang::Stmt::StmtClass SC,
               clang::Stmt::EmptyShell Empty)

Description

Construct an empty BinaryOperator, SC is CompoundAssignOperator.

Declared at: clang/include/clang/AST/Expr.h:4037

Parameters

clang::Stmt::StmtClass SC
clang::Stmt::EmptyShell Empty

BinaryOperator(
    const clang::ASTContext& Ctx,
    clang::Expr* lhs,
    clang::Expr* rhs,
    clang::BinaryOperator::Opcode opc,
    clang::QualType ResTy,
    clang::ExprValueKind VK,
    clang::ExprObjectKind OK,
    clang::SourceLocation opLoc,
    clang::FPOptionsOverride FPFeatures,
    bool dead2)

Declared at: clang/include/clang/AST/Expr.h:4031

Parameters

const clang::ASTContext& Ctx
clang::Expr* lhs
clang::Expr* rhs
clang::BinaryOperator::Opcode opc
clang::QualType ResTy
clang::ExprValueKind VK
clang::ExprObjectKind OK
clang::SourceLocation opLoc
clang::FPOptionsOverride FPFeatures
bool dead2

static clang::BinaryOperator* Create(
    const clang::ASTContext& C,
    clang::Expr* lhs,
    clang::Expr* rhs,
    clang::BinaryOperator::Opcode opc,
    clang::QualType ResTy,
    clang::ExprValueKind VK,
    clang::ExprObjectKind OK,
    clang::SourceLocation opLoc,
    clang::FPOptionsOverride FPFeatures)

Declared at: clang/include/clang/AST/Expr.h:3843

Parameters

const clang::ASTContext& C
clang::Expr* lhs
clang::Expr* rhs
clang::BinaryOperator::Opcode opc
clang::QualType ResTy
clang::ExprValueKind VK
clang::ExprObjectKind OK
clang::SourceLocation opLoc
clang::FPOptionsOverride FPFeatures

static clang::BinaryOperator* CreateEmpty(
    const clang::ASTContext& C,
    bool hasFPFeatures)

Declared at: clang/include/clang/AST/Expr.h:3841

Parameters

const clang::ASTContext& C
bool hasFPFeatures

clang::Stmt::child_range children()

Declared at: clang/include/clang/AST/Expr.h:3980

clang::Stmt::const_child_range children() const

Declared at: clang/include/clang/AST/Expr.h:3983

static bool classof(const clang::Stmt* S)

Declared at: clang/include/clang/AST/Expr.h:3974

Parameters

const clang::Stmt* S

clang::SourceLocation getBeginLoc() const

Declared at: clang/include/clang/AST/Expr.h:3861

clang::SourceLocation getEndLoc() const

Declared at: clang/include/clang/AST/Expr.h:3864

clang::SourceLocation getExprLoc() const

Declared at: clang/include/clang/AST/Expr.h:3847

clang::FPOptionsOverride getFPFeatures(
    const clang::LangOptions& LO) const

Declared at: clang/include/clang/AST/Expr.h:4012

Parameters

const clang::LangOptions& LO

clang::FPOptions getFPFeaturesInEffect(
    const clang::LangOptions& LO) const

Declared at: clang/include/clang/AST/Expr.h:4005

Parameters

const clang::LangOptions& LO

clang::Expr* getLHS() const

Declared at: clang/include/clang/AST/Expr.h:3856

static clang::BinaryOperator::Opcode
getOpForCompoundAssignment(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3953

Parameters

clang::BinaryOperator::Opcode Opc

clang::BinaryOperator::Opcode getOpcode() const

Declared at: clang/include/clang/AST/Expr.h:3851

static llvm::StringRef getOpcodeStr(
    clang::BinaryOperator::Opcode Op)

Description

getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to, e.g. "<<=".

Declared at: clang/include/clang/AST/Expr.h:3870

Parameters

clang::BinaryOperator::Opcode Op

llvm::StringRef getOpcodeStr() const

Declared at: clang/include/clang/AST/Expr.h:3872

clang::SourceLocation getOperatorLoc() const

Declared at: clang/include/clang/AST/Expr.h:3848

static clang::BinaryOperator::Opcode
getOverloadedOpcode(
    clang::OverloadedOperatorKind OO)

Description

Retrieve the binary opcode that corresponds to the given overloaded operator.

Declared at: clang/include/clang/AST/Expr.h:3876

Parameters

clang::OverloadedOperatorKind OO

static clang::OverloadedOperatorKind
getOverloadedOperator(
    clang::BinaryOperator::Opcode Opc)

Description

Retrieve the overloaded operator kind that corresponds to the given binary opcode.

Declared at: clang/include/clang/AST/Expr.h:3880

Parameters

clang::BinaryOperator::Opcode Opc

clang::Expr* getRHS() const

Declared at: clang/include/clang/AST/Expr.h:3858

clang::FPOptionsOverride getStoredFPFeatures()
    const

Description

Get FPFeatures from trailing storage

Declared at: clang/include/clang/AST/Expr.h:3993

clang::FPOptionsOverride* getTrailingFPFeatures()

Description

Return a pointer to the trailing FPOptions

Declared at: clang/include/clang/AST/Expr.h:3818

const clang::FPOptionsOverride*
getTrailingFPFeatures() const

Declared at: clang/include/clang/AST/Expr.h:3823

bool hasStoredFPFeatures() const

Declared at: clang/include/clang/AST/Expr.h:3990

static bool isAdditiveOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3892

Parameters

clang::BinaryOperator::Opcode Opc

bool isAdditiveOp() const

Declared at: clang/include/clang/AST/Expr.h:3893

bool isAssignmentOp() const

Declared at: clang/include/clang/AST/Expr.h:3945

static bool isAssignmentOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3942

Parameters

clang::BinaryOperator::Opcode Opc

bool isBitwiseOp() const

Declared at: clang/include/clang/AST/Expr.h:3898

static bool isBitwiseOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3897

Parameters

clang::BinaryOperator::Opcode Opc

static bool isCommaOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3909

Parameters

clang::BinaryOperator::Opcode Opc

bool isCommaOp() const

Declared at: clang/include/clang/AST/Expr.h:3910

static bool isComparisonOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3906

Parameters

clang::BinaryOperator::Opcode Opc

bool isComparisonOp() const

Declared at: clang/include/clang/AST/Expr.h:3907

bool isCompoundAssignmentOp() const

Declared at: clang/include/clang/AST/Expr.h:3950

static bool isCompoundAssignmentOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3947

Parameters

clang::BinaryOperator::Opcode Opc

static bool isEqualityOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3903

Parameters

clang::BinaryOperator::Opcode Opc

bool isEqualityOp() const

Declared at: clang/include/clang/AST/Expr.h:3904

bool isFEnvAccessOn(
    const clang::LangOptions& LO) const

Declared at: clang/include/clang/AST/Expr.h:4026

Parameters

const clang::LangOptions& LO

bool isFPContractableWithinStatement(
    const clang::LangOptions& LO) const

Declared at: clang/include/clang/AST/Expr.h:4020

Parameters

const clang::LangOptions& LO

static bool isLogicalOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3939

Parameters

clang::BinaryOperator::Opcode Opc

bool isLogicalOp() const

Declared at: clang/include/clang/AST/Expr.h:3940

bool isMultiplicativeOp() const

Declared at: clang/include/clang/AST/Expr.h:3891

static bool isMultiplicativeOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3888

Parameters

clang::BinaryOperator::Opcode Opc

static bool isNullPointerArithmeticExtension(
    clang::ASTContext& Ctx,
    clang::BinaryOperator::Opcode Opc,
    clang::Expr* LHS,
    clang::Expr* RHS)

Declared at: clang/include/clang/AST/Expr.h:3971

Parameters

clang::ASTContext& Ctx
clang::BinaryOperator::Opcode Opc
clang::Expr* LHS
clang::Expr* RHS

bool isPtrMemOp() const

Declared at: clang/include/clang/AST/Expr.h:3886

static bool isPtrMemOp(
    clang::BinaryOperator::Opcode Opc)

Description

predicates to categorize the respective opcodes.

Declared at: clang/include/clang/AST/Expr.h:3883

Parameters

clang::BinaryOperator::Opcode Opc

bool isRelationalOp() const

Declared at: clang/include/clang/AST/Expr.h:3901

static bool isRelationalOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3900

Parameters

clang::BinaryOperator::Opcode Opc

bool isShiftAssignOp() const

Declared at: clang/include/clang/AST/Expr.h:3964

static bool isShiftAssignOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3961

Parameters

clang::BinaryOperator::Opcode Opc

bool isShiftOp() const

Declared at: clang/include/clang/AST/Expr.h:3895

static bool isShiftOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3894

Parameters

clang::BinaryOperator::Opcode Opc

static clang::BinaryOperator::Opcode
negateComparisonOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3912

Parameters

clang::BinaryOperator::Opcode Opc

size_t offsetOfTrailingStorage() const

Declared at: clang/include/clang/AST/Expr.h:3815

static clang::BinaryOperator::Opcode
reverseComparisonOp(
    clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3925

Parameters

clang::BinaryOperator::Opcode Opc

void setHasStoredFPFeatures(bool B)

Description

Set and fetch the bit that shows whether FPFeatures needs to be allocated in Trailing Storage

Declared at: clang/include/clang/AST/Expr.h:3989

Parameters

bool B

void setLHS(clang::Expr* E)

Declared at: clang/include/clang/AST/Expr.h:3857

Parameters

clang::Expr* E

void setOpcode(clang::BinaryOperator::Opcode Opc)

Declared at: clang/include/clang/AST/Expr.h:3854

Parameters

clang::BinaryOperator::Opcode Opc

void setOperatorLoc(clang::SourceLocation L)

Declared at: clang/include/clang/AST/Expr.h:3849

Parameters

clang::SourceLocation L

void setRHS(clang::Expr* E)

Declared at: clang/include/clang/AST/Expr.h:3859

Parameters

clang::Expr* E

void setStoredFPFeatures(
    clang::FPOptionsOverride F)

Description

Set FPFeatures in trailing storage, used only by Serialization

Declared at: clang/include/clang/AST/Expr.h:3998

Parameters

clang::FPOptionsOverride F

static unsigned int sizeOfTrailingObjects(
    bool HasFPFeatures)

Description

Return the size in bytes needed for the trailing objects. Used to allocate the right amount of storage.

Declared at: clang/include/clang/AST/Expr.h:4043

Parameters

bool HasFPFeatures