clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions
clang::UnaryOperator Class Reference

#include <Expr.h>

Inheritance diagram for clang::UnaryOperator:
Inheritance graph
[legend]
Collaboration diagram for clang::UnaryOperator:
Collaboration graph
[legend]

List of all members.

Public Types

typedef UnaryOperatorKind Opcode

Public Member Functions

 UnaryOperator (Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l)
 UnaryOperator (EmptyShell Empty)
 Build an empty unary operator.
Opcode getOpcode () const
void setOpcode (Opcode O)
ExprgetSubExpr () const
void setSubExpr (Expr *E)
SourceLocation getOperatorLoc () const
 getOperatorLoc - Return the location of the operator.
void setOperatorLoc (SourceLocation L)
bool isPrefix () const
bool isPostfix () const
bool isIncrementOp () const
bool isDecrementOp () const
bool isIncrementDecrementOp () const
bool isArithmeticOp () const
SourceRange getSourceRange () const LLVM_READONLY
SourceLocation getExprLoc () const LLVM_READONLY
child_range children ()

Static Public Member Functions

static bool isPostfix (Opcode Op)
 isPostfix - Return true if this is a postfix operation, like x++.
static bool isPrefix (Opcode Op)
 isPrefix - Return true if this is a prefix operation, like --x.
static bool isIncrementOp (Opcode Op)
static bool isDecrementOp (Opcode Op)
static bool isIncrementDecrementOp (Opcode Op)
static bool isArithmeticOp (Opcode Op)
static const char * getOpcodeStr (Opcode Op)
static Opcode getOverloadedOpcode (OverloadedOperatorKind OO, bool Postfix)
 Retrieve the unary opcode that corresponds to the given overloaded operator.
static OverloadedOperatorKind getOverloadedOperator (Opcode Opc)
 Retrieve the overloaded operator kind that corresponds to the given unary opcode.
static bool classof (const Stmt *T)
static bool classof (const UnaryOperator *)

Detailed Description

UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.

Notes on various nodes:

Real/Imag - These return the real/imag part of a complex operand. If applied to a non-complex value, the former returns its operand and the later returns zero in the type of the operand.

Definition at line 1526 of file Expr.h.


Member Typedef Documentation

Definition at line 1528 of file Expr.h.


Constructor & Destructor Documentation

clang::UnaryOperator::UnaryOperator ( Expr input,
Opcode  opc,
QualType  type,
ExprValueKind  VK,
ExprObjectKind  OK,
SourceLocation  l 
) [inline]

Definition at line 1536 of file Expr.h.

clang::UnaryOperator::UnaryOperator ( EmptyShell  Empty) [inline, explicit]

Build an empty unary operator.

Definition at line 1547 of file Expr.h.


Member Function Documentation

child_range clang::UnaryOperator::children ( ) [inline]

Reimplemented from clang::Stmt.

Definition at line 1623 of file Expr.h.

static bool clang::UnaryOperator::classof ( const Stmt T) [inline, static]

Reimplemented from clang::Expr.

Definition at line 1617 of file Expr.h.

References clang::Stmt::getStmtClass().

static bool clang::UnaryOperator::classof ( const UnaryOperator ) [inline, static]

Definition at line 1620 of file Expr.h.

SourceLocation clang::UnaryOperator::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 1615 of file Expr.h.

Opcode clang::UnaryOperator::getOpcode ( ) const [inline]
const char * UnaryOperator::getOpcodeStr ( Opcode  Op) [static]

getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to, e.g. "sizeof" or "[pre]++"

getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to, e.g. "sizeof" or "[pre]++".

Definition at line 740 of file Expr.cpp.

References clang::UO_AddrOf, clang::UO_Deref, clang::UO_Extension, clang::UO_Imag, clang::UO_LNot, clang::UO_Minus, clang::UO_Not, clang::UO_Plus, clang::UO_PostDec, clang::UO_PostInc, clang::UO_PreDec, clang::UO_PreInc, and clang::UO_Real.

SourceLocation clang::UnaryOperator::getOperatorLoc ( ) const [inline]

getOperatorLoc - Return the location of the operator.

Definition at line 1557 of file Expr.h.

Referenced by GetUnreachableLoc(), clang::Expr::isUnusedResultAWarning(), and clang::ASTNodeImporter::VisitUnaryOperator().

UnaryOperatorKind UnaryOperator::getOverloadedOpcode ( OverloadedOperatorKind  OO,
bool  Postfix 
) [static]

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

