class Scope

Declaration

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

Description

Scope - A scope is a transient data structure that is used while parsing the program. It assists with resolving identifiers to the appropriate declaration.

Declared at: clang/include/clang/Sema/Scope.h:40

Member Variables

private clang::Scope* AnyParent
The parent scope for this scope. This is null for the translation-unit scope.
private unsigned int Flags
Flags - This contains a set of ScopeFlags, which indicates how the scope interrelates with other control flow statements.
private unsigned short Depth
Depth - This is the depth of this scope. The translation-unit scope has depth 0.
private unsigned short MSLastManglingNumber
Declarations with static linkage are mangled with the number of scopes seen as a component.
private unsigned short MSCurManglingNumber
private unsigned short PrototypeDepth
PrototypeDepth - This is the number of function prototype scopes enclosing this scope, including this scope.
private unsigned short PrototypeIndex
PrototypeIndex - This is the number of parameters currently declared in this scope.
private clang::Scope* FnParent
FnParent - If this scope has a parent scope that is a function body, this pointer is non-null and points to it. This is used for label processing.
private clang::Scope* MSLastManglingParent
private clang::Scope* BreakParent
BreakParent/ContinueParent - This is a direct link to the innermost BreakScope/ContinueScope which contains the contents of this scope for control flow purposes (and might be this scope itself), or null if there is no such scope.
private clang::Scope* ContinueParent
BreakParent/ContinueParent - This is a direct link to the innermost BreakScope/ContinueScope which contains the contents of this scope for control flow purposes (and might be this scope itself), or null if there is no such scope.
private clang::Scope* BlockParent
BlockParent - This is a direct link to the immediately containing BlockScope if this scope is not one, or null if there is none.
private clang::Scope* TemplateParamParent
TemplateParamParent - This is a direct link to the immediately containing template parameter scope. In the case of nested templates, template parameter scopes can have other template parameter scopes as parents.
private clang::Scope::DeclSetTy DeclsInScope
private clang::DeclContext* Entity
The DeclContext with which this scope is associated. For example, the entity of a class scope is the class itself, the entity of a function scope is a function, etc.
private clang::Scope::UsingDirectivesTy UsingDirectives
private clang::DiagnosticErrorTrap ErrorTrap
Used to determine if errors occurred in this scope.
private Optional<clang::VarDecl*> NRVO
A single NRVO candidate variable in this scope. There are three possible values: 1) pointer to VarDecl that denotes NRVO candidate itself. 2) nullptr value means that NRVO is not allowed in this scope (e.g. return a function parameter). 3) None value means that there is no NRVO candidate in this scope (i.e. there are no return statements in this scope).
private llvm::SmallPtrSet<VarDecl*, 8> ReturnSlots
Represents return slots for NRVO candidates in the current scope. If a variable is present in this set, it means that a return slot is available for this variable in the current scope.

Method Overview

Methods

void AddDecl(clang::Decl* D)

Declared at: clang/include/clang/Sema/Scope.h:316

Parameters

clang::Decl* D

void AddFlags(unsigned int Flags)

Description

Sets up the specified scope flags and adjusts the scope state variables accordingly.

Declared at: clang/include/clang/Sema/Scope.h:553

Parameters

unsigned int Flags

bool Contains(const clang::Scope& rhs) const

Description

Returns if rhs has a higher scope depth than this. The caller is responsible for calling this only if one of the two scopes is an ancestor of the other.

Declared at: clang/include/clang/Sema/Scope.h:526

Parameters

const clang::Scope& rhs

void Init(clang::Scope* parent,
          unsigned int flags)

Description

Init - This is used by the parser to implement scope caching.

Declared at: clang/include/clang/Sema/Scope.h:549

Parameters

clang::Scope* parent
unsigned int flags

void PushUsingDirective(
    clang::UsingDirectiveDecl* UDir)

Declared at: clang/include/clang/Sema/Scope.h:532

Parameters

clang::UsingDirectiveDecl* UDir

void RemoveDecl(clang::Decl* D)

Declared at: clang/include/clang/Sema/Scope.h:324

Parameters

clang::Decl* D

Scope(clang::Scope* Parent,
      unsigned int ScopeFlags,
      clang::DiagnosticsEngine& Diag)

Declared at: clang/include/clang/Sema/Scope.h:230

Parameters

clang::Scope* Parent
unsigned int ScopeFlags
clang::DiagnosticsEngine& Diag

void applyNRVO()

Declared at: clang/include/clang/Sema/Scope.h:546

bool containedInPrototypeScope() const

Description

containedInPrototypeScope - Return true if this or a parent scope is a FunctionPrototypeScope.

Declared at: clang/include/clang/Sema/Scope.h:530

bool decl_empty() const

