clang API Documentation
A builtin binary operation expression such as "x + y" or "x <= y". More...
#include <Expr.h>
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.
clang::BinaryOperator::BinaryOperator | ( | Expr * | lhs, |
Expr * | rhs, | ||
Opcode | opc, | ||
QualType | ResTy, | ||
ExprValueKind | VK, | ||
ExprObjectKind | OK, | ||
SourceLocation | opLoc, | ||
bool | fpContractable | ||
) | [inline] |
Definition at line 2935 of file Expr.h.
References isCompoundAssignmentOp().
clang::BinaryOperator::BinaryOperator | ( | EmptyShell | Empty | ) | [inline, explicit] |
clang::BinaryOperator::BinaryOperator | ( | Expr * | lhs, |
Expr * | rhs, | ||
Opcode | opc, | ||
QualType | ResTy, | ||
ExprValueKind | VK, | ||
ExprObjectKind | OK, | ||
SourceLocation | opLoc, | ||
bool | fpContractable, | ||
bool | dead2 | ||
) | [inline, protected] |
clang::BinaryOperator::BinaryOperator | ( | StmtClass | SC, |
EmptyShell | Empty | ||
) | [inline, protected] |
child_range clang::BinaryOperator::children | ( | ) | [inline] |
Reimplemented from clang::Stmt.
static bool clang::BinaryOperator::classof | ( | const Stmt * | S | ) | [inline, static] |
Reimplemented from clang::Expr.
Reimplemented in clang::CompoundAssignOperator.
Definition at line 3065 of file Expr.h.
References clang::Stmt::getStmtClass().
SourceLocation clang::BinaryOperator::getExprLoc | ( | ) | const [inline] |
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic expression.
Reimplemented from clang::Expr.
Definition at line 2956 of file Expr.h.
Referenced by LogicalErrorHandler::compareAlwaysTrue(), and LogicalErrorHandler::compareBitwiseEquality().
Expr* clang::BinaryOperator::getLHS | ( | ) | const [inline] |
Definition at line 2963 of file Expr.h.
Referenced by CheckICE(), CheckMemorySizeofForComparison(), ClassifyBinaryOp(), DiagUninitUse(), clang::CodeGen::CodeGenFunction::EmitARCStoreAutoreleasing(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(), clang::CodeGen::CodeGenFunction::EmitCXXMemberPointerCallExpr(), emitPointerArithmetic(), clang::CodeGen::CodeGenFunction::EmitPointerToDataMemberBinaryExpr(), EvalAddr(), GenerateMinimalPathDiagnostic(), getLocStart(), GetUnreachableLoc(), HandleMemberPointerAccess(), ignoreLiteralAdditions(), isConditionForTerminator(), isConfigurationValue(), clang::Expr::isUnusedResultAWarning(), clang::ASTNodeImporter::VisitBinaryOperator(), clang::ento::ExprEngine::VisitBinaryOperator(), clang::consumed::ConsumedStmtVisitor::VisitBinaryOperator(), clang::threadSafety::VarMapBuilder::VisitBinaryOperator(), clang::threadSafety::BuildLockset::VisitBinaryOperator(), clang::ASTNodeImporter::VisitCompoundAssignOperator(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
SourceLocation clang::BinaryOperator::getLocEnd | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
Definition at line 2971 of file Expr.h.
References clang::Stmt::getLocEnd(), and getRHS().
SourceLocation clang::BinaryOperator::getLocStart | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
Definition at line 2968 of file Expr.h.
References getLHS(), and clang::Stmt::getLocStart().
Referenced by DiagUninitUse().
Opcode clang::BinaryOperator::getOpcode | ( | ) | const [inline] |
Definition at line 2960 of file Expr.h.
Referenced by CheckICE(), ClassifyBinaryOp(), DiagUninitUse(), clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(), clang::CodeGen::CodeGenFunction::EmitComplexAssignmentLValue(), clang::CodeGen::CodeGenFunction::EmitComplexCompoundAssignmentLValue(), clang::CodeGen::CodeGenFunction::EmitCompoundAssignmentLValue(), clang::CodeGen::CodeGenFunction::EmitCXXMemberPointerCallExpr(), EmitDiagnosticForBitwiseAndInBitwiseOr(), EmitDiagnosticForLogicalAndInLogicalOr(), clang::CodeGen::CodeGenFunction::EmitPointerToDataMemberBinaryExpr(), clang::CodeGen::CodeGenFunction::EmitScalarCompooundAssignWithComplex(), EvalAddr(), GenerateMinimalPathDiagnostic(), getOpcodeStr(), HandleMemberPointerAccess(), isAdditiveOp(), isAssignmentOp(), isBitwiseOp(), isComparisonOp(), isCompoundAssignmentOp(), clang::ParentMap::isConsumedExpr(), isEqualityOp(), isIdenticalStmt(), isLogicalOp(), clang::arcmt::trans::isPlusOneAssign(), isRelationalOp(), isShiftAssignOp(), isShiftOp(), clang::Expr::isUnusedResultAWarning(), LookThroughTransitiveAssignmentsAndCommaOperators(), print_elem(), clang::ento::ExprEngine::Visit(), clang::ASTNodeImporter::VisitBinaryOperator(), clang::ento::ExprEngine::VisitBinaryOperator(), clang::consumed::ConsumedStmtVisitor::VisitBinaryOperator(), clang::threadSafety::VarMapBuilder::VisitBinaryOperator(), clang::ASTNodeImporter::VisitCompoundAssignOperator(), clang::ento::ExprEngine::VisitLogicalExpr(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
StringRef BinaryOperator::getOpcodeStr | ( | Opcode | Op | ) | [static] |
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to, e.g. "<<=".
Definition at line 1768 of file Expr.cpp.
References clang::BO_Add, clang::BO_AddAssign, clang::BO_And, clang::BO_AndAssign, clang::BO_Assign, clang::BO_Comma, clang::BO_Div, clang::BO_DivAssign, clang::BO_EQ, clang::BO_GE, clang::BO_GT, clang::BO_LAnd, clang::BO_LE, clang::BO_LOr, clang::BO_LT, clang::BO_Mul, clang::BO_MulAssign, clang::BO_NE, clang::BO_Or, clang::BO_OrAssign, clang::BO_PtrMemD, clang::BO_PtrMemI, clang::BO_Rem, clang::BO_RemAssign, clang::BO_Shl, clang::BO_ShlAssign, clang::BO_Shr, clang::BO_ShrAssign, clang::BO_Sub, clang::BO_SubAssign, clang::BO_Xor, and clang::BO_XorAssign.
Referenced by DiagnoseBitwisePrecedence(), DiagUninitUse(), EmitDiagnosticForBitwiseAndInBitwiseOr(), and EmitDiagnosticForLogicalAndInLogicalOr().
StringRef clang::BinaryOperator::getOpcodeStr | ( | ) | const [inline] |
Definition at line 2979 of file Expr.h.
References getOpcode(), and getOpcodeStr().
Referenced by clang::Sema::BuildEmptyCXXFoldExpr(), clang::Sema::CreateOverloadedBinOp(), DiagnoseBinOpPrecedence(), DiagnoseBitwisePrecedence(), DiagnoseConditionalPrecedence(), clang::ento::SymIntExpr::dumpToStream(), clang::ento::IntSymExpr::dumpToStream(), clang::ento::SymSymExpr::dumpToStream(), getOpcodeStr(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
SourceLocation clang::BinaryOperator::getOperatorLoc | ( | ) | const [inline] |
Definition at line 2957 of file Expr.h.
Referenced by CheckMemorySizeofForComparison(), clang::ento::PathDiagnosticLocation::createOperatorLoc(), DiagUninitUse(), EmitDiagnosticForBitwiseAndInBitwiseOr(), EmitDiagnosticForLogicalAndInLogicalOr(), GetUnreachableLoc(), clang::Expr::isUnusedResultAWarning(), clang::ASTNodeImporter::VisitBinaryOperator(), and clang::ASTNodeImporter::VisitCompoundAssignOperator().
static Opcode clang::BinaryOperator::getOpForCompoundAssignment | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3050 of file Expr.h.
References clang::BO_And, clang::BO_AndAssign, clang::BO_Mul, clang::BO_MulAssign, and isCompoundAssignmentOp().
Retrieve the binary opcode that corresponds to the given overloaded operator.
Definition at line 1808 of file Expr.cpp.
References clang::BO_Add, clang::BO_AddAssign, clang::BO_And, clang::BO_AndAssign, clang::BO_Assign, clang::BO_Comma, clang::BO_Div, clang::BO_DivAssign, clang::BO_EQ, clang::BO_GE, clang::BO_GT, clang::BO_LAnd, clang::BO_LE, clang::BO_LOr, clang::BO_LT, clang::BO_Mul, clang::BO_MulAssign, clang::BO_NE, clang::BO_Or, clang::BO_OrAssign, clang::BO_PtrMemI, clang::BO_Rem, clang::BO_RemAssign, clang::BO_Shl, clang::BO_ShlAssign, clang::BO_Shr, clang::BO_ShrAssign, clang::BO_Sub, clang::BO_SubAssign, clang::BO_Xor, and clang::BO_XorAssign.
Referenced by IsArithmeticBinaryExpr(), and clang::TreeTransform< Derived >::RebuildCXXOperatorCallExpr().
OverloadedOperatorKind BinaryOperator::getOverloadedOperator | ( | Opcode | Opc | ) | [static] |
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
Definition at line 1845 of file Expr.cpp.
References clang::OO_None.
Referenced by BuildOverloadedBinOp(), and clang::Sema::CreateOverloadedBinOp().
Expr* clang::BinaryOperator::getRHS | ( | ) | const [inline] |
Definition at line 2965 of file Expr.h.
Referenced by CheckICE(), ClassifyBinaryOp(), DiagnoseBitwisePrecedence(), clang::CodeGen::CodeGenFunction::EmitARCStoreAutoreleasing(), clang::CodeGen::CodeGenFunction::EmitARCStoreStrong(), clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(), clang::CodeGen::CodeGenFunction::EmitCXXMemberPointerCallExpr(), emitPointerArithmetic(), clang::CodeGen::CodeGenFunction::EmitPointerToDataMemberBinaryExpr(), EvalAddr(), getLocEnd(), getRightmostLeaf(), GetUnreachableLoc(), HandleMemberPointerAccess(), ignoreLiteralAdditions(), isConditionForTerminator(), isConfigurationValue(), clang::ParentMap::isConsumedExpr(), clang::arcmt::trans::isPlusOneAssign(), clang::Expr::isUnusedResultAWarning(), LookThroughTransitiveAssignmentsAndCommaOperators(), print_elem(), clang::ento::ExprEngine::Visit(), clang::ASTNodeImporter::VisitBinaryOperator(), clang::ento::ExprEngine::VisitBinaryOperator(), clang::consumed::ConsumedStmtVisitor::VisitBinaryOperator(), clang::threadSafety::VarMapBuilder::VisitBinaryOperator(), clang::ASTNodeImporter::VisitCompoundAssignOperator(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
static bool clang::BinaryOperator::isAdditiveOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 2992 of file Expr.h.
References clang::BO_Add, and clang::BO_Sub.
Referenced by ignoreLiteralAdditions(), and clang::ento::ExprEngine::VisitBinaryOperator().
bool clang::BinaryOperator::isAdditiveOp | ( | ) | const [inline] |
Definition at line 2993 of file Expr.h.
References getOpcode(), and isAdditiveOp().
Referenced by isAdditiveOp().
static bool clang::BinaryOperator::isAssignmentOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3039 of file Expr.h.
References clang::BO_Assign, and clang::BO_OrAssign.
Referenced by ClassifyBinaryOp(), clang::Expr::isUnusedResultAWarning(), clang::ento::ExprEngine::VisitBinaryOperator(), clang::threadSafety::VarMapBuilder::VisitBinaryOperator(), and clang::threadSafety::BuildLockset::VisitBinaryOperator().
bool clang::BinaryOperator::isAssignmentOp | ( | ) | const [inline] |
Definition at line 3042 of file Expr.h.
References getOpcode(), and isAssignmentOp().
Referenced by clang::Sema::BuildBinOp(), isAssignmentOp(), clang::TreeTransform< Derived >::RebuildCXXOperatorCallExpr(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
static bool clang::BinaryOperator::isBitwiseOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 2997 of file Expr.h.
References clang::BO_And, and clang::BO_Or.
Referenced by DiagnoseBitwisePrecedence().
bool clang::BinaryOperator::isBitwiseOp | ( | ) | const [inline] |
Definition at line 2998 of file Expr.h.
References getOpcode(), and isBitwiseOp().
Referenced by DiagnoseBinOpPrecedence(), and isBitwiseOp().
static bool clang::BinaryOperator::isComparisonOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3006 of file Expr.h.
References clang::BO_LT, and clang::BO_NE.
Referenced by CheckMemorySizeofForComparison(), DiagnoseBitwisePrecedence(), and isConfigurationValue().
bool clang::BinaryOperator::isComparisonOp | ( | ) | const [inline] |
Definition at line 3007 of file Expr.h.
References getOpcode(), and isComparisonOp().
Referenced by clang::ento::SimpleConstraintManager::assumeAux(), clang::ento::SimpleConstraintManager::assumeSymRel(), clang::ento::SimpleConstraintManager::canReasonAbout(), DiagnoseBinOpPrecedence(), clang::ento::loc::ConcreteInt::evalBinOp(), evalBinOpFieldRegionFieldRegion(), isComparisonOp(), and clang::ento::ConditionBRVisitor::VisitTrueTest().
static bool clang::BinaryOperator::isCompoundAssignmentOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3044 of file Expr.h.
References clang::BO_Assign, and clang::BO_OrAssign.
Referenced by clang::ento::ExprEngine::VisitBinaryOperator().
bool clang::BinaryOperator::isCompoundAssignmentOp | ( | ) | const [inline] |
Definition at line 3047 of file Expr.h.
References getOpcode().
Referenced by BinaryOperator(), clang::CompoundAssignOperator::CompoundAssignOperator(), and getOpForCompoundAssignment().
static bool clang::BinaryOperator::isEqualityOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3003 of file Expr.h.
References clang::BO_EQ, and clang::BO_NE.
Referenced by CheckMemorySizeofForComparison(), and clang::ento::ExprEngine::Visit().
bool clang::BinaryOperator::isEqualityOp | ( | ) | const [inline] |
Definition at line 3004 of file Expr.h.
References getOpcode(), and isEqualityOp().
Referenced by diagnoseObjCLiteralComparison(), and isEqualityOp().
bool clang::BinaryOperator::isFPContractable | ( | ) | const [inline] |
Definition at line 3081 of file Expr.h.
Referenced by clang::ASTNodeImporter::VisitBinaryOperator(), and clang::ASTNodeImporter::VisitCompoundAssignOperator().
static bool clang::BinaryOperator::isLogicalOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3036 of file Expr.h.
References clang::BO_LAnd, and clang::BO_LOr.
Referenced by CheckMemorySizeofForComparison(), DiagUninitUse(), getEnclosingStmtLocation(), getRightmostLeaf(), isConditionForTerminator(), isConfigurationValue(), ResolveCondition(), and clang::ento::ExprEngine::Visit().
bool clang::BinaryOperator::isLogicalOp | ( | ) | const [inline] |
Definition at line 3037 of file Expr.h.
References getOpcode(), and isLogicalOp().
Referenced by isLogicalOp().
bool clang::BinaryOperator::isMultiplicativeOp | ( | ) | const [inline] |
Definition at line 2991 of file Expr.h.
References clang::BO_Mul, and clang::BO_Rem.
bool clang::BinaryOperator::isPtrMemOp | ( | ) | const [inline] |
predicates to categorize the respective opcodes.
Definition at line 2990 of file Expr.h.
References clang::BO_PtrMemD, and clang::BO_PtrMemI.
static bool clang::BinaryOperator::isRelationalOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3000 of file Expr.h.
References clang::BO_GE, and clang::BO_LT.
Referenced by clang::ento::ExprEngine::Visit().
bool clang::BinaryOperator::isRelationalOp | ( | ) | const [inline] |
Definition at line 3001 of file Expr.h.
References getOpcode(), and isRelationalOp().
Referenced by isRelationalOp().
static bool clang::BinaryOperator::isShiftAssignOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3058 of file Expr.h.
References clang::BO_ShlAssign, and clang::BO_ShrAssign.
bool clang::BinaryOperator::isShiftAssignOp | ( | ) | const [inline] |
Definition at line 3061 of file Expr.h.
References getOpcode().
static bool clang::BinaryOperator::isShiftOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 2994 of file Expr.h.
References clang::BO_Shl, and clang::BO_Shr.
bool clang::BinaryOperator::isShiftOp | ( | ) | const [inline] |
Definition at line 2995 of file Expr.h.
References getOpcode(), and isShiftOp().
Referenced by isShiftOp().
static Opcode clang::BinaryOperator::negateComparisonOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3009 of file Expr.h.
References clang::BO_EQ, clang::BO_GE, clang::BO_GT, clang::BO_LE, clang::BO_LT, and clang::BO_NE.
Referenced by clang::ento::SimpleConstraintManager::assumeAux().
static Opcode clang::BinaryOperator::reverseComparisonOp | ( | Opcode | Opc | ) | [inline, static] |
Definition at line 3022 of file Expr.h.
References clang::BO_EQ, clang::BO_GE, clang::BO_GT, clang::BO_LE, clang::BO_LT, and clang::BO_NE.
Referenced by clang::ento::SimpleConstraintManager::assumeAux().
void clang::BinaryOperator::setFPContractable | ( | bool | FPC | ) | [inline] |
void clang::BinaryOperator::setLHS | ( | Expr * | E | ) | [inline] |
void clang::BinaryOperator::setOpcode | ( | Opcode | O | ) | [inline] |
void clang::BinaryOperator::setOperatorLoc | ( | SourceLocation | L | ) | [inline] |
void clang::BinaryOperator::setRHS | ( | Expr * | E | ) | [inline] |