Definition at line 760 of file Expr.cpp.

References clang::UO_AddrOf, clang::UO_Deref, clang::UO_LNot, clang::UO_Minus, clang::UO_Not, clang::UO_Plus, clang::UO_PostDec, clang::UO_PostInc, clang::UO_PreDec, and clang::UO_PreInc.

Referenced by clang::TreeTransform< Derived >::RebuildCXXOperatorCallExpr().

OverloadedOperatorKind UnaryOperator::getOverloadedOperator ( Opcode  Opc) [static]

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

Definition at line 774 of file Expr.cpp.

References clang::OO_None, clang::UO_AddrOf, clang::UO_Deref, clang::UO_LNot, clang::UO_Minus, clang::UO_Not, clang::UO_Plus, clang::UO_PostDec, clang::UO_PostInc, clang::UO_PreDec, and clang::UO_PreInc.

Referenced by clang::Sema::BuildUnaryOp().

SourceRange clang::UnaryOperator::getSourceRange ( ) const [inline]

SourceLocation tokens are not useful in isolation - they are low level value objects created/interpreted by SourceManager. We assume AST clients will have a pointer to the respective SourceManager.

Reimplemented from clang::Stmt.

Definition at line 1609 of file Expr.h.

References clang::Stmt::getLocEnd(), clang::Stmt::getLocStart(), and isPostfix().

Expr* clang::UnaryOperator::getSubExpr ( ) const [inline]
static bool clang::UnaryOperator::isArithmeticOp ( Opcode  Op) [inline, static]

Definition at line 1592 of file Expr.h.

References clang::UO_LNot, and clang::UO_Plus.

bool clang::UnaryOperator::isArithmeticOp ( ) const [inline]

Definition at line 1595 of file Expr.h.

References getOpcode(), and isArithmeticOp().

Referenced by isArithmeticOp().

static bool clang::UnaryOperator::isDecrementOp ( Opcode  Op) [inline, static]

Definition at line 1580 of file Expr.h.

References clang::UO_PostDec, and clang::UO_PreDec.

bool clang::UnaryOperator::isDecrementOp ( ) const [inline]

Definition at line 1583 of file Expr.h.

References getOpcode().

static bool clang::UnaryOperator::isIncrementDecrementOp ( Opcode  Op) [inline, static]

Definition at line 1587 of file Expr.h.

References clang::UO_PreDec.

Referenced by clang::ento::ExprEngine::VisitIncrementDecrementOperator().

bool clang::UnaryOperator::isIncrementDecrementOp ( ) const [inline]

Definition at line 1588 of file Expr.h.

References getOpcode().

Referenced by clang::Sema::BuildUnaryOp(), and clang::Sema::checkPseudoObjectIncDec().

static bool clang::UnaryOperator::isIncrementOp ( Opcode  Op) [inline, static]
bool clang::UnaryOperator::isIncrementOp ( ) const [inline]

Definition at line 1576 of file Expr.h.

References getOpcode().

static bool clang::UnaryOperator::isPostfix ( Opcode  Op) [inline, static]

isPostfix - Return true if this is a postfix operation, like x++.

Definition at line 1561 of file Expr.h.

References clang::UO_PostDec, and clang::UO_PostInc.

Referenced by clang::ento::ExprEngine::VisitIncrementDecrementOperator().

bool clang::UnaryOperator::isPostfix ( ) const [inline]

Definition at line 1571 of file Expr.h.

References getOpcode(), and isPostfix().

Referenced by getSourceRange(), and isPostfix().

static bool clang::UnaryOperator::isPrefix ( Opcode  Op) [inline, static]

isPrefix - Return true if this is a prefix operation, like --x.

Definition at line 1566 of file Expr.h.

References clang::UO_PreDec, and clang::UO_PreInc.

bool clang::UnaryOperator::isPrefix ( ) const [inline]

Definition at line 1570 of file Expr.h.

References getOpcode(), and isPrefix().

Referenced by isPrefix().

void clang::UnaryOperator::setOpcode ( Opcode  O) [inline]

Definition at line 1551 of file Expr.h.

void clang::UnaryOperator::setOperatorLoc ( SourceLocation  L) [inline]

Definition at line 1558 of file Expr.h.

void clang::UnaryOperator::setSubExpr ( Expr E) [inline]

Definition at line 1554 of file Expr.h.


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