class UnaryOperator

Declaration

class UnaryOperator : public Expr, private TrailingObjects { /* full declaration omitted */ };

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.

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

Inherits from: Expr, TrailingObjects

Member Variables

private clang::Stmt* Val

Inherited from Stmt:

protected

Method Overview

Inherited from Expr:

Inherited from ValueStmt:

Inherited from Stmt:

Methods

static clang::UnaryOperator* Create(
    const clang::ASTContext& C,
    clang::Expr* input,
    clang::UnaryOperator::Opcode opc,
    clang::QualType type,
    clang::ExprValueKind VK,
    clang::ExprObjectKind OK,
    clang::SourceLocation l,
    bool CanOverflow,
    clang::FPOptionsOverride FPFeatures)

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

Parameters

const clang::ASTContext& C
clang::Expr* input
clang::UnaryOperator::Opcode opc
clang::QualType type
clang::ExprValueKind VK
clang::ExprObjectKind OK
clang::SourceLocation l
bool CanOverflow
clang::FPOptionsOverride FPFeatures

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

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

Parameters

const clang::ASTContext& C
bool hasFPFeatures

UnaryOperator(const clang::ASTContext& Ctx,
              clang::Expr* input,
              clang::UnaryOperator::Opcode opc,
              clang::QualType type,
              clang::ExprValueKind VK,
              clang::ExprObjectKind OK,
              clang::SourceLocation l,
              bool CanOverflow,
              clang::FPOptionsOverride FPFeatures)

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

Parameters

const clang::ASTContext& Ctx
clang::Expr* input
clang::UnaryOperator::Opcode opc
clang::QualType type
clang::ExprValueKind VK
clang::ExprObjectKind OK
clang::SourceLocation l
bool CanOverflow
clang::FPOptionsOverride FPFeatures

UnaryOperator(bool HasFPFeatures,
              clang::Stmt::EmptyShell Empty)

Description

Build an empty unary operator.

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

Parameters

bool HasFPFeatures
clang::Stmt::EmptyShell Empty

bool canOverflow() const

Description

Returns true if the unary operator can cause an overflow. For instance, signed int i = INT_MAX; i++; signed char c = CHAR_MAX; c++; Due to integer promotions, c++ is promoted to an int before the postfix increment, and the result is an int that cannot overflow. However, i++ can overflow.

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

clang::Stmt::const_child_range children() const

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

clang::Stmt::child_range children()

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

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

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

Parameters

const clang::Stmt* T

clang::SourceLocation getBeginLoc() const

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

clang::SourceLocation getEndLoc() const

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

clang::SourceLocation getExprLoc() const

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

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

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

Parameters

const clang::LangOptions& LO

clang::FPOptionsOverride getFPOptionsOverride()
    const

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

clang::UnaryOperator::Opcode getOpcode() const

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

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

Description

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

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

Parameters

clang::UnaryOperator::Opcode Op

clang::SourceLocation getOperatorLoc() const

Description

getOperatorLoc - Return the location of the operator.

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

static clang::UnaryOperator::Opcode
getOverloadedOpcode(
    clang::OverloadedOperatorKind OO,
    bool Postfix)

Description

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

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

Parameters

clang::OverloadedOperatorKind OO
bool Postfix

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

Description

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

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

Parameters

clang::UnaryOperator::Opcode Opc

clang::FPOptionsOverride getStoredFPFeatures()
    const

Description

Get FPFeatures from trailing storage.

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

clang::Expr* getSubExpr() const

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

clang::FPOptionsOverride& getTrailingFPFeatures()

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

const clang::FPOptionsOverride&
getTrailingFPFeatures() const

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

bool hasStoredFPFeatures() const

Description

Is FPFeatures in Trailing Storage?

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

static bool isArithmeticOp(
    clang::UnaryOperator::Opcode Op)

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

Parameters

clang::UnaryOperator::Opcode Op

bool isArithmeticOp() const

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

static bool isDecrementOp(
    clang::UnaryOperator::Opcode Op)

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

Parameters

clang::UnaryOperator::Opcode Op

bool isDecrementOp() const

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

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

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

Parameters

const clang::LangOptions& LO

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

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

Parameters

const clang::LangOptions& LO

static bool isIncrementDecrementOp(
    clang::UnaryOperator::Opcode Op)

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

Parameters

clang::UnaryOperator::Opcode Op

bool isIncrementDecrementOp() const

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

bool isIncrementOp() const

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

static bool isIncrementOp(
    clang::UnaryOperator::Opcode Op)

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

Parameters

clang::UnaryOperator::Opcode Op

static bool isPostfix(
    clang::UnaryOperator::Opcode Op)

Description

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

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

Parameters

clang::UnaryOperator::Opcode Op

bool isPostfix() const

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

static bool isPrefix(
    clang::UnaryOperator::Opcode Op)

Description

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

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

Parameters

clang::UnaryOperator::Opcode Op

bool isPrefix() const

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

size_t numTrailingObjects(
    OverloadToken<clang::FPOptionsOverride>) const

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

Parameters

OverloadToken<clang::FPOptionsOverride>

void setCanOverflow(bool C)

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

Parameters

bool C

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

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

Parameters

clang::UnaryOperator::Opcode Opc

void setOperatorLoc(clang::SourceLocation L)

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

Parameters

clang::SourceLocation L

void setStoredFPFeatures(
    clang::FPOptionsOverride F)

Description

Set FPFeatures in trailing storage, used only by Serialization

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

Parameters

clang::FPOptionsOverride F

void setSubExpr(clang::Expr* E)

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

Parameters

clang::Expr* E