clang  16.0.0git
Scope.h
Go to the documentation of this file.
1 //===- Scope.h - Scope interface --------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the Scope interface.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_SCOPE_H
14 #define LLVM_CLANG_SEMA_SCOPE_H
15 
16 #include "clang/AST/Decl.h"
17 #include "clang/Basic/Diagnostic.h"
18 #include "llvm/ADT/PointerIntPair.h"
19 #include "llvm/ADT/SmallPtrSet.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/iterator_range.h"
22 #include <cassert>
23 
24 namespace llvm {
25 
26 class raw_ostream;
27 
28 } // namespace llvm
29 
30 namespace clang {
31 
32 class Decl;
33 class DeclContext;
34 class UsingDirectiveDecl;
35 class VarDecl;
36 
37 /// Scope - A scope is a transient data structure that is used while parsing the
38 /// program. It assists with resolving identifiers to the appropriate
39 /// declaration.
40 class Scope {
41 public:
42  /// ScopeFlags - These are bitfields that are or'd together when creating a
43  /// scope, which defines the sorts of things the scope contains.
44  enum ScopeFlags {
45  /// This indicates that the scope corresponds to a function, which
46  /// means that labels are set here.
47  FnScope = 0x01,
48 
49  /// This is a while, do, switch, for, etc that can have break
50  /// statements embedded into it.
51  BreakScope = 0x02,
52 
53  /// This is a while, do, for, which can have continue statements
54  /// embedded into it.
55  ContinueScope = 0x04,
56 
57  /// This is a scope that can contain a declaration. Some scopes
58  /// just contain loop constructs but don't contain decls.
59  DeclScope = 0x08,
60 
61  /// The controlling scope in a if/switch/while/for statement.
62  ControlScope = 0x10,
63 
64  /// The scope of a struct/union/class definition.
65  ClassScope = 0x20,
66 
67  /// This is a scope that corresponds to a block/closure object.
68  /// Blocks serve as top-level scopes for some objects like labels, they
69  /// also prevent things like break and continue. BlockScopes always have
70  /// the FnScope and DeclScope flags set as well.
71  BlockScope = 0x40,
72 
73  /// This is a scope that corresponds to the
74  /// template parameters of a C++ template. Template parameter
75  /// scope starts at the 'template' keyword and ends when the
76  /// template declaration ends.
78 
79  /// This is a scope that corresponds to the
80  /// parameters within a function prototype.
82 
83  /// This is a scope that corresponds to the parameters within
84  /// a function prototype for a function declaration (as opposed to any
85  /// other kind of function declarator). Always has FunctionPrototypeScope
86  /// set as well.
88 
89  /// This is a scope that corresponds to the Objective-C
90  /// \@catch statement.
91  AtCatchScope = 0x400,
92 
93  /// This scope corresponds to an Objective-C method body.
94  /// It always has FnScope and DeclScope set as well.
95  ObjCMethodScope = 0x800,
96 
97  /// This is a scope that corresponds to a switch statement.
98  SwitchScope = 0x1000,
99 
100  /// This is the scope of a C++ try statement.
101  TryScope = 0x2000,
102 
103  /// This is the scope for a function-level C++ try or catch scope.
104  FnTryCatchScope = 0x4000,
105 
106  /// This is the scope of OpenMP executable directive.
108 
109  /// This is the scope of some OpenMP loop directive.
111 
112  /// This is the scope of some OpenMP simd directive.
113  /// For example, it is used for 'omp simd', 'omp for simd'.
114  /// This flag is propagated to children scopes.
116 
117  /// This scope corresponds to an enum.
118  EnumScope = 0x40000,
119 
120  /// This scope corresponds to an SEH try.
121  SEHTryScope = 0x80000,
122 
123  /// This scope corresponds to an SEH except.
124  SEHExceptScope = 0x100000,
125 
126  /// We are currently in the filter expression of an SEH except block.
127  SEHFilterScope = 0x200000,
128 
129  /// This is a compound statement scope.
130  CompoundStmtScope = 0x400000,
131 
132  /// We are between inheritance colon and the real class/struct definition
133  /// scope.
135 
136  /// This is the scope of a C++ catch statement.
137  CatchScope = 0x1000000,
138 
139  /// This is a scope in which a condition variable is currently being
140  /// parsed. If such a scope is a ContinueScope, it's invalid to jump to the
141  /// continue block from here.
142  ConditionVarScope = 0x2000000,
143  };
144 
145 private:
146  /// The parent scope for this scope. This is null for the translation-unit
147  /// scope.
148  Scope *AnyParent;
149 
150  /// Flags - This contains a set of ScopeFlags, which indicates how the scope
151  /// interrelates with other control flow statements.
152  unsigned Flags;
153 
154  /// Depth - This is the depth of this scope. The translation-unit scope has
155  /// depth 0.
156  unsigned short Depth;
157 
158  /// Declarations with static linkage are mangled with the number of
159  /// scopes seen as a component.
160  unsigned short MSLastManglingNumber;
161 
162  unsigned short MSCurManglingNumber;
163 
164  /// PrototypeDepth - This is the number of function prototype scopes
165  /// enclosing this scope, including this scope.
166  unsigned short PrototypeDepth;
167 
168  /// PrototypeIndex - This is the number of parameters currently
169  /// declared in this scope.
170  unsigned short PrototypeIndex;
171 
172  /// FnParent - If this scope has a parent scope that is a function body, this
173  /// pointer is non-null and points to it. This is used for label processing.
174  Scope *FnParent;
175  Scope *MSLastManglingParent;
176 
177  /// BreakParent/ContinueParent - This is a direct link to the innermost
178  /// BreakScope/ContinueScope which contains the contents of this scope
179  /// for control flow purposes (and might be this scope itself), or null
180  /// if there is no such scope.
181  Scope *BreakParent, *ContinueParent;
182 
183  /// BlockParent - This is a direct link to the immediately containing
184  /// BlockScope if this scope is not one, or null if there is none.
185  Scope *BlockParent;
186 
187  /// TemplateParamParent - This is a direct link to the
188  /// immediately containing template parameter scope. In the
189  /// case of nested templates, template parameter scopes can have
190  /// other template parameter scopes as parents.
191  Scope *TemplateParamParent;
192 
193  /// DeclsInScope - This keeps track of all declarations in this scope. When
194  /// the declaration is added to the scope, it is set as the current
195  /// declaration for the identifier in the IdentifierTable. When the scope is
196  /// popped, these declarations are removed from the IdentifierTable's notion
197  /// of current declaration. It is up to the current Action implementation to
198  /// implement these semantics.
199  using DeclSetTy = llvm::SmallPtrSet<Decl *, 32>;
200  DeclSetTy DeclsInScope;
201 
202  /// The DeclContext with which this scope is associated. For
203  /// example, the entity of a class scope is the class itself, the
204  /// entity of a function scope is a function, etc.
205  DeclContext *Entity;
206 
207  using UsingDirectivesTy = SmallVector<UsingDirectiveDecl *, 2>;
208  UsingDirectivesTy UsingDirectives;
209 
210  /// Used to determine if errors occurred in this scope.
211  DiagnosticErrorTrap ErrorTrap;
212 
213  /// A single NRVO candidate variable in this scope.
214  /// There are three possible values:
215  /// 1) pointer to VarDecl that denotes NRVO candidate itself.
216  /// 2) nullptr value means that NRVO is not allowed in this scope
217  /// (e.g. return a function parameter).
218  /// 3) None value means that there is no NRVO candidate in this scope
219  /// (i.e. there are no return statements in this scope).
220  Optional<VarDecl *> NRVO;
221 
222  /// Represents return slots for NRVO candidates in the current scope.
223  /// If a variable is present in this set, it means that a return slot is
224  /// available for this variable in the current scope.
226 
227  void setFlags(Scope *Parent, unsigned F);
228 
229 public:
231  : ErrorTrap(Diag) {
233  }
234 
235  /// getFlags - Return the flags for this scope.
236  unsigned getFlags() const { return Flags; }
237 
238  void setFlags(unsigned F) { setFlags(getParent(), F); }
239 
240  /// isBlockScope - Return true if this scope correspond to a closure.
241  bool isBlockScope() const { return Flags & BlockScope; }
242 
243  /// getParent - Return the scope that this is nested in.
244  const Scope *getParent() const { return AnyParent; }
245  Scope *getParent() { return AnyParent; }
246 
247  /// getFnParent - Return the closest scope that is a function body.
248  const Scope *getFnParent() const { return FnParent; }
249  Scope *getFnParent() { return FnParent; }
250 
252  return MSLastManglingParent;
253  }
254  Scope *getMSLastManglingParent() { return MSLastManglingParent; }
255 
256  /// getContinueParent - Return the closest scope that a continue statement
257  /// would be affected by.
259  return ContinueParent;
260  }
261 
262  const Scope *getContinueParent() const {
263  return const_cast<Scope*>(this)->getContinueParent();
264  }
265 
266  // Set whether we're in the scope of a condition variable, where 'continue'
267  // is disallowed despite being a continue scope.
268  void setIsConditionVarScope(bool InConditionVarScope) {
269  Flags = (Flags & ~ConditionVarScope) |
270  (InConditionVarScope ? ConditionVarScope : 0);
271  }
272 
273  bool isConditionVarScope() const {
274  return Flags & ConditionVarScope;
275  }
276 
277  /// getBreakParent - Return the closest scope that a break statement
278  /// would be affected by.
280  return BreakParent;
281  }
282  const Scope *getBreakParent() const {
283  return const_cast<Scope*>(this)->getBreakParent();
284  }
285 
286  Scope *getBlockParent() { return BlockParent; }
287  const Scope *getBlockParent() const { return BlockParent; }
288 
289  Scope *getTemplateParamParent() { return TemplateParamParent; }
290  const Scope *getTemplateParamParent() const { return TemplateParamParent; }
291 
292  /// Returns the depth of this scope. The translation-unit has scope depth 0.
293  unsigned getDepth() const { return Depth; }
294 
295  /// Returns the number of function prototype scopes in this scope
296  /// chain.
297  unsigned getFunctionPrototypeDepth() const {
298  return PrototypeDepth;
299  }
300 
301  /// Return the number of parameters declared in this function
302  /// prototype, increasing it by one for the next call.
304  assert(isFunctionPrototypeScope());
305  return PrototypeIndex++;
306  }
307 
308  using decl_range = llvm::iterator_range<DeclSetTy::iterator>;
309 
310  decl_range decls() const {
311  return decl_range(DeclsInScope.begin(), DeclsInScope.end());
312  }
313 
314  bool decl_empty() const { return DeclsInScope.empty(); }
315 
316  void AddDecl(Decl *D) {
317  if (auto *VD = dyn_cast<VarDecl>(D))
318  if (!isa<ParmVarDecl>(VD))
319  ReturnSlots.insert(VD);
320 
321  DeclsInScope.insert(D);
322  }
323 
324  void RemoveDecl(Decl *D) {
325  DeclsInScope.erase(D);
326  }
327 
329  if (Scope *MSLMP = getMSLastManglingParent()) {
330  MSLMP->MSLastManglingNumber += 1;
331  MSCurManglingNumber += 1;
332  }
333  }
334 
336  if (Scope *MSLMP = getMSLastManglingParent()) {
337  MSLMP->MSLastManglingNumber -= 1;
338  MSCurManglingNumber -= 1;
339  }
340  }
341 
342  unsigned getMSLastManglingNumber() const {
343  if (const Scope *MSLMP = getMSLastManglingParent())
344  return MSLMP->MSLastManglingNumber;
345  return 1;
346  }
347 
348  unsigned getMSCurManglingNumber() const {
349  return MSCurManglingNumber;
350  }
351 
352  /// isDeclScope - Return true if this is the scope that the specified decl is
353  /// declared in.
354  bool isDeclScope(const Decl *D) const { return DeclsInScope.contains(D); }
355 
356  /// Get the entity corresponding to this scope.
358  return isTemplateParamScope() ? nullptr : Entity;
359  }
360 
361  /// Get the DeclContext in which to continue unqualified lookup after a
362  /// lookup in this scope.
363  DeclContext *getLookupEntity() const { return Entity; }
364 
366  assert(!isTemplateParamScope() &&
367  "entity associated with template param scope");
368  Entity = E;
369  }
370  void setLookupEntity(DeclContext *E) { Entity = E; }
371 
372  /// Determine whether any unrecoverable errors have occurred within this
373  /// scope. Note that this may return false even if the scope contains invalid
374  /// declarations or statements, if the errors for those invalid constructs
375  /// were suppressed because some prior invalid construct was referenced.
377  return ErrorTrap.hasUnrecoverableErrorOccurred();
378  }
379 
380  /// isFunctionScope() - Return true if this scope is a function scope.
381  bool isFunctionScope() const { return getFlags() & Scope::FnScope; }
382 
383  /// isClassScope - Return true if this scope is a class/struct/union scope.
384  bool isClassScope() const { return getFlags() & Scope::ClassScope; }
385 
386  /// Determines whether this scope is between inheritance colon and the real
387  /// class/struct definition.
388  bool isClassInheritanceScope() const {
390  }
391 
392  /// isInCXXInlineMethodScope - Return true if this scope is a C++ inline
393  /// method scope or is inside one.
395  if (const Scope *FnS = getFnParent()) {
396  assert(FnS->getParent() && "TUScope not created?");
397  return FnS->getParent()->isClassScope();
398  }
399  return false;
400  }
401 
402  /// isInObjcMethodScope - Return true if this scope is, or is contained in, an
403  /// Objective-C method body. Note that this method is not constant time.
404  bool isInObjcMethodScope() const {
405  for (const Scope *S = this; S; S = S->getParent()) {
406  // If this scope is an objc method scope, then we succeed.
407  if (S->getFlags() & ObjCMethodScope)
408  return true;
409  }
410  return false;
411  }
412 
413  /// isInObjcMethodOuterScope - Return true if this scope is an
414  /// Objective-C method outer most body.
416  if (const Scope *S = this) {
417  // If this scope is an objc method scope, then we succeed.
418  if (S->getFlags() & ObjCMethodScope)
419  return true;
420  }
421  return false;
422  }
423 
424  /// isTemplateParamScope - Return true if this scope is a C++
425  /// template parameter scope.
426  bool isTemplateParamScope() const {
428  }
429 
430  /// isFunctionPrototypeScope - Return true if this scope is a
431  /// function prototype scope.
434  }
435 
436  /// isFunctionDeclarationScope - Return true if this scope is a
437  /// function prototype scope.
440  }
441 
442  /// isAtCatchScope - Return true if this scope is \@catch.
443  bool isAtCatchScope() const {
444  return getFlags() & Scope::AtCatchScope;
445  }
446 
447  /// isCatchScope - Return true if this scope is a C++ catch statement.
448  bool isCatchScope() const { return getFlags() & Scope::CatchScope; }
449 
450  /// isSwitchScope - Return true if this scope is a switch scope.
451  bool isSwitchScope() const {
452  for (const Scope *S = this; S; S = S->getParent()) {
453  if (S->getFlags() & Scope::SwitchScope)
454  return true;
455  else if (S->getFlags() & (Scope::FnScope | Scope::ClassScope |
459  return false;
460  }
461  return false;
462  }
463 
464  /// Determines whether this scope is the OpenMP directive scope
465  bool isOpenMPDirectiveScope() const {
467  }
468 
469  /// Determine whether this scope is some OpenMP loop directive scope
470  /// (for example, 'omp for', 'omp simd').
473  assert(isOpenMPDirectiveScope() &&
474  "OpenMP loop directive scope is not a directive scope");
475  return true;
476  }
477  return false;
478  }
479 
480  /// Determine whether this scope is (or is nested into) some OpenMP
481  /// loop simd directive scope (for example, 'omp simd', 'omp for simd').
484  }
485 
486  /// Determine whether this scope is a loop having OpenMP loop
487  /// directive attached.
488  bool isOpenMPLoopScope() const {
489  const Scope *P = getParent();
490  return P && P->isOpenMPLoopDirectiveScope();
491  }
492 
493  /// Determine whether this scope is a while/do/for statement, which can have
494  /// continue statements embedded into it.
495  bool isContinueScope() const {
496  return getFlags() & ScopeFlags::ContinueScope;
497  }
498 
499  /// Determine whether this scope is a C++ 'try' block.
500  bool isTryScope() const { return getFlags() & Scope::TryScope; }
501 
502  /// Determine whether this scope is a function-level C++ try or catch scope.
503  bool isFnTryCatchScope() const {
504  return getFlags() & ScopeFlags::FnTryCatchScope;
505  }
506 
507  /// Determine whether this scope is a SEH '__try' block.
508  bool isSEHTryScope() const { return getFlags() & Scope::SEHTryScope; }
509 
510  /// Determine whether this scope is a SEH '__except' block.
511  bool isSEHExceptScope() const { return getFlags() & Scope::SEHExceptScope; }
512 
513  /// Determine whether this scope is a compound statement scope.
514  bool isCompoundStmtScope() const {
516  }
517 
518  /// Determine whether this scope is a controlling scope in a
519  /// if/switch/while/for statement.
520  bool isControlScope() const { return getFlags() & Scope::ControlScope; }
521 
522  /// Returns if rhs has a higher scope depth than this.
523  ///
524  /// The caller is responsible for calling this only if one of the two scopes
525  /// is an ancestor of the other.
526  bool Contains(const Scope& rhs) const { return Depth < rhs.Depth; }
527 
528  /// containedInPrototypeScope - Return true if this or a parent scope
529  /// is a FunctionPrototypeScope.
530  bool containedInPrototypeScope() const;
531 
533  UsingDirectives.push_back(UDir);
534  }
535 
536  using using_directives_range =
537  llvm::iterator_range<UsingDirectivesTy::iterator>;
538 
540  return using_directives_range(UsingDirectives.begin(),
541  UsingDirectives.end());
542  }
543 
544  void updateNRVOCandidate(VarDecl *VD);
545 
546  void applyNRVO();
547 
548  /// Init - This is used by the parser to implement scope caching.
549  void Init(Scope *parent, unsigned flags);
550 
551  /// Sets up the specified scope flags and adjusts the scope state
552  /// variables accordingly.
553  void AddFlags(unsigned Flags);
554 
555  void dumpImpl(raw_ostream &OS) const;
556  void dump() const;
557 };
558 
559 } // namespace clang
560 
561 #endif // LLVM_CLANG_SEMA_SCOPE_H
clang::Scope::isFunctionScope
bool isFunctionScope() const
isFunctionScope() - Return true if this scope is a function scope.
Definition: Scope.h:381
clang::Scope::applyNRVO
void applyNRVO()
Definition: Scope.cpp:157
clang::Scope::getFnParent
const Scope * getFnParent() const
getFnParent - Return the closest scope that is a function body.
Definition: Scope.h:248
clang::Scope::setFlags
void setFlags(unsigned F)
Definition: Scope.h:238
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::Scope::isClassScope
bool isClassScope() const
isClassScope - Return true if this scope is a class/struct/union scope.
Definition: Scope.h:384
clang::Scope::FunctionPrototypeScope
@ FunctionPrototypeScope
This is a scope that corresponds to the parameters within a function prototype.
Definition: Scope.h:81
clang::Scope::isOpenMPLoopDirectiveScope
bool isOpenMPLoopDirectiveScope() const
Determine whether this scope is some OpenMP loop directive scope (for example, 'omp for',...
Definition: Scope.h:471
clang::Scope::updateNRVOCandidate
void updateNRVOCandidate(VarDecl *VD)
Definition: Scope.cpp:128
clang::Scope::FnScope
@ FnScope
This indicates that the scope corresponds to a function, which means that labels are set here.
Definition: Scope.h:47
clang::Scope::getBlockParent
Scope * getBlockParent()
Definition: Scope.h:286
clang::DeclContext
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1389
Diag
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Definition: LiteralSupport.cpp:79
clang::Scope::OpenMPLoopDirectiveScope
@ OpenMPLoopDirectiveScope
This is the scope of some OpenMP loop directive.
Definition: Scope.h:110
clang::UsingDirectiveDecl
Represents C++ using-directive.
Definition: DeclCXX.h:2917
llvm::SmallVector< UsingDirectiveDecl *, 2 >
clang::Scope::isFnTryCatchScope
bool isFnTryCatchScope() const
Determine whether this scope is a function-level C++ try or catch scope.
Definition: Scope.h:503
clang::Scope::BlockScope
@ BlockScope
This is a scope that corresponds to a block/closure object.
Definition: Scope.h:71
clang::DiagnosticsEngine
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:192
clang::Scope::isInObjcMethodOuterScope
bool isInObjcMethodOuterScope() const
isInObjcMethodOuterScope - Return true if this scope is an Objective-C method outer most body.
Definition: Scope.h:415
clang::Scope::getMSCurManglingNumber
unsigned getMSCurManglingNumber() const
Definition: Scope.h:348
clang::Scope::isCompoundStmtScope
bool isCompoundStmtScope() const
Determine whether this scope is a compound statement scope.
Definition: Scope.h:514
llvm::Optional
Definition: LLVM.h:40
clang::Scope::setIsConditionVarScope
void setIsConditionVarScope(bool InConditionVarScope)
Definition: Scope.h:268
clang::Scope::isSwitchScope
bool isSwitchScope() const
isSwitchScope - Return true if this scope is a switch scope.
Definition: Scope.h:451
llvm::SmallPtrSet< Decl *, 32 >
clang::Scope::AddDecl
void AddDecl(Decl *D)
Definition: Scope.h:316
clang::DiagnosticErrorTrap::hasUnrecoverableErrorOccurred
bool hasUnrecoverableErrorOccurred() const
Determine whether any unrecoverable errors have occurred since this object instance was created.
Definition: Diagnostic.h:1089
clang::Scope::getDepth
unsigned getDepth() const
Returns the depth of this scope. The translation-unit has scope depth 0.
Definition: Scope.h:293
clang::Scope::ConditionVarScope
@ ConditionVarScope
This is a scope in which a condition variable is currently being parsed.
Definition: Scope.h:142
clang::Scope::SwitchScope
@ SwitchScope
This is a scope that corresponds to a switch statement.
Definition: Scope.h:98
clang::Scope::setLookupEntity
void setLookupEntity(DeclContext *E)
Definition: Scope.h:370
clang::DiagnosticErrorTrap
RAII class that determines when any errors have occurred between the time the instance was created an...
Definition: Diagnostic.h:1072
clang::Scope::containedInPrototypeScope
bool containedInPrototypeScope() const
containedInPrototypeScope - Return true if this or a parent scope is a FunctionPrototypeScope.
Definition: Scope.cpp:97
clang::Scope::getParent
const Scope * getParent() const
getParent - Return the scope that this is nested in.
Definition: Scope.h:244
clang::Scope::isFunctionPrototypeScope
bool isFunctionPrototypeScope() const
isFunctionPrototypeScope - Return true if this scope is a function prototype scope.
Definition: Scope.h:432
Decl.h
clang::Scope::decls
decl_range decls() const
Definition: Scope.h:310
clang::CodeGen::AlignmentSource::Decl
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::Scope::OpenMPDirectiveScope
@ OpenMPDirectiveScope
This is the scope of OpenMP executable directive.
Definition: Scope.h:107
clang::Scope::SEHTryScope
@ SEHTryScope
This scope corresponds to an SEH try.
Definition: Scope.h:121
clang::Scope::decrementMSManglingNumber
void decrementMSManglingNumber()
Definition: Scope.h:335
clang::Scope::getMSLastManglingParent
const Scope * getMSLastManglingParent() const
Definition: Scope.h:251
clang::Scope::getTemplateParamParent
Scope * getTemplateParamParent()
Definition: Scope.h:289
clang::Scope
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:40
clang::Scope::isOpenMPDirectiveScope
bool isOpenMPDirectiveScope() const
Determines whether this scope is the OpenMP directive scope.
Definition: Scope.h:465
clang::Scope::isDeclScope
bool isDeclScope(const Decl *D) const
isDeclScope - Return true if this is the scope that the specified decl is declared in.
Definition: Scope.h:354
clang::Scope::dumpImpl
void dumpImpl(raw_ostream &OS) const
Definition: Scope.cpp:190
Diagnostic.h
clang::Scope::decl_empty
bool decl_empty() const
Definition: Scope.h:314
clang::Scope::isContinueScope
bool isContinueScope() const
Determine whether this scope is a while/do/for statement, which can have continue statements embedded...
Definition: Scope.h:495
clang::Scope::getParent
Scope * getParent()
Definition: Scope.h:245
clang::Scope::Init
void Init(Scope *parent, unsigned flags)
Init - This is used by the parser to implement scope caching.
Definition: Scope.cpp:87
clang::Scope::CompoundStmtScope
@ CompoundStmtScope
This is a compound statement scope.
Definition: Scope.h:130
clang::Scope::FunctionDeclarationScope
@ FunctionDeclarationScope
This is a scope that corresponds to the parameters within a function prototype for a function declara...
Definition: Scope.h:87
clang::Scope::hasUnrecoverableErrorOccurred
bool hasUnrecoverableErrorOccurred() const
Determine whether any unrecoverable errors have occurred within this scope.
Definition: Scope.h:376
clang::Scope::Scope
Scope(Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag)
Definition: Scope.h:230
clang::Scope::isAtCatchScope
bool isAtCatchScope() const
isAtCatchScope - Return true if this scope is @catch.
Definition: Scope.h:443
clang::Scope::ContinueScope
@ ContinueScope
This is a while, do, for, which can have continue statements embedded into it.
Definition: Scope.h:55
clang::Scope::getMSLastManglingNumber
unsigned getMSLastManglingNumber() const
Definition: Scope.h:342
clang::VarDecl
Represents a variable declaration or definition.
Definition: Decl.h:879
clang::Scope::isOpenMPLoopScope
bool isOpenMPLoopScope() const
Determine whether this scope is a loop having OpenMP loop directive attached.
Definition: Scope.h:488
clang::Scope::isSEHExceptScope
bool isSEHExceptScope() const
Determine whether this scope is a SEH '__except' block.
Definition: Scope.h:511
clang::Scope::getFunctionPrototypeDepth
unsigned getFunctionPrototypeDepth() const
Returns the number of function prototype scopes in this scope chain.
Definition: Scope.h:297
clang::Scope::getLookupEntity
DeclContext * getLookupEntity() const
Get the DeclContext in which to continue unqualified lookup after a lookup in this scope.
Definition: Scope.h:363
clang::Scope::isTemplateParamScope
bool isTemplateParamScope() const
isTemplateParamScope - Return true if this scope is a C++ template parameter scope.
Definition: Scope.h:426
clang::Scope::ControlScope
@ ControlScope
The controlling scope in a if/switch/while/for statement.
Definition: Scope.h:62
clang::Scope::EnumScope
@ EnumScope
This scope corresponds to an enum.
Definition: Scope.h:118
clang::Scope::using_directives
using_directives_range using_directives()
Definition: Scope.h:539
clang::Scope::isCatchScope
bool isCatchScope() const
isCatchScope - Return true if this scope is a C++ catch statement.
Definition: Scope.h:448
clang::Scope::getTemplateParamParent
const Scope * getTemplateParamParent() const
Definition: Scope.h:290
clang::Scope::AddFlags
void AddFlags(unsigned Flags)
Sets up the specified scope flags and adjusts the scope state variables accordingly.
Definition: Scope.cpp:107
clang::Scope::incrementMSManglingNumber
void incrementMSManglingNumber()
Definition: Scope.h:328
clang::Scope::getBreakParent
const Scope * getBreakParent() const
Definition: Scope.h:282
clang::Scope::isInCXXInlineMethodScope
bool isInCXXInlineMethodScope() const
isInCXXInlineMethodScope - Return true if this scope is a C++ inline method scope or is inside one.
Definition: Scope.h:394
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::Scope::dump
void dump() const
Definition: Scope.cpp:188
clang::Scope::getFnParent
Scope * getFnParent()
Definition: Scope.h:249
clang::Scope::TemplateParamScope
@ TemplateParamScope
This is a scope that corresponds to the template parameters of a C++ template.
Definition: Scope.h:77
clang::Scope::isInObjcMethodScope
bool isInObjcMethodScope() const
isInObjcMethodScope - Return true if this scope is, or is contained in, an Objective-C method body.
Definition: Scope.h:404
clang::Scope::getBreakParent
Scope * getBreakParent()
getBreakParent - Return the closest scope that a break statement would be affected by.
Definition: Scope.h:279
clang::Scope::AtCatchScope
@ AtCatchScope
This is a scope that corresponds to the Objective-C @catch statement.
Definition: Scope.h:91
clang::Scope::decl_range
llvm::iterator_range< DeclSetTy::iterator > decl_range
Definition: Scope.h:308
clang::Scope::ClassInheritanceScope
@ ClassInheritanceScope
We are between inheritance colon and the real class/struct definition scope.
Definition: Scope.h:134
clang::Scope::ClassScope
@ ClassScope
The scope of a struct/union/class definition.
Definition: Scope.h:65
clang::Scope::getFlags
unsigned getFlags() const
getFlags - Return the flags for this scope.
Definition: Scope.h:236
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::Scope::isSEHTryScope
bool isSEHTryScope() const
Determine whether this scope is a SEH '__try' block.
Definition: Scope.h:508
clang::Scope::SEHExceptScope
@ SEHExceptScope
This scope corresponds to an SEH except.
Definition: Scope.h:124
clang::Scope::isOpenMPSimdDirectiveScope
bool isOpenMPSimdDirectiveScope() const
Determine whether this scope is (or is nested into) some OpenMP loop simd directive scope (for exampl...
Definition: Scope.h:482
clang::Scope::setEntity
void setEntity(DeclContext *E)
Definition: Scope.h:365
clang::Scope::getContinueParent
Scope * getContinueParent()
getContinueParent - Return the closest scope that a continue statement would be affected by.
Definition: Scope.h:258
clang::Scope::getNextFunctionPrototypeIndex
unsigned getNextFunctionPrototypeIndex()
Return the number of parameters declared in this function prototype, increasing it by one for the nex...
Definition: Scope.h:303
clang
Definition: CalledOnceCheck.h:17
clang::Scope::CatchScope
@ CatchScope
This is the scope of a C++ catch statement.
Definition: Scope.h:137
clang::Scope::ScopeFlags
ScopeFlags
ScopeFlags - These are bitfields that are or'd together when creating a scope, which defines the sort...
Definition: Scope.h:44
clang::Scope::getEntity
DeclContext * getEntity() const
Get the entity corresponding to this scope.
Definition: Scope.h:357
clang::Scope::getMSLastManglingParent
Scope * getMSLastManglingParent()
Definition: Scope.h:254
clang::Scope::SEHFilterScope
@ SEHFilterScope
We are currently in the filter expression of an SEH except block.
Definition: Scope.h:127
clang::Scope::isControlScope
bool isControlScope() const
Determine whether this scope is a controlling scope in a if/switch/while/for statement.
Definition: Scope.h:520
clang::Scope::getBlockParent
const Scope * getBlockParent() const
Definition: Scope.h:287
clang::Scope::RemoveDecl
void RemoveDecl(Decl *D)
Definition: Scope.h:324
clang::Scope::ObjCMethodScope
@ ObjCMethodScope
This scope corresponds to an Objective-C method body.
Definition: Scope.h:95
clang::Scope::Contains
bool Contains(const Scope &rhs) const
Returns if rhs has a higher scope depth than this.
Definition: Scope.h:526
Parent
NodeId Parent
Definition: ASTDiff.cpp:192
clang::Scope::isBlockScope
bool isBlockScope() const
isBlockScope - Return true if this scope correspond to a closure.
Definition: Scope.h:241
clang::Scope::isFunctionDeclarationScope
bool isFunctionDeclarationScope() const
isFunctionDeclarationScope - Return true if this scope is a function prototype scope.
Definition: Scope.h:438
clang::Scope::TryScope
@ TryScope
This is the scope of a C++ try statement.
Definition: Scope.h:101
clang::Scope::DeclScope
@ DeclScope
This is a scope that can contain a declaration.
Definition: Scope.h:59
clang::Scope::FnTryCatchScope
@ FnTryCatchScope
This is the scope for a function-level C++ try or catch scope.
Definition: Scope.h:104
clang::Scope::BreakScope
@ BreakScope
This is a while, do, switch, for, etc that can have break statements embedded into it.
Definition: Scope.h:51
clang::Scope::getContinueParent
const Scope * getContinueParent() const
Definition: Scope.h:262
clang::Scope::OpenMPSimdDirectiveScope
@ OpenMPSimdDirectiveScope
This is the scope of some OpenMP simd directive.
Definition: Scope.h:115
clang::Scope::isConditionVarScope
bool isConditionVarScope() const
Definition: Scope.h:273
clang::Scope::isTryScope
bool isTryScope() const
Determine whether this scope is a C++ 'try' block.
Definition: Scope.h:500
clang::Scope::PushUsingDirective
void PushUsingDirective(UsingDirectiveDecl *UDir)
Definition: Scope.h:532
clang::Scope::using_directives_range
llvm::iterator_range< UsingDirectivesTy::iterator > using_directives_range
Definition: Scope.h:537
clang::Scope::isClassInheritanceScope
bool isClassInheritanceScope() const
Determines whether this scope is between inheritance colon and the real class/struct definition.
Definition: Scope.h:388