class ReturnStmt

Declaration

class ReturnStmt : public Stmt, private TrailingObjects { /* full declaration omitted */ };

Description

ReturnStmt - This represents a return, optionally of an expression: return; return 4; Note that GCC allows return with no argument in a function declared to return a value, and it allows returning a value in functions declared to return void. We explicitly model this in the AST, which means you can't depend on the return type of the function and the presence of an argument.

Declared at: clang/include/clang/AST/Stmt.h:2792

Inherits from: Stmt, TrailingObjects

Member Variables

private clang::Stmt* RetExpr
The return expression.

Inherited from Stmt:

protected

Method Overview

  • public static clang::ReturnStmt * Create(const clang::ASTContext & Ctx, clang::SourceLocation RL, clang::Expr * E, const clang::VarDecl * NRVOCandidate)
  • public static clang::ReturnStmt * CreateEmpty(const clang::ASTContext & Ctx, bool HasNRVOCandidate)
  • private ReturnStmt(clang::SourceLocation RL, clang::Expr * E, const clang::VarDecl * NRVOCandidate)
  • private ReturnStmt(clang::Stmt::EmptyShell Empty, bool HasNRVOCandidate)
  • public clang::Stmt::const_child_range children() const
  • public clang::Stmt::child_range children()
  • public static bool classof(const clang::Stmt * T)
  • public clang::SourceLocation getBeginLoc() const
  • public clang::SourceLocation getEndLoc() const
  • public const clang::VarDecl * getNRVOCandidate() const
  • public const clang::Expr * getRetValue() const
  • public clang::Expr * getRetValue()
  • public clang::SourceLocation getReturnLoc() const
  • private bool hasNRVOCandidate() const
  • private unsigned int numTrailingObjects(OverloadToken<const clang::VarDecl *>) const
  • public void setNRVOCandidate(const clang::VarDecl * Var)
  • public void setRetValue(clang::Expr * E)
  • public void setReturnLoc(clang::SourceLocation L)

Inherited from Stmt:

Methods

static clang::ReturnStmt* Create(
    const clang::ASTContext& Ctx,
    clang::SourceLocation RL,
    clang::Expr* E,
    const clang::VarDecl* NRVOCandidate)

Description

Create a return statement.

Declared at: clang/include/clang/AST/Stmt.h:2818

Parameters

const clang::ASTContext& Ctx
clang::SourceLocation RL
clang::Expr* E
const clang::VarDecl* NRVOCandidate

static clang::ReturnStmt* CreateEmpty(
    const clang::ASTContext& Ctx,
    bool HasNRVOCandidate)

Description

Create an empty return statement, optionally with storage for an NRVO candidate.

Declared at: clang/include/clang/AST/Stmt.h:2823

Parameters

const clang::ASTContext& Ctx
bool HasNRVOCandidate

ReturnStmt(clang::SourceLocation RL,
           clang::Expr* E,
           const clang::VarDecl* NRVOCandidate)

Description

Build a return statement.

Declared at: clang/include/clang/AST/Stmt.h:2811

Parameters

clang::SourceLocation RL
clang::Expr* E
const clang::VarDecl* NRVOCandidate

ReturnStmt(clang::Stmt::EmptyShell Empty,
           bool HasNRVOCandidate)

Description

Build an empty return statement.

Declared at: clang/include/clang/AST/Stmt.h:2814

Parameters

clang::Stmt::EmptyShell Empty
bool HasNRVOCandidate

clang::Stmt::const_child_range children() const

Declared at: clang/include/clang/AST/Stmt.h:2867

clang::Stmt::child_range children()

Declared at: clang/include/clang/AST/Stmt.h:2861

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

Declared at: clang/include/clang/AST/Stmt.h:2856

Parameters

const clang::Stmt* T

clang::SourceLocation getBeginLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2851

clang::SourceLocation getEndLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2852

const clang::VarDecl* getNRVOCandidate() const

Description

Retrieve the variable that might be used for the named return value optimization. The optimization itself can only be performed if the variable is also marked as an NRVO object.

Declared at: clang/include/clang/AST/Stmt.h:2834

const clang::Expr* getRetValue() const

Declared at: clang/include/clang/AST/Stmt.h:2826

clang::Expr* getRetValue()

Declared at: clang/include/clang/AST/Stmt.h:2825

clang::SourceLocation getReturnLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2848

bool hasNRVOCandidate() const

Description

True if this ReturnStmt has storage for an NRVO candidate.

Declared at: clang/include/clang/AST/Stmt.h:2804

unsigned int numTrailingObjects(
    OverloadToken<const clang::VarDecl*>) const

Declared at: clang/include/clang/AST/Stmt.h:2806

Parameters

OverloadToken<const clang::VarDecl*>

void setNRVOCandidate(const clang::VarDecl* Var)

Description

Set the variable that might be used for the named return value optimization. The return statement must have storage for it, which is the case if and only if hasNRVOCandidate() is true.

Declared at: clang/include/clang/AST/Stmt.h:2842

Parameters

const clang::VarDecl* Var

void setRetValue(clang::Expr* E)

Declared at: clang/include/clang/AST/Stmt.h:2827

Parameters

clang::Expr* E

void setReturnLoc(clang::SourceLocation L)

Declared at: clang/include/clang/AST/Stmt.h:2849

Parameters

clang::SourceLocation L