class Stmt

Declaration

class Stmt { /* full declaration omitted */ };

Description

Stmt - This represents one statement.

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

Member Variables

protected anonymous struct / union
private static bool StatisticsEnabled
Whether statistic collection is enabled.

Method Overview

  • public static void EnableStatistics()
  • public const clang::Stmt * IgnoreContainers(bool IgnoreCaptured = false) const
  • public clang::Stmt * IgnoreContainers(bool IgnoreCaptured = false)
  • public static void PrintStats()
  • public void ProcessODRHash(llvm::FoldingSetNodeID & ID, clang::ODRHash & Hash) const
  • public void Profile(llvm::FoldingSetNodeID & ID, const clang::ASTContext & Context, bool Canonical) const
  • public Stmt()
  • protected Stmt(clang::Stmt::StmtClass SC, clang::Stmt::EmptyShell)
  • public Stmt(clang::Stmt::StmtClass SC)
  • public Stmt(clang::Stmt &&)
  • public Stmt(const clang::Stmt &)
  • public static void addStmtClass(const clang::Stmt::StmtClass s)
  • public clang::Stmt::const_child_iterator child_begin() const
  • public clang::Stmt::child_iterator child_begin()
  • public clang::Stmt::const_child_iterator child_end() const
  • public clang::Stmt::child_iterator child_end()
  • public clang::Stmt::const_child_range children() const
  • public clang::Stmt::child_range children()
  • public static std::tuple<bool, const Attr *, const Attr *> determineLikelihoodConflict(const clang::Stmt * Then, const clang::Stmt * Else)
  • public void dump() const
  • public void dump(llvm::raw_ostream & OS, const clang::ASTContext & Context) const
  • public void dumpColor() const
  • public void dumpPretty(const clang::ASTContext & Context) const
  • public clang::SourceLocation getBeginLoc() const
  • public clang::SourceLocation getEndLoc() const
  • public int64_t getID(const clang::ASTContext & Context) const
  • public static clang::Stmt::Likelihood getLikelihood(const clang::Stmt * Then, const clang::Stmt * Else)
  • public static clang::Stmt::Likelihood getLikelihood(const clang::Stmt * S)
  • public static clang::Stmt::Likelihood getLikelihood(ArrayRef<const clang::Attr *> Attrs)
  • public static const clang::Attr * getLikelihoodAttr(const clang::Stmt * S)
  • public clang::SourceRange getSourceRange() const
  • public clang::Stmt::StmtClass getStmtClass() const
  • public const char * getStmtClassName() const
  • public void printJson(llvm::raw_ostream & Out, clang::PrinterHelper * Helper, const clang::PrintingPolicy & Policy, bool AddQuotes) const
  • public void printPretty(llvm::raw_ostream & OS, clang::PrinterHelper * Helper, const clang::PrintingPolicy & Policy, unsigned int Indentation = 0, llvm::StringRef NewlineSymbol = "\n", const clang::ASTContext * Context = nullptr) const
  • public void printPrettyControlled(llvm::raw_ostream & OS, clang::PrinterHelper * Helper, const clang::PrintingPolicy & Policy, unsigned int Indentation = 0, llvm::StringRef NewlineSymbol = "\n", const clang::ASTContext * Context = nullptr) const
  • public const clang::Stmt * stripLabelLikeStatements() const
  • public clang::Stmt * stripLabelLikeStatements()
  • public void viewAST() const

Methods

static void EnableStatistics()

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

const clang::Stmt* IgnoreContainers(
    bool IgnoreCaptured = false) const

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

Parameters

bool IgnoreCaptured = false

clang::Stmt* IgnoreContainers(
    bool IgnoreCaptured = false)

Description

Skip no-op (attributed, compound) container stmts and skip captured stmt at the top, if \a IgnoreCaptured is true.

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

Parameters

bool IgnoreCaptured = false

static void PrintStats()

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

void ProcessODRHash(llvm::FoldingSetNodeID& ID,
                    clang::ODRHash& Hash) const

Description

Calculate a unique representation for a statement that is stable across compiler invocations.

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

Parameters

llvm::FoldingSetNodeID& ID
profile information will be stored in ID.
clang::ODRHash& Hash
an ODRHash object which will be called where pointers would have been used in the Profile function.

void Profile(llvm::FoldingSetNodeID& ID,
             const clang::ASTContext& Context,
             bool Canonical) const

Description

Produce a unique representation of the given statement.

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

Parameters

llvm::FoldingSetNodeID& ID
once the profiling operation is complete, will contain the unique representation of the given statement.
const clang::ASTContext& Context
the AST context in which the statement resides
bool Canonical
whether the profile should be based on the canonical representation of this statement (e.g., where non-type template parameters are identified by index/level rather than their declaration pointers) or the exact representation of the statement as written in the source.

Stmt()

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

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

Description

