clang
3.9.0
|
Scope - A scope is a transient data structure that is used while parsing the program. More...
#include <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 } |
ScopeFlags - These are bitfields that are or'd together when creating a scope, which defines the sorts of things the scope contains. More... | |
typedef llvm::iterator_range < DeclSetTy::iterator > | decl_range |
typedef llvm::iterator_range < UsingDirectivesTy::iterator > | using_directives_range |
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 | 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 | 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.
typedef llvm::iterator_range<DeclSetTy::iterator> clang::Scope::decl_range |
typedef llvm::iterator_range<UsingDirectivesTy::iterator> clang::Scope::using_directives_range |
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 275 of file Scope.h.
Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::ActOnIvar(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnNonTypeTemplateParameter(), clang::Sema::ActOnObjCExceptionDecl(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnReenterCXXMethodParameter(), clang::Sema::ActOnReenterFunctionContext(), clang::Sema::ActOnReenterTemplateScope(), clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::ActOnTypeParameter(), and clang::Sema::PushOnScopeChains().
void Scope::AddFlags | ( | unsigned | Flags | ) |
|
inline |
Definition at line 454 of file Scope.h.
References setNoNRVO().
Referenced by clang::Sema::ActOnReturnStmt(), and mergeNRVOIntoParent().
bool Scope::containedInPrototypeScope | ( | ) | const |
containedInPrototypeScope - Return true if this or a parent scope is a FunctionPrototypeScope.
Definition at line 98 of file Scope.cpp.
References getParent(), isFunctionPrototypeScope(), and S.
Referenced by clang::Sema::ActOnTag().
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.
Definition at line 436 of file Scope.h.
Referenced by CheckJumpOutOfSEHFinally().
|
inline |
Definition at line 273 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope().
|
inline |
Definition at line 270 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope(), clang::Sema::CodeCompleteLambdaIntroducer(), and LookupVisibleDecls().
|
inline |
Definition at line 290 of file Scope.h.
References getMSLastManglingParent().
LLVM_DUMP_METHOD void Scope::dump | ( | ) | const |
Definition at line 137 of file Scope.cpp.
References dumpImpl().
void Scope::dumpImpl | ( | raw_ostream & | OS | ) | const |
Definition at line 139 of file Scope.cpp.
References AtCatchScope, ControlScope, FnTryCatchScope, FunctionDeclarationScope, getEntity(), getFlags(), getMSCurManglingNumber(), getMSLastManglingNumber(), getParent(), ObjCMethodScope, OpenMPDirectiveScope, OpenMPLoopDirectiveScope, OpenMPSimdDirectiveScope, SEHExceptScope, SEHTryScope, SwitchScope, and TryScope.
Referenced by dump().
|
inline |
getBreakParent - Return the closest scope that a break statement would be affected by.
Definition at line 243 of file Scope.h.
Referenced by clang::Sema::ActOnBreakStmt(), AddKeywordsToConsumer(), AddOrdinaryNameResults(), and getBreakParent().
|
inline |
Definition at line 246 of file Scope.h.
References getBreakParent().
|
inline |
getContinueParent - Return the closest scope that a continue statement would be affected by.
Definition at line 233 of file Scope.h.
Referenced by clang::Sema::ActOnContinueStmt(), AddKeywordsToConsumer(), AddOrdinaryNameResults(), and getContinueParent().
|
inline |
Definition at line 237 of file Scope.h.
References getContinueParent().
|
inline |
Definition at line 313 of file Scope.h.
Referenced by clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteNamespaceDecl(), clang::Sema::CodeCompleteObjCMethodDecl(), dumpImpl(), clang::Sema::EnterDeclaratorContext(), clang::Sema::ExitDeclaratorContext(), findOuterContext(), clang::Sema::getDestructorName(), clang::Sema::getNonFieldDeclScope(), clang::Sema::getScopeForDeclContext(), getTagInjectionScope(), clang::IdentifierResolver::isDeclInScope(), isNamespaceOrTranslationUnitScope(), isNamespaceScope(), clang::Sema::LookupName(), LookupVisibleDecls(), mergeNRVOIntoParent(), clang::Sema::PushOnScopeChains(), and clang::Sema::PushUsingDirective().
|
inline |
getFlags - Return the flags for this scope.
Definition at line 210 of file Scope.h.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnPopScope(), clang::Sema::ActOnUsingDeclaration(), clang::Sema::ActOnUsingDirective(), clang::Sema::CheckClassTemplate(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteDeclSpec(), clang::Sema::DiagnoseCommaOperator(), dumpImpl(), clang::Sema::getNonFieldDeclScope(), getTagInjectionScope(), clang::Sema::HandleDeclarator(), handleDependencyAttr(), isAtCatchScope(), isClassScope(), clang::IdentifierResolver::isDeclInScope(), isFunctionPrototypeScope(), isFunctionScope(), IsInFnTryBlockHandler(), isOpenMPDirectiveScope(), isOpenMPLoopDirectiveScope(), isOpenMPSimdDirectiveScope(), isSEHExceptScope(), isSEHTryScope(), isTemplateParamScope(), isTryScope(), clang::Sema::LookupName(), and SemaBuiltinSEHScopeCheck().
|
inline |
getFnParent - Return the closest scope that is a function body.
Definition at line 223 of file Scope.h.
Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnReturnStmt(), clang::Sema::ActOnVariableDeclarator(), clang::Sema::CheckTypedefForVariablyModifiedType(), clang::Sema::CodeCompleteAfterIf(), clang::Sema::CodeCompleteExpression(), clang::Sema::CodeCompleteInPreprocessorConditionalExclusion(), clang::Sema::CodeCompleteOrdinaryName(), isInCXXInlineMethodScope(), IsInFnTryBlockHandler(), and clang::Sema::LookupOrCreateLabel().
|
inline |
Returns the number of function prototype scopes in this scope chain.
Definition at line 258 of file Scope.h.
Referenced by clang::Sema::ActOnParamDeclarator().
|
inline |
Definition at line 303 of file Scope.h.
Referenced by dumpImpl(), and getMSManglingNumber().
|
inline |
Definition at line 297 of file Scope.h.
References getMSLastManglingParent().
Referenced by dumpImpl(), and getMSManglingNumber().
|
inline |
Definition at line 226 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 264 of file Scope.h.
References isFunctionPrototypeScope().
Referenced by clang::Sema::ActOnParamDeclarator().
|
inline |
getParent - Return the scope that this is nested in.
Definition at line 218 of file Scope.h.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnObjCAtThrowStmt(), clang::Sema::ActOnSEHLeaveStmt(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::ActOnUsingDirective(), clang::Sema::ActOnVariableDeclarator(), buildDeclareReductionRef(), clang::Sema::CheckClassTemplate(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteLambdaIntroducer(), clang::Sema::CodeCompleteMemberReferenceExpr(), clang::Sema::CodeCompleteNamespaceDecl(), containedInPrototypeScope(), dumpImpl(), clang::Sema::EnterDeclaratorContext(), clang::Sema::ExitDeclaratorContext(), clang::Parser::ExitScope(), findOuterContext(), clang::Sema::getNonFieldDeclScope(), clang::Sema::getScopeForDeclContext(), getTagInjectionScope(), clang::Sema::HandleDeclarator(), clang::IdentifierResolver::isDeclInScope(), IsInFnTryBlockHandler(), isOpenMPLoopScope(), clang::Sema::LookupName(), clang::Sema::LookupVisibleDecls(), LookupVisibleDecls(), mergeNRVOIntoParent(), clang::Sema::PushOnScopeChains(), SemaBuiltinSEHScopeCheck(), and setFlags().
|
inline |
Definition at line 253 of file Scope.h.
Referenced by clang::Sema::ActOnDependentTemplateName(), clang::Sema::ActOnStartOfLambdaDefinition(), and clang::Sema::ActOnTypenameType().
|
inline |
|
inline |
Definition at line 316 of file Scope.h.
References clang::DiagnosticErrorTrap::hasErrorOccurred().
|
inline |
Definition at line 318 of file Scope.h.
References clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred().
Referenced by clang::Sema::ActOnPopScope(), and clang::Sema::DiagnoseUnusedBackingIvarInAccessor().
|
inline |
Definition at line 283 of file Scope.h.
References getMSLastManglingParent().
Init - This is used by the parser to implement scope caching.
Definition at line 88 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 376 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 214 of file Scope.h.
References BlockScope.
|
inline |
isClassScope - Return true if this scope is a class/struct/union scope.
Definition at line 326 of file Scope.h.
References ClassScope, and getFlags().
Referenced by AddKeywordsToConsumer(), clang::Sema::CodeCompleteUsing(), clang::Sema::getNonFieldDeclScope(), and getTagInjectionScope().
isDeclScope - Return true if this is the scope that the specified decl is declared in.
Definition at line 309 of file Scope.h.
Referenced by clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExceptionDeclarator(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnTag(), buildDeclareReductionRef(), clang::IdentifierResolver::isDeclInScope(), clang::Sema::LookupName(), mergeNRVOIntoParent(), clang::Sema::MergeTypedefNameDecl(), and clang::Sema::PushOnScopeChains().
|
inline |
isFunctionPrototypeScope - Return true if this scope is a function prototype scope.
Definition at line 371 of file Scope.h.
References FunctionPrototypeScope, and getFlags().
Referenced by clang::Sema::ActOnParamDeclarator(), containedInPrototypeScope(), getNextFunctionPrototypeIndex(), getTagInjectionScope(), clang::IdentifierResolver::isDeclInScope(), and clang::Sema::isMicrosoftMissingTypename().
|
inline |
isFunctionScope() - Return true if this scope is a function scope.
Definition at line 323 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 332 of file Scope.h.
References getFnParent().
|
inline |
isInObjcMethodOuterScope - Return true if this scope is an Objective-C method outer most body.
Definition at line 353 of file Scope.h.
References ObjCMethodScope, and S.
|
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 342 of file Scope.h.
References ObjCMethodScope, and S.
Referenced by clang::Sema::getObjCMessageKind().
|
inline |
Determines whether this scope is the OpenMP directive scope.
Definition at line 395 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 401 of file Scope.h.
References getFlags(), isOpenMPDirectiveScope(), and OpenMPLoopDirectiveScope.
Referenced by isOpenMPLoopScope().
|
inline |
Determine whether this scope is a loop having OpenMP loop directive attached.
Definition at line 418 of file Scope.h.
References getParent(), isOpenMPLoopDirectiveScope(), and P.
Referenced by clang::Sema::ActOnBreakStmt().
|
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 412 of file Scope.h.
References getFlags(), and OpenMPSimdDirectiveScope.
|
inline |
Determine whether this scope is a SEH '__except' block.
Definition at line 430 of file Scope.h.
References getFlags(), and SEHExceptScope.
Referenced by SemaBuiltinSEHScopeCheck().
|
inline |
Determine whether this scope is a SEH '__try' block.
Definition at line 427 of file Scope.h.
References getFlags(), and SEHTryScope.
Referenced by clang::Sema::ActOnSEHLeaveStmt().
|
inline |
isSwitchScope - Return true if this scope is a switch scope.
Definition at line 381 of file Scope.h.
References AtCatchScope, BlockScope, ClassScope, FnScope, FunctionPrototypeScope, ObjCMethodScope, S, SwitchScope, and TemplateParamScope.
|
inline |
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
Definition at line 365 of file Scope.h.
References getFlags(), and TemplateParamScope.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnNonTypeTemplateParameter(), clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::ActOnTypeParameter(), clang::Sema::ActOnUsingDirective(), and findOuterContext().
|
inline |
Determine whether this scope is a C++ 'try' block.
Definition at line 424 of file Scope.h.
References getFlags(), and TryScope.
void Scope::mergeNRVOIntoParent | ( | ) |
Definition at line 122 of file Scope.cpp.
References addNRVOCandidate(), getEntity(), getParent(), isDeclScope(), and setNoNRVO().
Referenced by clang::Sema::ActOnPopScope().
|
inline |
Definition at line 442 of file Scope.h.
Referenced by clang::Sema::PushUsingDirective().
|
inline |
Definition at line 279 of file Scope.h.
Referenced by clang::Sema::HideUsingShadowDecl(), clang::Sema::MergeTypedefNameDecl(), clang::Sema::popObjCTypeParamList(), and clang::Sema::PushOnScopeChains().
|
inline |
Definition at line 314 of file Scope.h.
References E.
Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnReenterFunctionContext(), clang::Sema::ActOnTagStartSkippedDefinition(), clang::Sema::EnterDeclaratorContext(), and clang::Sema::PushDeclContext().
|
inline |
Definition at line 211 of file Scope.h.
References getParent(), and setFlags().
Referenced by setFlags().
|
inline |
Definition at line 465 of file Scope.h.
Referenced by clang::Sema::ActOnReturnStmt(), addNRVOCandidate(), and mergeNRVOIntoParent().
|
inline |