Declared at: clang/include/clang/Sema/Scope.h:314

clang::Scope::decl_range decls() const

Declared at: clang/include/clang/Sema/Scope.h:310

void decrementMSManglingNumber()

Declared at: clang/include/clang/Sema/Scope.h:335

void dump() const

Declared at: clang/include/clang/Sema/Scope.h:556

void dumpImpl(llvm::raw_ostream& OS) const

Declared at: clang/include/clang/Sema/Scope.h:555

Parameters

llvm::raw_ostream& OS

clang::Scope* getBlockParent()

Declared at: clang/include/clang/Sema/Scope.h:286

const clang::Scope* getBlockParent() const

Declared at: clang/include/clang/Sema/Scope.h:287

clang::Scope* getBreakParent()

Description

getBreakParent - Return the closest scope that a break statement would be affected by.

Declared at: clang/include/clang/Sema/Scope.h:279

const clang::Scope* getBreakParent() const

Declared at: clang/include/clang/Sema/Scope.h:282

const clang::Scope* getContinueParent() const

Declared at: clang/include/clang/Sema/Scope.h:262

clang::Scope* getContinueParent()

Description

getContinueParent - Return the closest scope that a continue statement would be affected by.

Declared at: clang/include/clang/Sema/Scope.h:258

unsigned int getDepth() const

Description

Returns the depth of this scope. The translation-unit has scope depth 0.

Declared at: clang/include/clang/Sema/Scope.h:293

clang::DeclContext* getEntity() const

Description

Get the entity corresponding to this scope.

Declared at: clang/include/clang/Sema/Scope.h:357

unsigned int getFlags() const

Description

getFlags - Return the flags for this scope.

Declared at: clang/include/clang/Sema/Scope.h:236

clang::Scope* getFnParent()

Declared at: clang/include/clang/Sema/Scope.h:249

const clang::Scope* getFnParent() const

Description

getFnParent - Return the closest scope that is a function body.

Declared at: clang/include/clang/Sema/Scope.h:248

unsigned int getFunctionPrototypeDepth() const

Description

Returns the number of function prototype scopes in this scope chain.

Declared at: clang/include/clang/Sema/Scope.h:297

clang::DeclContext* getLookupEntity() const

Description

Get the DeclContext in which to continue unqualified lookup after a lookup in this scope.

Declared at: clang/include/clang/Sema/Scope.h:363

unsigned int getMSCurManglingNumber() const

Declared at: clang/include/clang/Sema/Scope.h:348

unsigned int getMSLastManglingNumber() const

Declared at: clang/include/clang/Sema/Scope.h:342

clang::Scope* getMSLastManglingParent()

Declared at: clang/include/clang/Sema/Scope.h:254

const clang::Scope* getMSLastManglingParent()
    const

Declared at: clang/include/clang/Sema/Scope.h:251

unsigned int getNextFunctionPrototypeIndex()

Description

Return the number of parameters declared in this function prototype, increasing it by one for the next call.

Declared at: clang/include/clang/Sema/Scope.h:303

const clang::Scope* getParent() const

Description

getParent - Return the scope that this is nested in.

Declared at: clang/include/clang/Sema/Scope.h:244

clang::Scope* getParent()

Declared at: clang/include/clang/Sema/Scope.h:245

const clang::Scope* getTemplateParamParent() const

Declared at: clang/include/clang/Sema/Scope.h:290

clang::Scope* getTemplateParamParent()

Declared at: clang/include/clang/Sema/Scope.h:289

bool hasUnrecoverableErrorOccurred() const

Description

Determine whether any unrecoverable errors have occurred within this scope. Note that this may return false even if the scope contains invalid declarations or statements, if the errors for those invalid constructs were suppressed because some prior invalid construct was referenced.

Declared at: clang/include/clang/Sema/Scope.h:376

void incrementMSManglingNumber()

Declared at: clang/include/clang/Sema/Scope.h:328

bool isAtCatchScope() const

Description

isAtCatchScope - Return true if this scope is @ catch.

Declared at: clang/include/clang/Sema/Scope.h:443

bool isBlockScope() const

Description

isBlockScope - Return true if this scope correspond to a closure.

Declared at: clang/include/clang/Sema/Scope.h:241

bool isCatchScope() const

Description

isCatchScope - Return true if this scope is a C++ catch statement.

Declared at: clang/include/clang/Sema/Scope.h:448

bool isClassInheritanceScope() const

Description

Determines whether this scope is between inheritance colon and the real class/struct definition.

Declared at: clang/include/clang/Sema/Scope.h:388

bool isClassScope() const

Description

isClassScope - Return true if this scope is a class/struct/union scope.

Declared at: clang/include/clang/Sema/Scope.h:384

bool isCompoundStmtScope() const

