Lines Matching full:scope

1 //===--- Scope.h - Scope interface ------------------------------*- C++ -*-===//
10 // This file defines the Scope interface.
35 /// Scope - A scope is a transient data structure that is used while parsing the
39 class Scope {
42 /// scope, which defines the sorts of things the scope contains.
44 /// \brief This indicates that the scope corresponds to a function, which
56 /// \brief This is a scope that can contain a declaration. Some scopes
60 /// \brief The controlling scope in a if/switch/while/for statement.
63 /// \brief The scope of a struct/union/class definition.
66 /// \brief This is a scope that corresponds to a block/closure object.
72 /// \brief This is a scope that corresponds to the
74 /// scope starts at the 'template' keyword and ends when the
78 /// \brief This is a scope that corresponds to the
82 /// \brief This is a scope that corresponds to the parameters within
88 /// \brief This is a scope that corresponds to the Objective-C
92 /// \brief This scope corresponds to an Objective-C method body.
96 /// \brief This is a scope that corresponds to a switch statement.
99 /// \brief This is the scope of a C++ try statement.
102 /// \brief This is the scope for a function-level C++ try or catch scope.
105 /// \brief This is the scope of OpenMP executable directive.
108 /// \brief This is the scope of some OpenMP loop directive.
111 /// \brief This is the scope of some OpenMP simd directive.
116 /// This scope corresponds to an enum.
119 /// This scope corresponds to an SEH try.
122 /// This scope corresponds to an SEH except.
129 /// The parent scope for this scope. This is null for the translation-unit
130 /// scope.
131 Scope *AnyParent;
133 /// Flags - This contains a set of ScopeFlags, which indicates how the scope
137 /// Depth - This is the depth of this scope. The translation-unit scope has
148 /// enclosing this scope, including this scope.
152 /// declared in this scope.
155 /// FnParent - If this scope has a parent scope that is a function body, this
157 Scope *FnParent;
158 Scope *MSLastManglingParent;
161 /// BreakScope/ContinueScope which contains the contents of this scope
162 /// for control flow purposes (and might be this scope itself), or null
163 /// if there is no such scope.
164 Scope *BreakParent, *ContinueParent;
167 /// BlockScope if this scope is not one, or null if there is none.
168 Scope *BlockParent;
171 /// immediately containing template parameter scope. In the
174 Scope *TemplateParamParent;
176 /// DeclsInScope - This keeps track of all declarations in this scope. When
177 /// the declaration is added to the scope, it is set as the current
178 /// declaration for the identifier in the IdentifierTable. When the scope is
185 /// The DeclContext with which this scope is associated. For
186 /// example, the entity of a class scope is the class itself, the
187 /// entity of a function scope is a function, etc.
193 /// \brief Used to determine if errors occurred in this scope.
197 /// this scope, or over-defined. The bit is true when over-defined.
200 void setFlags(Scope *Parent, unsigned F);
203 Scope(Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag) in Scope() function
208 /// getFlags - Return the flags for this scope.
213 /// isBlockScope - Return true if this scope correspond to a closure.
216 /// getParent - Return the scope that this is nested in.
218 const Scope *getParent() const { return AnyParent; } in getParent()
219 Scope *getParent() { return AnyParent; } in getParent()
221 /// getFnParent - Return the closest scope that is a function body.
223 const Scope *getFnParent() const { return FnParent; } in getFnParent()
224 Scope *getFnParent() { return FnParent; } in getFnParent()
226 const Scope *getMSLastManglingParent() const { in getMSLastManglingParent()
229 Scope *getMSLastManglingParent() { return MSLastManglingParent; } in getMSLastManglingParent()
231 /// getContinueParent - Return the closest scope that a continue statement
233 Scope *getContinueParent() { in getContinueParent()
237 const Scope *getContinueParent() const { in getContinueParent()
238 return const_cast<Scope*>(this)->getContinueParent(); in getContinueParent()
241 /// getBreakParent - Return the closest scope that a break statement
243 Scope *getBreakParent() { in getBreakParent()
246 const Scope *getBreakParent() const { in getBreakParent()
247 return const_cast<Scope*>(this)->getBreakParent(); in getBreakParent()
250 Scope *getBlockParent() { return BlockParent; } in getBlockParent()
251 const Scope *getBlockParent() const { return BlockParent; } in getBlockParent()
253 Scope *getTemplateParamParent() { return TemplateParamParent; } in getTemplateParamParent()
254 const Scope *getTemplateParamParent() const { return TemplateParamParent; } in getTemplateParamParent()
256 /// Returns the number of function prototype scopes in this scope
284 if (Scope *MSLMP = getMSLastManglingParent()) { in incrementMSManglingNumber()
291 if (Scope *MSLMP = getMSLastManglingParent()) { in decrementMSManglingNumber()
298 if (const Scope *MSLMP = getMSLastManglingParent()) in getMSLastManglingNumber()
307 /// isDeclScope - Return true if this is the scope that the specified decl is
322 /// isFunctionScope() - Return true if this scope is a function scope.
323 bool isFunctionScope() const { return (getFlags() & Scope::FnScope); } in isFunctionScope()
325 /// isClassScope - Return true if this scope is a class/struct/union scope.
327 return (getFlags() & Scope::ClassScope); in isClassScope()
330 /// isInCXXInlineMethodScope - Return true if this scope is a C++ inline
331 /// method scope or is inside one.
333 if (const Scope *FnS = getFnParent()) { in isInCXXInlineMethodScope()
340 /// isInObjcMethodScope - Return true if this scope is, or is contained in, an
343 for (const Scope *S = this; S; S = S->getParent()) { in isInObjcMethodScope()
344 // If this scope is an objc method scope, then we succeed. in isInObjcMethodScope()
351 /// isInObjcMethodOuterScope - Return true if this scope is an
354 if (const Scope *S = this) { in isInObjcMethodOuterScope()
355 // If this scope is an objc method scope, then we succeed. in isInObjcMethodOuterScope()
363 /// isTemplateParamScope - Return true if this scope is a C++
364 /// template parameter scope.
366 return getFlags() & Scope::TemplateParamScope; in isTemplateParamScope()
369 /// isFunctionPrototypeScope - Return true if this scope is a
370 /// function prototype scope.
372 return getFlags() & Scope::FunctionPrototypeScope; in isFunctionPrototypeScope()
375 /// isAtCatchScope - Return true if this scope is \@catch.
377 return getFlags() & Scope::AtCatchScope; in isAtCatchScope()
380 /// isSwitchScope - Return true if this scope is a switch scope.
382 for (const Scope *S = this; S; S = S->getParent()) { in isSwitchScope()
383 if (S->getFlags() & Scope::SwitchScope) in isSwitchScope()
385 else if (S->getFlags() & (Scope::FnScope | Scope::ClassScope | in isSwitchScope()
386 Scope::BlockScope | Scope::TemplateParamScope | in isSwitchScope()
387 Scope::FunctionPrototypeScope | in isSwitchScope()
388 Scope::AtCatchScope | Scope::ObjCMethodScope)) in isSwitchScope()
394 /// \brief Determines whether this scope is the OpenMP directive scope
396 return (getFlags() & Scope::OpenMPDirectiveScope); in isOpenMPDirectiveScope()
399 /// \brief Determine whether this scope is some OpenMP loop directive scope
402 if (getFlags() & Scope::OpenMPLoopDirectiveScope) { in isOpenMPLoopDirectiveScope()
404 "OpenMP loop directive scope is not a directive scope"); in isOpenMPLoopDirectiveScope()
410 /// \brief Determine whether this scope is (or is nested into) some OpenMP
411 /// loop simd directive scope (for example, 'omp simd', 'omp for simd').
413 return getFlags() & Scope::OpenMPSimdDirectiveScope; in isOpenMPSimdDirectiveScope()
416 /// \brief Determine whether this scope is a loop having OpenMP loop
419 const Scope *P = getParent(); in isOpenMPLoopScope()
423 /// \brief Determine whether this scope is a C++ 'try' block.
424 bool isTryScope() const { return getFlags() & Scope::TryScope; } in isTryScope()
426 /// \brief Determine whether this scope is a SEH '__try' block.
427 bool isSEHTryScope() const { return getFlags() & Scope::SEHTryScope; } in isSEHTryScope()
429 /// \brief Determine whether this scope is a SEH '__except' block.
430 bool isSEHExceptScope() const { return getFlags() & Scope::SEHExceptScope; } in isSEHExceptScope()
432 /// \brief Returns if rhs has a higher scope depth than this.
436 bool Contains(const Scope& rhs) const { return Depth < rhs.Depth; } in Contains()
438 /// containedInPrototypeScope - Return true if this or a parent scope
472 /// Init - This is used by the parser to implement scope caching.
474 void Init(Scope *parent, unsigned flags);
476 /// \brief Sets up the specified scope flags and adjusts the scope state