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, FunctionDeclarationScope = 0x200, AtCatchScope = 0x400, ObjCMethodScope = 0x800, SwitchScope = 0x1000, TryScope = 0x2000, FnTryCatchScope = 0x4000, OpenMPDirectiveScope = 0x8000, OpenMPLoopDirectiveScope = 0x10000, OpenMPSimdDirectiveScope = 0x20000, EnumScope = 0x40000, SEHTryScope = 0x80000 } |
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 |
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 () |
const Scope * | getMSLocalManglingParent () const |
Scope * | getMSLocalManglingParent () |
Scope * | getContinueParent () |
const Scope * | getContinueParent () const |
Scope * | getBreakParent () |
const Scope * | getBreakParent () const |
Scope * | getBlockParent () |
const Scope * | getBlockParent () const |
Scope * | getTemplateParamParent () |
const Scope * | getTemplateParamParent () const |
unsigned | getFunctionPrototypeDepth () const |
unsigned | getNextFunctionPrototypeIndex () |
decl_range | decls () const |
bool | decl_empty () const |
void | AddDecl (Decl *D) |
void | RemoveDecl (Decl *D) |
void | incrementMSLocalManglingNumber () |
void | decrementMSLocalManglingNumber () |
unsigned | getMSLocalManglingNumber () const |
bool | isDeclScope (Decl *D) |
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. | |
bool | isClassScope () const |
isClassScope - Return true if this scope is a class/struct/union scope. | |
bool | isInCXXInlineMethodScope () const |
bool | isInObjcMethodScope () const |
bool | isInObjcMethodOuterScope () const |
bool | isTemplateParamScope () const |
bool | isFunctionPrototypeScope () const |
bool | isAtCatchScope () const |
isAtCatchScope - Return true if this scope is @catch. | |
bool | isSwitchScope () const |
isSwitchScope - Return true if this scope is a switch scope. | |
bool | isOpenMPDirectiveScope () const |
Determines whether this scope is the OpenMP directive scope. | |
bool | isOpenMPLoopDirectiveScope () const |
Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for', 'omp simd'). | |
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'). | |
bool | isOpenMPLoopScope () const |
Determine whether this scope is a loop having OpenMP loop directive attached. | |
bool | isTryScope () const |
Determine whether this scope is a C++ 'try' block. | |
bool | isSEHTryScope () const |
Determine whether this scope is a SEH '__try' block. | |
bool | containedInPrototypeScope () const |
void | PushUsingDirective (UsingDirectiveDecl *UDir) |
using_directives_range | using_directives () |
void | addNRVOCandidate (VarDecl *VD) |
void | setNoNRVO () |
void | mergeNRVOIntoParent () |
void | Init (Scope *parent, unsigned flags) |
void | AddFlags (unsigned Flags) |
Sets up the specified scope flags and adjusts the scope state variables accordingly. | |
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.
clang::Scope::Scope | ( | Scope * | Parent, |
unsigned | ScopeFlags, | ||
DiagnosticsEngine & | Diag | ||
) | [inline] |
void clang::Scope::AddDecl | ( | Decl * | D | ) | [inline] |
Definition at line 264 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 | ) |
Sets up the specified scope flags and adjusts the scope state variables accordingly.
Definition at line 101 of file Scope.cpp.
References BreakScope, and ContinueScope.
void clang::Scope::addNRVOCandidate | ( | VarDecl * | VD | ) | [inline] |
Definition at line 426 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 91 of file Scope.cpp.
References getParent(), isFunctionPrototypeScope(), and S.
Referenced by clang::Sema::ActOnTag().
bool clang::Scope::decl_empty | ( | ) | const [inline] |
Definition at line 262 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope().
decl_range clang::Scope::decls | ( | ) | const [inline] |
Definition at line 259 of file Scope.h.
Referenced by clang::Sema::ActOnPopScope(), clang::Sema::CodeCompleteLambdaIntroducer(), and LookupVisibleDecls().
void clang::Scope::decrementMSLocalManglingNumber | ( | ) | [inline] |
Definition at line 277 of file Scope.h.
References getMSLocalManglingParent().
void Scope::dump | ( | ) | const |
Definition at line 130 of file Scope.cpp.
References dumpImpl().
void Scope::dumpImpl | ( | raw_ostream & | OS | ) | const |
Definition at line 132 of file Scope.cpp.
References AtCatchScope, BlockScope, BreakScope, ClassScope, ContinueScope, ControlScope, DeclScope, FnScope, FnTryCatchScope, FunctionDeclarationScope, FunctionPrototypeScope, getEntity(), getFlags(), getMSLocalManglingNumber(), getParent(), ObjCMethodScope, OpenMPDirectiveScope, OpenMPLoopDirectiveScope, OpenMPSimdDirectiveScope, SEHTryScope, SwitchScope, TemplateParamScope, and TryScope.
Referenced by dump().
Scope* clang::Scope::getBlockParent | ( | ) | [inline] |
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.
Definition at line 232 of file Scope.h.
Referenced by clang::Sema::ActOnBreakStmt(), AddKeywordsToConsumer(), AddOrdinaryNameResults(), and getBreakParent().
const Scope* clang::Scope::getBreakParent | ( | ) | const [inline] |
Definition at line 235 of file Scope.h.
References getBreakParent().
Scope* clang::Scope::getContinueParent | ( | ) | [inline] |
getContinueParent - Return the closest scope that a continue statement would be affected by.
Definition at line 222 of file Scope.h.
Referenced by clang::Sema::ActOnContinueStmt(), AddKeywordsToConsumer(), AddOrdinaryNameResults(), and getContinueParent().
const Scope* clang::Scope::getContinueParent | ( | ) | const [inline] |
Definition at line 226 of file Scope.h.
References getContinueParent().
DeclContext* clang::Scope::getEntity | ( | ) | const [inline] |
Definition at line 294 of file Scope.h.
Referenced by clang::Sema::ActOnTag(), 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(), clang::IdentifierResolver::isDeclInScope(), isNamespaceOrTranslationUnitScope(), isNamespaceScope(), clang::Sema::LookupName(), LookupVisibleDecls(), mergeNRVOIntoParent(), clang::Sema::PushOnScopeChains(), and clang::Sema::PushUsingDirective().
unsigned clang::Scope::getFlags | ( | ) | const [inline] |
getFlags - Return the flags for this scope.
Definition at line 199 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::CheckClassTemplate(), clang::Sema::CheckTemplateDeclScope(), clang::Sema::CodeCompleteDeclSpec(), dumpImpl(), clang::Sema::getNonFieldDeclScope(), clang::Sema::HandleDeclarator(), handleDependencyAttr(), Init(), isAtCatchScope(), isClassScope(), clang::IdentifierResolver::isDeclInScope(), isFunctionPrototypeScope(), isFunctionScope(), isOpenMPDirectiveScope(), isOpenMPLoopDirectiveScope(), isOpenMPSimdDirectiveScope(), isSEHTryScope(), 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 212 of file Scope.h.
Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnVariableDeclarator(), clang::Sema::CheckTypedefForVariablyModifiedType(), clang::Sema::CodeCompleteAfterIf(), clang::Sema::CodeCompleteExpression(), clang::Sema::CodeCompleteInPreprocessorConditionalExclusion(), clang::Sema::CodeCompleteOrdinaryName(), isInCXXInlineMethodScope(), and clang::Sema::LookupOrCreateLabel().
Scope* clang::Scope::getFnParent | ( | ) | [inline] |
unsigned clang::Scope::getFunctionPrototypeDepth | ( | ) | const [inline] |
Returns the number of function prototype scopes in this scope chain.
Definition at line 247 of file Scope.h.
Referenced by clang::Sema::ActOnParamDeclarator().
unsigned clang::Scope::getMSLocalManglingNumber | ( | ) | const [inline] |
Definition at line 282 of file Scope.h.
References getMSLocalManglingParent().
Referenced by clang::Sema::BuildAnonymousStructOrUnion(), dumpImpl(), HandleTagNumbering(), and Init().
const Scope* clang::Scope::getMSLocalManglingParent | ( | ) | const [inline] |
Definition at line 215 of file Scope.h.
Referenced by decrementMSLocalManglingNumber(), getMSLocalManglingNumber(), and incrementMSLocalManglingNumber().
Scope* clang::Scope::getMSLocalManglingParent | ( | ) | [inline] |
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 253 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 207 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::ActOnStartOfFunctionTemplateDef(), clang::Sema::ActOnTag(), clang::Sema::ActOnUsingDirective(), clang::Sema::ActOnVariableDeclarator(), 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(), clang::Sema::HandleDeclarator(), Init(), clang::IdentifierResolver::isDeclInScope(), isOpenMPLoopScope(), clang::Sema::LookupName(), clang::Sema::LookupVisibleDecls(), LookupVisibleDecls(), mergeNRVOIntoParent(), and clang::Sema::PushOnScopeChains().
Scope* clang::Scope::getParent | ( | ) | [inline] |
Scope* clang::Scope::getTemplateParamParent | ( | ) | [inline] |
Definition at line 242 of file Scope.h.
Referenced by clang::Sema::ActOnDependentTemplateName(), clang::Sema::ActOnStartOfLambdaDefinition(), and clang::Sema::ActOnTypenameType().
const Scope* clang::Scope::getTemplateParamParent | ( | ) | const [inline] |
bool clang::Scope::hasErrorOccurred | ( | ) | const [inline] |
Definition at line 297 of file Scope.h.
References clang::DiagnosticErrorTrap::hasErrorOccurred().
bool clang::Scope::hasUnrecoverableErrorOccurred | ( | ) | const [inline] |
Definition at line 299 of file Scope.h.
References clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred().
Referenced by clang::Sema::ActOnPopScope(), and clang::Sema::DiagnoseUnusedBackingIvarInAccessor().
void clang::Scope::incrementMSLocalManglingNumber | ( | ) | [inline] |
Definition at line 272 of file Scope.h.
References getMSLocalManglingParent().
Referenced by Init().
void Scope::Init | ( | Scope * | parent, |
unsigned | flags | ||
) |
Init - This is used by the parser to implement scope caching.
Definition at line 21 of file Scope.cpp.
References AtCatchScope, BlockScope, BreakScope, ClassScope, ContinueScope, DeclScope, EnumScope, FnScope, FunctionPrototypeScope, getFlags(), getMSLocalManglingNumber(), getParent(), incrementMSLocalManglingNumber(), isClassScope(), ObjCMethodScope, OpenMPSimdDirectiveScope, clang::DiagnosticErrorTrap::reset(), and TemplateParamScope.
Referenced by clang::Parser::EnterScope(), and Scope().
bool clang::Scope::isAtCatchScope | ( | ) | const [inline] |
isAtCatchScope - Return true if this scope is @catch.
Definition at line 357 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 203 of file Scope.h.
References BlockScope.
bool clang::Scope::isClassScope | ( | ) | const [inline] |
isClassScope - Return true if this scope is a class/struct/union scope.
Definition at line 307 of file Scope.h.
References ClassScope, and getFlags().
Referenced by clang::Sema::ActOnTag(), AddKeywordsToConsumer(), clang::Sema::CodeCompleteUsing(), clang::Sema::getNonFieldDeclScope(), and Init().
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 290 of file Scope.h.
Referenced by clang::Sema::ActOnCXXThrow(), clang::Sema::ActOnExceptionDeclarator(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnTag(), clang::IdentifierResolver::isDeclInScope(), clang::Sema::LookupName(), mergeNRVOIntoParent(), and clang::Sema::PushOnScopeChains().
bool clang::Scope::isFunctionPrototypeScope | ( | ) | const [inline] |
isFunctionPrototypeScope - Return true if this scope is a function prototype scope.
Definition at line 352 of file Scope.h.
References FunctionPrototypeScope, and getFlags().
Referenced by clang::Sema::ActOnParamDeclarator(), clang::Sema::ActOnTag(), containedInPrototypeScope(), getNextFunctionPrototypeIndex(), clang::IdentifierResolver::isDeclInScope(), and clang::Sema::isMicrosoftMissingTypename().
bool clang::Scope::isFunctionScope | ( | ) | const [inline] |
isFunctionScope() - Return true if this scope is a function scope.
Definition at line 304 of file Scope.h.
References FnScope, and getFlags().
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 313 of file Scope.h.
References getFnParent().
bool clang::Scope::isInObjcMethodOuterScope | ( | ) | const [inline] |
isInObjcMethodOuterScope - Return true if this scope is an Objective-C method outer most body.
Definition at line 334 of file Scope.h.
References ObjCMethodScope, and S.
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 323 of file Scope.h.
References ObjCMethodScope, and S.
Referenced by clang::Sema::getObjCMessageKind().
bool clang::Scope::isOpenMPDirectiveScope | ( | ) | const [inline] |
Determines whether this scope is the OpenMP directive scope.
Definition at line 376 of file Scope.h.
References getFlags(), and OpenMPDirectiveScope.
Referenced by isOpenMPLoopDirectiveScope().
bool clang::Scope::isOpenMPLoopDirectiveScope | ( | ) | const [inline] |
Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for', 'omp simd').
Definition at line 382 of file Scope.h.
References getFlags(), isOpenMPDirectiveScope(), and OpenMPLoopDirectiveScope.
Referenced by isOpenMPLoopScope().
bool clang::Scope::isOpenMPLoopScope | ( | ) | const [inline] |
Determine whether this scope is a loop having OpenMP loop directive attached.
Definition at line 399 of file Scope.h.
References getParent(), isOpenMPLoopDirectiveScope(), and P.
Referenced by clang::Sema::ActOnBreakStmt().
bool clang::Scope::isOpenMPSimdDirectiveScope | ( | ) | const [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 393 of file Scope.h.
References getFlags(), and OpenMPSimdDirectiveScope.
bool clang::Scope::isSEHTryScope | ( | ) | const [inline] |
Determine whether this scope is a SEH '__try' block.
Definition at line 408 of file Scope.h.
References getFlags(), and SEHTryScope.
Referenced by clang::Sema::ActOnSEHLeaveStmt().
bool clang::Scope::isSwitchScope | ( | ) | const [inline] |
isSwitchScope - Return true if this scope is a switch scope.
Definition at line 362 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 346 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 405 of file Scope.h.
References getFlags(), and TryScope.
void Scope::mergeNRVOIntoParent | ( | ) |
Definition at line 115 of file Scope.cpp.
References addNRVOCandidate(), getEntity(), getParent(), isDeclScope(), and setNoNRVO().
Referenced by clang::Sema::ActOnPopScope().
void clang::Scope::PushUsingDirective | ( | UsingDirectiveDecl * | UDir | ) | [inline] |
Definition at line 414 of file Scope.h.
Referenced by clang::Sema::PushUsingDirective().
void clang::Scope::RemoveDecl | ( | Decl * | D | ) | [inline] |
Definition at line 268 of file Scope.h.
Referenced by clang::Sema::HideUsingShadowDecl(), and clang::Sema::PushOnScopeChains().
void clang::Scope::setEntity | ( | DeclContext * | E | ) | [inline] |
Definition at line 295 of file Scope.h.
Referenced by clang::Sema::ActOnFriendFunctionDecl(), clang::Sema::ActOnReenterFunctionContext(), clang::Sema::EnterDeclaratorContext(), and clang::Sema::PushDeclContext().
void clang::Scope::setFlags | ( | unsigned | F | ) | [inline] |
void clang::Scope::setNoNRVO | ( | ) | [inline] |
Definition at line 437 of file Scope.h.
Referenced by clang::Sema::ActOnReturnStmt(), addNRVOCandidate(), and mergeNRVOIntoParent().
using_directives_range clang::Scope::using_directives | ( | ) | [inline] |