Description

Determine whether this scope is a compound statement scope.

Declared at: clang/include/clang/Sema/Scope.h:514

bool isConditionVarScope() const

Declared at: clang/include/clang/Sema/Scope.h:273

bool isContinueScope() const

Description

Determine whether this scope is a while/do/for statement, which can have continue statements embedded into it.

Declared at: clang/include/clang/Sema/Scope.h:495

bool isControlScope() const

Description

Determine whether this scope is a controlling scope in a if/switch/while/for statement.

Declared at: clang/include/clang/Sema/Scope.h:520

bool isDeclScope(const clang::Decl* D) const

Description

isDeclScope - Return true if this is the scope that the specified decl is declared in.

Declared at: clang/include/clang/Sema/Scope.h:354

Parameters

const clang::Decl* D

bool isFnTryCatchScope() const

Description

Determine whether this scope is a function-level C++ try or catch scope.

Declared at: clang/include/clang/Sema/Scope.h:503

bool isFunctionDeclarationScope() const

Description

isFunctionDeclarationScope - Return true if this scope is a function prototype scope.

Declared at: clang/include/clang/Sema/Scope.h:438

bool isFunctionPrototypeScope() const

Description

isFunctionPrototypeScope - Return true if this scope is a function prototype scope.

Declared at: clang/include/clang/Sema/Scope.h:432

bool isFunctionScope() const

Description

isFunctionScope() - Return true if this scope is a function scope.

Declared at: clang/include/clang/Sema/Scope.h:381

bool isInCXXInlineMethodScope() const

Description

isInCXXInlineMethodScope - Return true if this scope is a C++ inline method scope or is inside one.

Declared at: clang/include/clang/Sema/Scope.h:394

bool isInObjcMethodOuterScope() const

Description

isInObjcMethodOuterScope - Return true if this scope is an Objective-C method outer most body.

Declared at: clang/include/clang/Sema/Scope.h:415

bool isInObjcMethodScope() const

Description

isInObjcMethodScope - Return true if this scope is, or is contained in, an Objective-C method body. Note that this method is not constant time.

Declared at: clang/include/clang/Sema/Scope.h:404

bool isOpenMPDirectiveScope() const

Description

Determines whether this scope is the OpenMP directive scope

Declared at: clang/include/clang/Sema/Scope.h:465

bool isOpenMPLoopDirectiveScope() const

Description

Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for', 'omp simd').

Declared at: clang/include/clang/Sema/Scope.h:471

bool isOpenMPLoopScope() const

Description

Determine whether this scope is a loop having OpenMP loop directive attached.

Declared at: clang/include/clang/Sema/Scope.h:488

bool isOpenMPSimdDirectiveScope() const

Description

Determine whether this scope is (or is nested into) some OpenMP loop simd directive scope (for example, 'omp simd', 'omp for simd').

Declared at: clang/include/clang/Sema/Scope.h:482

bool isSEHExceptScope() const

Description

Determine whether this scope is a SEH '__except' block.

Declared at: clang/include/clang/Sema/Scope.h:511

bool isSEHTryScope() const

Description

Determine whether this scope is a SEH '__try' block.

Declared at: clang/include/clang/Sema/Scope.h:508

bool isSwitchScope() const

Description

isSwitchScope - Return true if this scope is a switch scope.

Declared at: clang/include/clang/Sema/Scope.h:451

bool isTemplateParamScope() const

Description

isTemplateParamScope - Return true if this scope is a C++ template parameter scope.

Declared at: clang/include/clang/Sema/Scope.h:426

bool isTryScope() const

Description

Determine whether this scope is a C++ 'try' block.

Declared at: clang/include/clang/Sema/Scope.h:500

void setEntity(clang::DeclContext* E)

Declared at: clang/include/clang/Sema/Scope.h:365

Parameters

clang::DeclContext* E

void setFlags(unsigned int F)

Declared at: clang/include/clang/Sema/Scope.h:238

Parameters

unsigned int F

void setFlags(clang::Scope* Parent,
              unsigned int F)

Declared at: clang/include/clang/Sema/Scope.h:227

Parameters

clang::Scope* Parent
unsigned int F

void setIsConditionVarScope(
    bool InConditionVarScope)

Declared at: clang/include/clang/Sema/Scope.h:268

Parameters

bool InConditionVarScope

void setLookupEntity(clang::DeclContext* E)

Declared at: clang/include/clang/Sema/Scope.h:370

Parameters

clang::DeclContext* E

void updateNRVOCandidate(clang::VarDecl* VD)

Declared at: clang/include/clang/Sema/Scope.h:544

Parameters

clang::VarDecl* VD

clang::Scope::using_directives_range
using_directives()

Declared at: clang/include/clang/Sema/Scope.h:539