clang API Documentation
#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, AtCatchScope = 0x200, ObjCMethodScope = 0x400, SwitchScope = 0x800, ThisScope = 0x1000, TryScope = 0x2000 } |
| typedef DeclSetTy::iterator | decl_iterator |
| typedef UsingDirectivesTy::iterator | udir_iterator |
| typedef UsingDirectivesTy::const_iterator | const_udir_iterator |
Public Member Functions | |
| Scope (Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag) | |
| unsigned | getFlags () const |
| void | setFlags (unsigned F) |
| bool | isBlockScope () const |
| isBlockScope - Return true if this scope correspond to a closure. | |
| const Scope * | getParent () const |
| Scope * | getParent () |
| const Scope * | getFnParent () const |
| Scope * | getFnParent () |
| Scope * | getContinueParent () |
| const Scope * | getContinueParent () const |
| Scope * | getBreakParent () |
| const Scope * | getBreakParent () const |
| Scope * | getControlParent () |
| const Scope * | getControlParent () const |
| Scope * | getBlockParent () |
| const Scope * | getBlockParent () const |
| Scope * | getTemplateParamParent () |
| const Scope * | getTemplateParamParent () const |
| unsigned | getFunctionPrototypeDepth () const |
| unsigned | getNextFunctionPrototypeIndex () |
| decl_iterator | decl_begin () const |
| decl_iterator | decl_end () const |
| bool | decl_empty () const |
| void | AddDecl (Decl *D) |
| void | RemoveDecl (Decl *D) |
| bool | isDeclScope (Decl *D) |
| void * | getEntity () const |
| void | setEntity (void *E) |
| bool | hasErrorOccurred () const |
| bool | isClassScope () const |
| isClassScope - Return true if this scope is a class/struct/union scope. | |
| bool | isInCXXInlineMethodScope () const |
| bool | isInObjcMethodScope () const |
| bool | isTemplateParamScope () const |
| bool | isFunctionPrototypeScope () const |
| bool | isAtCatchScope () const |
| isAtCatchScope - Return true if this scope is . | |
| bool | isSwitchScope () const |
| isSwitchScope - Return true if this scope is a switch scope. | |
| bool | isTryScope () const |
| Determine whether this scope is a C++ 'try' block. | |
| void | PushUsingDirective (UsingDirectiveDecl *UDir) |
| udir_iterator | using_directives_begin () |
| udir_iterator | using_directives_end () |
| const_udir_iterator | using_directives_begin () const |
| const_udir_iterator | using_directives_end () const |
| void | Init (Scope *parent, unsigned flags) |
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 UsingDirectivesTy::const_iterator clang::Scope::const_udir_iterator |
| typedef DeclSetTy::iterator clang::Scope::decl_iterator |
| typedef UsingDirectivesTy::iterator clang::Scope::udir_iterator |
ScopeFlags - These are bitfields that are or'd together when creating a scope, which defines the sorts of things the scope contains.
| FnScope |
FnScope - This indicates that the scope corresponds to a function, which means that labels are set here. |
| BreakScope |
BreakScope - This is a while,do,switch,for, etc that can have break stmts embedded into it. |
| ContinueScope |
ContinueScope - This is a while,do,for, which can have continue stmt embedded into it. |
| DeclScope |
DeclScope - This is a scope that can contain a declaration. Some scopes just contain loop constructs but don't contain decls. |
| ControlScope |
ControlScope - The controlling scope in a if/switch/while/for statement. |
| ClassScope |
ClassScope - The scope of a struct/union/class definition. |
| BlockScope |
BlockScope - This is a scope that corresponds to a block/closure object. Blocks serve as top-level scopes for some objects like labels, they also prevent things like break and continue. BlockScopes always have the FnScope, BreakScope, ContinueScope, and DeclScope flags set as well. |
| TemplateParamScope |
TemplateParamScope - This is a scope that corresponds to the template parameters of a C++ template. Template parameter scope starts at the 'template' keyword and ends when the template declaration ends. |
| FunctionPrototypeScope |
FunctionPrototypeScope - This is a scope that corresponds to the parameters within a function prototype. |
| AtCatchScope |
AtCatchScope - This is a scope that corresponds to the Objective-C statement. |
| ObjCMethodScope |
ObjCMethodScope - This scope corresponds to an Objective-C method body. It always has FnScope and DeclScope set as well. |
| SwitchScope |
SwitchScope - This is a scope that corresponds to a switch statement. |
| ThisScope |
ThisScope - This is the scope of a struct/union/class definition, outside of any member function definition, where 'this' is nonetheless usable. |
| TryScope |
TryScope - This is the scope of a C++ try statement. |
| clang::Scope::Scope | ( | Scope * | Parent, |
| unsigned | ScopeFlags, | ||
| DiagnosticsEngine & | Diag | ||
| ) | [inline] |
| void clang::Scope::AddDecl | ( | Decl * | D | ) | [inline] |
Definition at line 234 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::ActOnReenterDeclaratorTemplateScope(), clang::Sema::ActOnReenterFunctionContext(), clang::Sema::ActOnReenterTemplateScope(), clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::ActOnTypeParameter(), and clang::Sema::PushOnScopeChains().
| decl_iterator clang::Scope::decl_begin | ( | ) | const [inline] |
Definition at line 230 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope(), and LookupVisibleDecls().
| bool clang::Scope::decl_empty | ( | ) | const [inline] |
Definition at line 232 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope().
| decl_iterator clang::Scope::decl_end | ( | ) | const [inline] |
Definition at line 231 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope(), and LookupVisibleDecls().
| const Scope* clang::Scope::getBlockParent | ( | ) | const [inline] |
| Scope* clang::Scope::getBreakParent | ( | ) | [inline] |
getBreakParent - Return the closest scope that a break statement would be affected by. If the closest scope is a block scope, we know that there is no loop *inside* the block.
Definition at line 198 of file Scope.h.
References isBlockScope().
Referenced by clang::Sema::ActOnBreakStmt(), AddKeywordsToConsumer(), AddOrdinaryNameResults(), and getBreakParent().
| const Scope* clang::Scope::getBreakParent | ( | ) | const [inline] |
Definition at line 203 of file Scope.h.
References getBreakParent().
| Scope* clang::Scope::getContinueParent | ( | ) | [inline] |
getContinueParent - Return the closest scope that a continue statement would be affected by. If the closest scope is a closure scope, we know that there is no loop *inside* the closure.
Definition at line 185 of file Scope.h.
References isBlockScope().
Referenced by clang::Sema::ActOnContinueStmt(), AddKeywordsToConsumer(), AddOrdinaryNameResults(), and getContinueParent().
| const Scope* clang::Scope::getContinueParent | ( | ) | const [inline] |
Definition at line 191 of file Scope.h.
References getContinueParent().
| const Scope* clang::Scope::getControlParent | ( | ) | const [inline] |
| void* clang::Scope::getEntity | ( | ) | const [inline] |
Definition at line 248 of file Scope.h.
Referenced by clang::Sema::ActOnTag(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteNamespaceDecl(), clang::Sema::CodeCompleteObjCMethodDecl(), clang::Sema::EnterDeclaratorContext(), clang::Sema::ExitDeclaratorContext(), findOuterContext(), clang::Sema::getNonFieldDeclScope(), clang::Sema::getScopeForDeclContext(), clang::IdentifierResolver::isDeclInScope(), isNamespaceOrTranslationUnitScope(), clang::Sema::LookupName(), LookupVisibleDecls(), clang::Sema::PushOnScopeChains(), and clang::Sema::PushUsingDirective().
| unsigned clang::Scope::getFlags | ( | ) | const [inline] |
getFlags - Return the flags for this scope.
Definition at line 166 of file Scope.h.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnPopScope(), clang::Sema::ActOnTag(), clang::Sema::ActOnUsingDeclaration(), clang::Sema::ActOnUsingDirective(), clang::Sema::CheckTemplateDeclScope(), ClassifyImplicitMemberAccess(), clang::Sema::CodeCompleteDeclSpec(), clang::Sema::getCurrentThisType(), clang::Sema::getNonFieldDeclScope(), clang::Sema::HandleDeclarator(), isAtCatchScope(), isClassScope(), clang::IdentifierResolver::isDeclInScope(), isFunctionPrototypeScope(), isTemplateParamScope(), isTryScope(), and clang::Sema::LookupName().
| const Scope* clang::Scope::getFnParent | ( | ) | const [inline] |
getFnParent - Return the closest scope that is a function body.
Definition at line 179 of file Scope.h.
Referenced by clang::Sema::ActOnVariableDeclarator(), clang::Sema::CheckTypedefForVariablyModifiedType(), clang::Sema::CodeCompleteAfterIf(), clang::Sema::CodeCompleteExpression(), clang::Sema::CodeCompleteInPreprocessorConditionalExclusion(), clang::Sema::CodeCompleteOrdinaryName(), isInCXXInlineMethodScope(), and clang::Sema::LookupOrCreateLabel().
| unsigned clang::Scope::getFunctionPrototypeDepth | ( | ) | const [inline] |
Returns the number of function prototype scopes in this scope chain.
Definition at line 218 of file Scope.h.
Referenced by clang::Sema::ActOnParamDeclarator().
| unsigned clang::Scope::getNextFunctionPrototypeIndex | ( | ) | [inline] |
Return the number of parameters declared in this function prototype, increasing it by one for the next call.
Definition at line 224 of file Scope.h.
References isFunctionPrototypeScope().
Referenced by clang::Sema::ActOnParamDeclarator().
| const Scope* clang::Scope::getParent | ( | ) | const [inline] |
getParent - Return the scope that this is nested in.
Definition at line 174 of file Scope.h.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnObjCAtThrowStmt(), clang::Sema::ActOnStartNamespaceDef(), clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::ActOnStartOfFunctionTemplateDef(), clang::Sema::ActOnTag(), clang::Sema::ActOnUsingDirective(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteMemberReferenceExpr(), clang::Sema::CodeCompleteNamespaceDecl(), clang::Sema::EnterDeclaratorContext(), clang::Sema::ExitDeclaratorContext(), findOuterContext(), clang::Sema::getNonFieldDeclScope(), clang::Sema::getScopeForDeclContext(), clang::Sema::HandleDeclarator(), clang::IdentifierResolver::isDeclInScope(), clang::Sema::LookupName(), clang::Sema::LookupVisibleDecls(), LookupVisibleDecls(), clang::Sema::PushOnScopeChains(), and clang::Sema::RegisterLocallyScopedExternCDecl().
| Scope* clang::Scope::getTemplateParamParent | ( | ) | [inline] |
Definition at line 213 of file Scope.h.
Referenced by clang::Sema::ActOnDependentTemplateName(), and clang::Sema::ActOnTypenameType().
| const Scope* clang::Scope::getTemplateParamParent | ( | ) | const [inline] |
| bool clang::Scope::hasErrorOccurred | ( | ) | const [inline] |
Definition at line 251 of file Scope.h.
References clang::DiagnosticErrorTrap::hasErrorOccurred().
Referenced by clang::Sema::ActOnPopScope().
| void Scope::Init | ( | Scope * | parent, |
| unsigned | flags | ||
| ) |
Init - This is used by the parser to implement scope caching.
Definition at line 19 of file Scope.cpp.
References BlockScope, BreakScope, ContinueScope, ControlScope, FnScope, FunctionPrototypeScope, clang::DiagnosticErrorTrap::reset(), and TemplateParamScope.
Referenced by Scope().
| bool clang::Scope::isAtCatchScope | ( | ) | const [inline] |
isAtCatchScope - Return true if this scope is .
Definition at line 292 of file Scope.h.
References AtCatchScope, and getFlags().
Referenced by clang::Sema::ActOnObjCAtThrowStmt().
| bool clang::Scope::isBlockScope | ( | ) | const [inline] |
isBlockScope - Return true if this scope correspond to a closure.
Definition at line 170 of file Scope.h.
References BlockScope.
Referenced by getBreakParent(), and getContinueParent().
| bool clang::Scope::isClassScope | ( | ) | const [inline] |
isClassScope - Return true if this scope is a class/struct/union scope.
Definition at line 254 of file Scope.h.
References ClassScope, and getFlags().
Referenced by clang::Sema::ActOnTag(), AddKeywordsToConsumer(), clang::Sema::CodeCompleteUsing(), and clang::Sema::getNonFieldDeclScope().
| bool clang::Scope::isDeclScope | ( | Decl * | D | ) | [inline] |
isDeclScope - Return true if this is the scope that the specified decl is declared in.
Definition at line 244 of file Scope.h.
Referenced by clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExceptionDeclarator(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnParamDeclarator(), clang::IdentifierResolver::isDeclInScope(), clang::Sema::LookupName(), clang::Sema::PushOnScopeChains(), and clang::Sema::RegisterLocallyScopedExternCDecl().
| bool clang::Scope::isFunctionPrototypeScope | ( | ) | const [inline] |
isFunctionPrototypeScope - Return true if this scope is a function prototype scope.
Definition at line 287 of file Scope.h.
References FunctionPrototypeScope, and getFlags().
Referenced by clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnTag(), getNextFunctionPrototypeIndex(), and clang::Sema::isMicrosoftMissingTypename().
| bool clang::Scope::isInCXXInlineMethodScope | ( | ) | const [inline] |
isInCXXInlineMethodScope - Return true if this scope is a C++ inline method scope or is inside one.
Definition at line 260 of file Scope.h.
References getFnParent().
| bool clang::Scope::isInObjcMethodScope | ( | ) | const [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 270 of file Scope.h.
References ObjCMethodScope, and S.
Referenced by clang::Sema::getObjCMessageKind().
| bool clang::Scope::isSwitchScope | ( | ) | const [inline] |
isSwitchScope - Return true if this scope is a switch scope.
Definition at line 297 of file Scope.h.
References AtCatchScope, BlockScope, ClassScope, FnScope, FunctionPrototypeScope, ObjCMethodScope, S, SwitchScope, and TemplateParamScope.
| bool clang::Scope::isTemplateParamScope | ( | ) | const [inline] |
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
Definition at line 281 of file Scope.h.
References getFlags(), and TemplateParamScope.
Referenced by clang::Sema::ActOnNonTypeTemplateParameter(), clang::Sema::ActOnTemplateTemplateParameter(), clang::Sema::ActOnTypeParameter(), and findOuterContext().
| bool clang::Scope::isTryScope | ( | ) | const [inline] |
Determine whether this scope is a C++ 'try' block.
Definition at line 311 of file Scope.h.
References getFlags(), and TryScope.
| void clang::Scope::PushUsingDirective | ( | UsingDirectiveDecl * | UDir | ) | [inline] |
Definition at line 316 of file Scope.h.
Referenced by clang::Sema::PushUsingDirective().
| void clang::Scope::RemoveDecl | ( | Decl * | D | ) | [inline] |
Definition at line 238 of file Scope.h.
Referenced by clang::Sema::HideUsingShadowDecl(), clang::Sema::PushOnScopeChains(), and clang::Sema::RegisterLocallyScopedExternCDecl().
| void clang::Scope::setEntity | ( | void * | E | ) | [inline] |
Definition at line 249 of file Scope.h.
Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::EnterDeclaratorContext(), and clang::Sema::PushDeclContext().
| udir_iterator clang::Scope::using_directives_begin | ( | ) | [inline] |
| const_udir_iterator clang::Scope::using_directives_begin | ( | ) | const [inline] |
| udir_iterator clang::Scope::using_directives_end | ( | ) | [inline] |
| const_udir_iterator clang::Scope::using_directives_end | ( | ) | const [inline] |