clang
9.0.0
|
Scope - A scope is a transient data structure that is used while parsing the program. More...
#include "clang/Sema/Scope.h"
Public Types | |
enum | ScopeFlags { FnScope = 0x01, BreakScope = 0x02, ContinueScope = 0x04, DeclScope = 0x08, ControlScope = 0x10, ClassScope = 0x20, BlockScope = 0x40, TemplateParamScope = 0x80, FunctionPrototypeScope = 0x100, FunctionDeclarationScope = 0x200, AtCatchScope = 0x400, ObjCMethodScope = 0x800, SwitchScope = 0x1000, TryScope = 0x2000, FnTryCatchScope = 0x4000, OpenMPDirectiveScope = 0x8000, OpenMPLoopDirectiveScope = 0x10000, OpenMPSimdDirectiveScope = 0x20000, EnumScope = 0x40000, SEHTryScope = 0x80000, SEHExceptScope = 0x100000, SEHFilterScope = 0x200000, CompoundStmtScope = 0x400000, ClassInheritanceScope = 0x800000, CatchScope = 0x1000000 } |
ScopeFlags - These are bitfields that are or'd together when creating a scope, which defines the sorts of things the scope contains. More... | |
using | decl_range = llvm::iterator_range< DeclSetTy::iterator > |
using | using_directives_range = llvm::iterator_range< UsingDirectivesTy::iterator > |
Public Member Functions | |
Scope (Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag) | |
unsigned | getFlags () const |
getFlags - Return the flags for this scope. More... | |
void | setFlags (unsigned F) |
bool | isBlockScope () const |
isBlockScope - Return true if this scope correspond to a closure. More... | |
const Scope * | getParent () const |
getParent - Return the scope that this is nested in. More... | |
Scope * | getParent () |
const Scope * | getFnParent () const |
getFnParent - Return the closest scope that is a function body. More... | |
Scope * | getFnParent () |
const Scope * | getMSLastManglingParent () const |
Scope * | getMSLastManglingParent () |
Scope * | getContinueParent () |
getContinueParent - Return the closest scope that a continue statement would be affected by. More... | |
const Scope * | getContinueParent () const |
Scope * | getBreakParent () |
getBreakParent - Return the closest scope that a break statement would be affected by. More... | |
const Scope * | getBreakParent () const |
Scope * | getBlockParent () |
const Scope * | getBlockParent () const |
Scope * | getTemplateParamParent () |
const Scope * | getTemplateParamParent () const |
unsigned | getDepth () const |
Returns the depth of this scope. The translation-unit has scope depth 0. More... | |
unsigned | getFunctionPrototypeDepth () const |
Returns the number of function prototype scopes in this scope chain. More... | |
unsigned | getNextFunctionPrototypeIndex () |
Return the number of parameters declared in this function prototype, increasing it by one for the next call. More... | |
decl_range | decls () const |
bool | decl_empty () const |
void | AddDecl (Decl *D) |
void | RemoveDecl (Decl *D) |
void | incrementMSManglingNumber () |
void | decrementMSManglingNumber () |
unsigned | getMSLastManglingNumber () const |
unsigned | getMSCurManglingNumber () const |
bool | isDeclScope (Decl *D) |
isDeclScope - Return true if this is the scope that the specified decl is declared in. More... | |
DeclContext * | getEntity () const |
void | setEntity (DeclContext *E) |
bool | hasErrorOccurred () const |
bool | hasUnrecoverableErrorOccurred () const |
bool | isFunctionScope () const |
isFunctionScope() - Return true if this scope is a function scope. More... | |
bool | isClassScope () const |
isClassScope - Return true if this scope is a class/struct/union scope. More... | |
bool | isInCXXInlineMethodScope () const |
isInCXXInlineMethodScope - Return true if this scope is a C++ inline method scope or is inside one. More... | |
bool | isInObjcMethodScope () const |
isInObjcMethodScope - Return true if this scope is, or is contained in, an Objective-C method body. More... | |
bool | isInObjcMethodOuterScope () const |
isInObjcMethodOuterScope - Return true if this scope is an Objective-C method outer most body. More... | |
bool | isTemplateParamScope () const |
isTemplateParamScope - Return true if this scope is a C++ template parameter scope. More... | |
bool | isFunctionPrototypeScope () const |
isFunctionPrototypeScope - Return true if this scope is a function prototype scope. More... | |
bool | isAtCatchScope () const |
isAtCatchScope - Return true if this scope is @catch. More... | |
bool | isSwitchScope () const |
isSwitchScope - Return true if this scope is a switch scope. More... | |
bool | isOpenMPDirectiveScope () const |
Determines whether this scope is the OpenMP directive scope. More... | |
bool | isOpenMPLoopDirectiveScope () const |
Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for', 'omp simd'). More... | |
bool | isOpenMPSimdDirectiveScope () const |
Determine whether this scope is (or is nested into) some OpenMP loop simd directive scope (for example, 'omp simd', 'omp for simd'). More... | |
bool | isOpenMPLoopScope () const |
Determine whether this scope is a loop having OpenMP loop directive attached. More... | |
bool | isTryScope () const |
Determine whether this scope is a C++ 'try' block. More... | |
bool | isSEHTryScope () const |
Determine whether this scope is a SEH '__try' block. More... | |
bool | isSEHExceptScope () const |
Determine whether this scope is a SEH '__except' block. More... | |
bool | isCompoundStmtScope () const |
Determine whether this scope is a compound statement scope. More... | |
bool | Contains (const Scope &rhs) const |
Returns if rhs has a higher scope depth than this. More... | |
bool | containedInPrototypeScope () const |
containedInPrototypeScope - Return true if this or a parent scope is a FunctionPrototypeScope. More... | |
void | PushUsingDirective (UsingDirectiveDecl *UDir) |
using_directives_range | using_directives () |
void | addNRVOCandidate (VarDecl *VD) |
void | setNoNRVO () |
void | mergeNRVOIntoParent () |
void | Init (Scope *parent, unsigned flags) |
Init - This is used by the parser to implement scope caching. More... | |
void | AddFlags (unsigned Flags) |
Sets up the specified scope flags and adjusts the scope state variables accordingly. More... | |
void | dumpImpl (raw_ostream &OS) const |
void | dump () const |
Scope - A scope is a transient data structure that is used while parsing the program.
It assists with resolving identifiers to the appropriate declaration.
using clang::Scope::decl_range = llvm::iterator_range<DeclSetTy::iterator> |
using clang::Scope::using_directives_range = llvm::iterator_range<UsingDirectivesTy::iterator> |
ScopeFlags - These are bitfields that are or'd together when creating a scope, which defines the sorts of things the scope contains.
|
inline |
|
inline |
Definition at line 289 of file Scope.h.
Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::ActOnReenterCXXMethodParameter(), and clang::Sema::ActOnReenterTemplateScope().
void Scope::AddFlags | ( | unsigned | Flags | ) |
|
inline |
Definition at line 472 of file Scope.h.
Referenced by clang::Sema::ActOnReturnStmt(), and mergeNRVOIntoParent().
bool Scope::containedInPrototypeScope | ( | ) | const |
|
inline |
Definition at line 283 of file Scope.h.
Referenced by LookupVisibleDecls().
LLVM_DUMP_METHOD void Scope::dump | ( | ) | const |
Definition at line 136 of file Scope.cpp.
References dumpImpl().
void Scope::dumpImpl | ( | raw_ostream & | OS | ) | const |
Definition at line 138 of file Scope.cpp.
References AtCatchScope, BlockScope, BreakScope, CatchScope, ClassInheritanceScope, ClassScope, CompoundStmtScope, ContinueScope, ControlScope, DeclScope, EnumScope, FnScope, FnTryCatchScope, FunctionDeclarationScope, FunctionPrototypeScope, getEntity(), getFlags(), getMSCurManglingNumber(), getMSLastManglingNumber(), getParent(), ObjCMethodScope, OpenMPDirectiveScope, OpenMPLoopDirectiveScope, OpenMPSimdDirectiveScope, Parent, SEHExceptScope, SEHFilterScope, SEHTryScope, SwitchScope, TemplateParamScope, and TryScope.
Referenced by dump().
|
inline |
getBreakParent - Return the closest scope that a break statement would be affected by.
Definition at line 252 of file Scope.h.
Referenced by AddKeywordsToConsumer().
|
inline |
getContinueParent - Return the closest scope that a continue statement would be affected by.
Definition at line 242 of file Scope.h.
Referenced by AddKeywordsToConsumer().
|
inline |
|
inline |
|
inline |
Definition at line 327 of file Scope.h.
Referenced by clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteNamespaceDecl(), clang::Sema::CodeCompleteObjCMethodDecl(), clang::Sema::CodeCompleteQualifiedId(), dumpImpl(), findOuterContext(), isNamespaceOrTranslationUnitScope(), isNamespaceScope(), LookupVisibleDecls(), mergeNRVOIntoParent(), and clang::Sema::PushUsingDirective().
|
inline |
getFlags - Return the flags for this scope.
Definition at line 220 of file Scope.h.
Referenced by clang::Sema::ActOnUsingDirective(), clang::Sema::CheckTemplateDeclScope(), dumpImpl(), IsInFnTryBlockHandler(), and SetupFixedPointError().
|
inline |
getFnParent - Return the closest scope that is a function body.
Definition at line 232 of file Scope.h.
Referenced by clang::Sema::ActOnReturnStmt(), clang::Sema::CodeCompleteInPreprocessorConditionalExclusion(), and IsInFnTryBlockHandler().
|
inline |
|
inline |
Definition at line 317 of file Scope.h.
Referenced by dumpImpl().
|
inline |
Definition at line 311 of file Scope.h.
Referenced by dumpImpl().
|
inline |
|
inline |
|
inline |
getParent - Return the scope that this is nested in.
Definition at line 228 of file Scope.h.
Referenced by clang::Sema::ActOnObjCAtThrowStmt(), clang::Sema::ActOnSEHLeaveStmt(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::ActOnUsingDirective(), AddRecordMembersCompletionResults(), buildDeclareReductionRef(), buildUserDefinedMapperRef(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteNamespaceDecl(), diagnoseDynamicExceptionSpecification(), dumpImpl(), clang::Parser::ExitScope(), findOuterContext(), IsInFnTryBlockHandler(), LookupVisibleDecls(), mergeNRVOIntoParent(), and clang::Parser::ParseTopLevelDecl().
|
inline |
Definition at line 262 of file Scope.h.
Referenced by clang::Sema::ActOnStartOfLambdaDefinition(), and clang::Sema::ActOnTypenameType().
|
inline |
|
inline |
Definition at line 330 of file Scope.h.
References clang::DiagnosticErrorTrap::hasErrorOccurred().
|
inline |
Definition at line 332 of file Scope.h.
References clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred().
|
inline |
Definition at line 297 of file Scope.h.
Referenced by clang::Sema::incrementMSManglingNumber().
void Scope::Init | ( | Scope * | parent, |
unsigned | flags | ||
) |
Init - This is used by the parser to implement scope caching.
Definition at line 87 of file Scope.cpp.
References clang::DiagnosticErrorTrap::reset().
Referenced by clang::Parser::EnterScope().
|
inline |
isAtCatchScope - Return true if this scope is @catch.
Definition at line 389 of file Scope.h.
Referenced by clang::Sema::ActOnObjCAtThrowStmt().
|
inline |
|
inline |
isClassScope - Return true if this scope is a class/struct/union scope.
Definition at line 340 of file Scope.h.
Referenced by AddKeywordsToConsumer().
|
inline |
isDeclScope - Return true if this is the scope that the specified decl is declared in.
Definition at line 323 of file Scope.h.
Referenced by buildDeclareReductionRef(), buildUserDefinedMapperRef(), and mergeNRVOIntoParent().
|
inline |
|
inline |
isFunctionScope() - Return true if this scope is a function scope.
|
inline |
|
inline |
|
inline |
isInObjcMethodScope - Return true if this scope is, or is contained in, an Objective-C method body.
Note that this method is not constant time.
Definition at line 356 of file Scope.h.
Referenced by CheckArrayDesignatorSyntax(), and takeDeclAttributes().
|
inline |
|
inline |
Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for', 'omp simd').
Definition at line 414 of file Scope.h.
Referenced by isOpenMPLoopScope().
|
inline |
Determine whether this scope is a loop having OpenMP loop directive attached.
Definition at line 431 of file Scope.h.
References isOpenMPLoopDirectiveScope(), and P.
|
inline |
|
inline |
|
inline |
Determine whether this scope is a SEH '__try' block.
Definition at line 440 of file Scope.h.
Referenced by clang::Sema::ActOnSEHLeaveStmt().
|
inline |
|
inline |
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
Definition at line 378 of file Scope.h.
Referenced by clang::Sema::ActOnUsingDirective(), diagnoseDynamicExceptionSpecification(), and findOuterContext().
|
inline |
void Scope::mergeNRVOIntoParent | ( | ) |
Definition at line 121 of file Scope.cpp.
References addNRVOCandidate(), getEntity(), getParent(), isDeclScope(), and setNoNRVO().
|
inline |
Definition at line 460 of file Scope.h.
Referenced by clang::Sema::PushUsingDirective().
|
inline |
Definition at line 293 of file Scope.h.
Referenced by clang::Sema::HideUsingShadowDecl().
|
inline |
|
inline |
|
inline |
Definition at line 483 of file Scope.h.
References dump().
Referenced by clang::Sema::ActOnReturnStmt(), and mergeNRVOIntoParent().
|
inline |