clang
15.0.0git
|
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, ConditionVarScope = 0x2000000 } |
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 |
void | setIsConditionVarScope (bool InConditionVarScope) |
bool | isConditionVarScope () 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 (const Decl *D) const |
isDeclScope - Return true if this is the scope that the specified decl is declared in. More... | |
DeclContext * | getEntity () const |
Get the entity corresponding to this scope. More... | |
DeclContext * | getLookupEntity () const |
Get the DeclContext in which to continue unqualified lookup after a lookup in this scope. More... | |
void | setEntity (DeclContext *E) |
void | setLookupEntity (DeclContext *E) |
bool | hasUnrecoverableErrorOccurred () const |
Determine whether any unrecoverable errors have occurred within this scope. More... | |
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 | isClassInheritanceScope () const |
Determines whether this scope is between inheritance colon and the real class/struct definition. 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 | isFunctionDeclarationScope () const |
isFunctionDeclarationScope - Return true if this scope is a function prototype scope. More... | |
bool | isAtCatchScope () const |
isAtCatchScope - Return true if this scope is @catch. More... | |
bool | isCatchScope () const |
isCatchScope - Return true if this scope is a C++ catch statement. 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 | isContinueScope () const |
Determine whether this scope is a while/do/for statement, which can have continue statements embedded into it. More... | |
bool | isTryScope () const |
Determine whether this scope is a C++ 'try' block. More... | |
bool | isFnTryCatchScope () const |
Determine whether this scope is a function-level C++ try or catch scope. 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 | isControlScope () const |
Determine whether this scope is a controlling scope in a if/switch/while/for statement. 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 |
Definition at line 220 of file Scope.h.
References Init(), and Parent.
Referenced by CollectARMPACBTIOptions().
|
inline |
Definition at line 306 of file Scope.h.
Referenced by clang::Sema::ActOnReenterTemplateScope().
void Scope::AddFlags | ( | unsigned | Flags | ) |
Sets up the specified scope flags and adjusts the scope state variables accordingly.
Definition at line 107 of file Scope.cpp.
References BreakScope, and ContinueScope.
|
inline |
Definition at line 530 of file Scope.h.
References setNoNRVO().
Referenced by clang::Sema::ActOnReturnStmt(), and mergeNRVOIntoParent().
bool Scope::containedInPrototypeScope | ( | ) | const |
|
inline |
|
inline |
Definition at line 321 of file Scope.h.
References getMSLastManglingParent().
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 269 of file Scope.h.
Referenced by getBreakParent().
|
inline |
Definition at line 272 of file Scope.h.
References getBreakParent().
|
inline |
getContinueParent - Return the closest scope that a continue statement would be affected by.
Definition at line 248 of file Scope.h.
Referenced by getContinueParent().
|
inline |
Definition at line 252 of file Scope.h.
References getContinueParent().
|
inline |
|
inline |
Get the entity corresponding to this scope.
Definition at line 343 of file Scope.h.
References isTemplateParamScope().
Referenced by dumpImpl(), and mergeNRVOIntoParent().
|
inline |
getFlags - Return the flags for this scope.
Definition at line 226 of file Scope.h.
Referenced by clang::Sema::DiagnoseCommaOperator(), dumpImpl(), isAtCatchScope(), isCatchScope(), isClassInheritanceScope(), isClassScope(), isCompoundStmtScope(), isContinueScope(), isControlScope(), isFnTryCatchScope(), isFunctionDeclarationScope(), isFunctionPrototypeScope(), isFunctionScope(), isOpenMPDirectiveScope(), isOpenMPLoopDirectiveScope(), isOpenMPSimdDirectiveScope(), isSEHExceptScope(), isSEHTryScope(), isTemplateParamScope(), and isTryScope().
|
inline |
getFnParent - Return the closest scope that is a function body.
Definition at line 238 of file Scope.h.
Referenced by clang::Sema::ActOnReturnStmt(), and isInCXXInlineMethodScope().
|
inline |
|
inline |
Get the DeclContext in which to continue unqualified lookup after a lookup in this scope.
|
inline |
Definition at line 334 of file Scope.h.
Referenced by dumpImpl().
|
inline |
Definition at line 328 of file Scope.h.
References getMSLastManglingParent().
Referenced by dumpImpl().
|
inline |
Definition at line 241 of file Scope.h.
Referenced by decrementMSManglingNumber(), getMSLastManglingNumber(), and incrementMSManglingNumber().
|
inline |
Return the number of parameters declared in this function prototype, increasing it by one for the next call.
Definition at line 293 of file Scope.h.
References isFunctionPrototypeScope().
|
inline |
getParent - Return the scope that this is nested in.
Definition at line 234 of file Scope.h.
Referenced by clang::Sema::ActOnObjCAtThrowStmt(), clang::Sema::ActOnSEHLeaveStmt(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnStartOfFunctionDef(), dumpImpl(), clang::Parser::ExitScope(), isOpenMPLoopScope(), mergeNRVOIntoParent(), and setFlags().
|
inline |
Definition at line 279 of file Scope.h.
Referenced by clang::Sema::ActOnStartOfLambdaDefinition().
|
inline |
|
inline |
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.
Definition at line 362 of file Scope.h.
References clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred().
|
inline |
Definition at line 314 of file Scope.h.
References getMSLastManglingParent().
Referenced by clang::Sema::incrementMSManglingNumber().
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(), and Scope().
|
inline |
isAtCatchScope - Return true if this scope is @catch.
Definition at line 429 of file Scope.h.
References AtCatchScope, and getFlags().
Referenced by clang::Sema::ActOnObjCAtThrowStmt().
|
inline |
isBlockScope - Return true if this scope correspond to a closure.
Definition at line 231 of file Scope.h.
References BlockScope.
|
inline |
isCatchScope - Return true if this scope is a C++ catch statement.
Definition at line 434 of file Scope.h.
References CatchScope, and getFlags().
|
inline |
Determines whether this scope is between inheritance colon and the real class/struct definition.
Definition at line 374 of file Scope.h.
References ClassInheritanceScope, and getFlags().
|
inline |
isClassScope - Return true if this scope is a class/struct/union scope.
Definition at line 370 of file Scope.h.
References ClassScope, and getFlags().
|
inline |
Determine whether this scope is a compound statement scope.
Definition at line 500 of file Scope.h.
References CompoundStmtScope, and getFlags().
|
inline |
Definition at line 263 of file Scope.h.
References ConditionVarScope.
|
inline |
Determine whether this scope is a while/do/for statement, which can have continue statements embedded into it.
Definition at line 481 of file Scope.h.
References getFlags().
|
inline |
Determine whether this scope is a controlling scope in a if/switch/while/for statement.
Definition at line 506 of file Scope.h.
References ControlScope, and getFlags().
isDeclScope - Return true if this is the scope that the specified decl is declared in.
Definition at line 340 of file Scope.h.
Referenced by mergeNRVOIntoParent().
|
inline |
Determine whether this scope is a function-level C++ try or catch scope.
Definition at line 489 of file Scope.h.
References getFlags().
|
inline |
isFunctionDeclarationScope - Return true if this scope is a function prototype scope.
Definition at line 424 of file Scope.h.
References FunctionDeclarationScope, and getFlags().
Referenced by GetDeclSpecTypeForDeclarator().
|
inline |
isFunctionPrototypeScope - Return true if this scope is a function prototype scope.
Definition at line 418 of file Scope.h.
References FunctionPrototypeScope, and getFlags().
Referenced by getNextFunctionPrototypeIndex().
|
inline |
isFunctionScope() - Return true if this scope is a function scope.
Definition at line 367 of file Scope.h.
References FnScope, and getFlags().
|
inline |
isInCXXInlineMethodScope - Return true if this scope is a C++ inline method scope or is inside one.
Definition at line 380 of file Scope.h.
References getFnParent().
|
inline |
|
inline |
|
inline |
Determines whether this scope is the OpenMP directive scope.
Definition at line 451 of file Scope.h.
References getFlags(), and OpenMPDirectiveScope.
Referenced by isOpenMPLoopDirectiveScope().
|
inline |
Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for', 'omp simd').
Definition at line 457 of file Scope.h.
References getFlags(), isOpenMPDirectiveScope(), and OpenMPLoopDirectiveScope.
|
inline |
Determine whether this scope is a loop having OpenMP loop directive attached.
Definition at line 474 of file Scope.h.
References getParent(), and P.
|
inline |
Determine whether this scope is (or is nested into) some OpenMP loop simd directive scope (for example, 'omp simd', 'omp for simd').
Definition at line 468 of file Scope.h.
References getFlags(), and OpenMPSimdDirectiveScope.
|
inline |
Determine whether this scope is a SEH '__except' block.
Definition at line 497 of file Scope.h.
References getFlags(), and SEHExceptScope.
|
inline |
Determine whether this scope is a SEH '__try' block.
Definition at line 494 of file Scope.h.
References getFlags(), and SEHTryScope.
Referenced by clang::Sema::ActOnSEHLeaveStmt().
|
inline |
|
inline |
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
Definition at line 412 of file Scope.h.
References getFlags(), and TemplateParamScope.
Referenced by getEntity(), and setEntity().
|
inline |
Determine whether this scope is a C++ 'try' block.
Definition at line 486 of file Scope.h.
References getFlags(), and TryScope.
void Scope::mergeNRVOIntoParent | ( | ) |
Definition at line 121 of file Scope.cpp.
References addNRVOCandidate(), getEntity(), getParent(), isDeclScope(), and setNoNRVO().
|
inline |
|
inline |
Definition at line 351 of file Scope.h.
References isTemplateParamScope().
|
inline |
Definition at line 228 of file Scope.h.
References getParent(), and setFlags().
Referenced by setFlags().
|
inline |
Definition at line 258 of file Scope.h.
References ConditionVarScope.
|
inline |
|
inline |
Definition at line 541 of file Scope.h.
Referenced by clang::Sema::ActOnReturnStmt(), addNRVOCandidate(), and mergeNRVOIntoParent().
|
inline |