Construct an empty statement.

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

Parameters

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

Stmt(clang::Stmt::StmtClass SC)

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

Parameters

clang::Stmt::StmtClass SC

Stmt(clang::Stmt&&)

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

Parameters

clang::Stmt&&

Stmt(const clang::Stmt&)

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

Parameters

const clang::Stmt&

static void addStmtClass(
    const clang::Stmt::StmtClass s)

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

Parameters

const clang::Stmt::StmtClass s

clang::Stmt::const_child_iterator child_begin()
    const

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

clang::Stmt::child_iterator child_begin()

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

clang::Stmt::const_child_iterator child_end()
    const

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

clang::Stmt::child_iterator child_end()

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

clang::Stmt::const_child_range children() const

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

clang::Stmt::child_range children()

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

static std::tuple<bool, const Attr*, const Attr*>
determineLikelihoodConflict(
    const clang::Stmt* Then,
    const clang::Stmt* Else)

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

Parameters

const clang::Stmt* Then
const clang::Stmt* Else

Returns

whether the likelihood of the branches of an if statement are conflicting. When the first element is \c true there's a conflict and the Attr's are the conflicting attributes of the Then and Else Stmt.

void dump() const

Description

Dumps the specified AST fragment and all subtrees to\c llvm::errs().

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

void dump(llvm::raw_ostream& OS,
          const clang::ASTContext& Context) const

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

Parameters

llvm::raw_ostream& OS
const clang::ASTContext& Context

void dumpColor() const

Description

dumpColor - same as dump(), but forces color highlighting.

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

void dumpPretty(
    const clang::ASTContext& Context) const

Description

dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source language syntax.

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

Parameters

const clang::ASTContext& Context

clang::SourceLocation getBeginLoc() const

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

clang::SourceLocation getEndLoc() const

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

int64_t getID(
    const clang::ASTContext& Context) const

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

Parameters

const clang::ASTContext& Context

Returns

Unique reproducible object identifier

static clang::Stmt::Likelihood getLikelihood(
    const clang::Stmt* Then,
    const clang::Stmt* Else)

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

Parameters

const clang::Stmt* Then
const clang::Stmt* Else

Returns

the likelihood of the 'then' branch of an 'if' statement. The 'else' branch is required to determine whether both branches specify the same likelihood, which affects the result.

static clang::Stmt::Likelihood getLikelihood(
    const clang::Stmt* S)

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

Parameters

const clang::Stmt* S

Returns

the likelihood of a statement.

static clang::Stmt::Likelihood getLikelihood(
    ArrayRef<const clang::Attr*> Attrs)

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

Parameters

ArrayRef<const clang::Attr*> Attrs

Returns

the likelihood of a set of attributes.

static const clang::Attr* getLikelihoodAttr(
    const clang::Stmt* S)

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

Parameters

const clang::Stmt* S

Returns

the likelihood attribute of a statement.

clang::SourceRange getSourceRange() const

Description

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.

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

clang::Stmt::StmtClass getStmtClass() const

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

const char* getStmtClassName() const

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

void printJson(
    llvm::raw_ostream& Out,
    clang::PrinterHelper* Helper,
    const clang::PrintingPolicy& Policy,
    bool AddQuotes) const

Description

Pretty-prints in JSON format.

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

Parameters

llvm::raw_ostream& Out
clang::PrinterHelper* Helper
const clang::PrintingPolicy& Policy
bool AddQuotes

void printPretty(
    llvm::raw_ostream& OS,
    clang::PrinterHelper* Helper,
    const clang::PrintingPolicy& Policy,
    unsigned int Indentation = 0,
    llvm::StringRef NewlineSymbol = "\n",
    const clang::ASTContext* Context =
        nullptr) const

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

Parameters

llvm::raw_ostream& OS
clang::PrinterHelper* Helper
const clang::PrintingPolicy& Policy
unsigned int Indentation = 0
llvm::StringRef NewlineSymbol = "\n"
const clang::ASTContext* Context = nullptr

void printPrettyControlled(
    llvm::raw_ostream& OS,
    clang::PrinterHelper* Helper,
    const clang::PrintingPolicy& Policy,
    unsigned int Indentation = 0,
    llvm::StringRef NewlineSymbol = "\n",
    const clang::ASTContext* Context =
        nullptr) const

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

Parameters

llvm::raw_ostream& OS
clang::PrinterHelper* Helper
const clang::PrintingPolicy& Policy
unsigned int Indentation = 0
llvm::StringRef NewlineSymbol = "\n"
const clang::ASTContext* Context = nullptr

const clang::Stmt* stripLabelLikeStatements()
    const

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

clang::Stmt* stripLabelLikeStatements()

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

void viewAST() const

Description

viewAST - Visualize an AST rooted at this Stmt* using GraphViz. Only works on systems with GraphViz (Mac OS X) or dot+gv installed.

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