Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:01

0001 //===- Scope.h - Scope interface --------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the Scope interface.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_SEMA_SCOPE_H
0014 #define LLVM_CLANG_SEMA_SCOPE_H
0015 
0016 #include "clang/AST/Decl.h"
0017 #include "clang/Basic/Diagnostic.h"
0018 #include "llvm/ADT/PointerIntPair.h"
0019 #include "llvm/ADT/SmallPtrSet.h"
0020 #include "llvm/ADT/SmallVector.h"
0021 #include "llvm/ADT/iterator_range.h"
0022 #include <cassert>
0023 #include <optional>
0024 
0025 namespace llvm {
0026 
0027 class raw_ostream;
0028 
0029 } // namespace llvm
0030 
0031 namespace clang {
0032 
0033 class Decl;
0034 class DeclContext;
0035 class UsingDirectiveDecl;
0036 class VarDecl;
0037 
0038 /// Scope - A scope is a transient data structure that is used while parsing the
0039 /// program.  It assists with resolving identifiers to the appropriate
0040 /// declaration.
0041 class Scope {
0042 public:
0043   /// ScopeFlags - These are bitfields that are or'd together when creating a
0044   /// scope, which defines the sorts of things the scope contains.
0045   enum ScopeFlags {
0046     // A bitfield value representing no scopes.
0047     NoScope = 0,
0048 
0049     /// This indicates that the scope corresponds to a function, which
0050     /// means that labels are set here.
0051     FnScope = 0x01,
0052 
0053     /// This is a while, do, switch, for, etc that can have break
0054     /// statements embedded into it.
0055     BreakScope = 0x02,
0056 
0057     /// This is a while, do, for, which can have continue statements
0058     /// embedded into it.
0059     ContinueScope = 0x04,
0060 
0061     /// This is a scope that can contain a declaration.  Some scopes
0062     /// just contain loop constructs but don't contain decls.
0063     DeclScope = 0x08,
0064 
0065     /// The controlling scope in a if/switch/while/for statement.
0066     ControlScope = 0x10,
0067 
0068     /// The scope of a struct/union/class definition.
0069     ClassScope = 0x20,
0070 
0071     /// This is a scope that corresponds to a block/closure object.
0072     /// Blocks serve as top-level scopes for some objects like labels, they
0073     /// also prevent things like break and continue.  BlockScopes always have
0074     /// the FnScope and DeclScope flags set as well.
0075     BlockScope = 0x40,
0076 
0077     /// This is a scope that corresponds to the
0078     /// template parameters of a C++ template. Template parameter
0079     /// scope starts at the 'template' keyword and ends when the
0080     /// template declaration ends.
0081     TemplateParamScope = 0x80,
0082 
0083     /// This is a scope that corresponds to the
0084     /// parameters within a function prototype.
0085     FunctionPrototypeScope = 0x100,
0086 
0087     /// This is a scope that corresponds to the parameters within
0088     /// a function prototype for a function declaration (as opposed to any
0089     /// other kind of function declarator). Always has FunctionPrototypeScope
0090     /// set as well.
0091     FunctionDeclarationScope = 0x200,
0092 
0093     /// This is a scope that corresponds to the Objective-C
0094     /// \@catch statement.
0095     AtCatchScope = 0x400,
0096 
0097     /// This scope corresponds to an Objective-C method body.
0098     /// It always has FnScope and DeclScope set as well.
0099     ObjCMethodScope = 0x800,
0100 
0101     /// This is a scope that corresponds to a switch statement.
0102     SwitchScope = 0x1000,
0103 
0104     /// This is the scope of a C++ try statement.
0105     TryScope = 0x2000,
0106 
0107     /// This is the scope for a function-level C++ try or catch scope.
0108     FnTryCatchScope = 0x4000,
0109 
0110     /// This is the scope of OpenMP executable directive.
0111     OpenMPDirectiveScope = 0x8000,
0112 
0113     /// This is the scope of some OpenMP loop directive.
0114     OpenMPLoopDirectiveScope = 0x10000,
0115 
0116     /// This is the scope of some OpenMP simd directive.
0117     /// For example, it is used for 'omp simd', 'omp for simd'.
0118     /// This flag is propagated to children scopes.
0119     OpenMPSimdDirectiveScope = 0x20000,
0120 
0121     /// This scope corresponds to an enum.
0122     EnumScope = 0x40000,
0123 
0124     /// This scope corresponds to an SEH try.
0125     SEHTryScope = 0x80000,
0126 
0127     /// This scope corresponds to an SEH except.
0128     SEHExceptScope = 0x100000,
0129 
0130     /// We are currently in the filter expression of an SEH except block.
0131     SEHFilterScope = 0x200000,
0132 
0133     /// This is a compound statement scope.
0134     CompoundStmtScope = 0x400000,
0135 
0136     /// We are between inheritance colon and the real class/struct definition
0137     /// scope.
0138     ClassInheritanceScope = 0x800000,
0139 
0140     /// This is the scope of a C++ catch statement.
0141     CatchScope = 0x1000000,
0142 
0143     /// This is a scope in which a condition variable is currently being
0144     /// parsed. If such a scope is a ContinueScope, it's invalid to jump to the
0145     /// continue block from here.
0146     ConditionVarScope = 0x2000000,
0147 
0148     /// This is a scope of some OpenMP directive with
0149     /// order clause which specifies concurrent
0150     OpenMPOrderClauseScope = 0x4000000,
0151     /// This is the scope for a lambda, after the lambda introducer.
0152     /// Lambdas need two FunctionPrototypeScope scopes (because there is a
0153     /// template scope in between), the outer scope does not increase the
0154     /// depth of recursion.
0155     LambdaScope = 0x8000000,
0156     /// This is the scope of an OpenACC Compute Construct, which restricts
0157     /// jumping into/out of it. We also use this to represent 'combined'
0158     /// constructs, since they have the same behavior.
0159     OpenACCComputeConstructScope = 0x10000000,
0160 
0161     /// This is a scope of type alias declaration.
0162     TypeAliasScope = 0x20000000,
0163 
0164     /// This is a scope of friend declaration.
0165     FriendScope = 0x40000000,
0166   };
0167 
0168 private:
0169   /// The parent scope for this scope.  This is null for the translation-unit
0170   /// scope.
0171   Scope *AnyParent;
0172 
0173   /// Flags - This contains a set of ScopeFlags, which indicates how the scope
0174   /// interrelates with other control flow statements.
0175   unsigned Flags;
0176 
0177   /// Depth - This is the depth of this scope.  The translation-unit scope has
0178   /// depth 0.
0179   unsigned short Depth;
0180 
0181   /// Declarations with static linkage are mangled with the number of
0182   /// scopes seen as a component.
0183   unsigned short MSLastManglingNumber;
0184 
0185   unsigned short MSCurManglingNumber;
0186 
0187   /// PrototypeDepth - This is the number of function prototype scopes
0188   /// enclosing this scope, including this scope.
0189   unsigned short PrototypeDepth;
0190 
0191   /// PrototypeIndex - This is the number of parameters currently
0192   /// declared in this scope.
0193   unsigned short PrototypeIndex;
0194 
0195   /// FnParent - If this scope has a parent scope that is a function body, this
0196   /// pointer is non-null and points to it.  This is used for label processing.
0197   Scope *FnParent;
0198   Scope *MSLastManglingParent;
0199 
0200   /// BreakParent/ContinueParent - This is a direct link to the innermost
0201   /// BreakScope/ContinueScope which contains the contents of this scope
0202   /// for control flow purposes (and might be this scope itself), or null
0203   /// if there is no such scope.
0204   Scope *BreakParent, *ContinueParent;
0205 
0206   /// BlockParent - This is a direct link to the immediately containing
0207   /// BlockScope if this scope is not one, or null if there is none.
0208   Scope *BlockParent;
0209 
0210   /// TemplateParamParent - This is a direct link to the
0211   /// immediately containing template parameter scope. In the
0212   /// case of nested templates, template parameter scopes can have
0213   /// other template parameter scopes as parents.
0214   Scope *TemplateParamParent;
0215 
0216   /// DeclScopeParent - This is a direct link to the immediately containing
0217   /// DeclScope, i.e. scope which can contain declarations.
0218   Scope *DeclParent;
0219 
0220   /// DeclsInScope - This keeps track of all declarations in this scope.  When
0221   /// the declaration is added to the scope, it is set as the current
0222   /// declaration for the identifier in the IdentifierTable.  When the scope is
0223   /// popped, these declarations are removed from the IdentifierTable's notion
0224   /// of current declaration.  It is up to the current Action implementation to
0225   /// implement these semantics.
0226   using DeclSetTy = llvm::SmallPtrSet<Decl *, 32>;
0227   DeclSetTy DeclsInScope;
0228 
0229   /// The DeclContext with which this scope is associated. For
0230   /// example, the entity of a class scope is the class itself, the
0231   /// entity of a function scope is a function, etc.
0232   DeclContext *Entity;
0233 
0234   using UsingDirectivesTy = SmallVector<UsingDirectiveDecl *, 2>;
0235   UsingDirectivesTy UsingDirectives;
0236 
0237   /// Used to determine if errors occurred in this scope.
0238   DiagnosticErrorTrap ErrorTrap;
0239 
0240   /// A single NRVO candidate variable in this scope.
0241   /// There are three possible values:
0242   ///  1) pointer to VarDecl that denotes NRVO candidate itself.
0243   ///  2) nullptr value means that NRVO is not allowed in this scope
0244   ///     (e.g. return a function parameter).
0245   ///  3) std::nullopt value means that there is no NRVO candidate in this scope
0246   ///     (i.e. there are no return statements in this scope).
0247   std::optional<VarDecl *> NRVO;
0248 
0249   /// Represents return slots for NRVO candidates in the current scope.
0250   /// If a variable is present in this set, it means that a return slot is
0251   /// available for this variable in the current scope.
0252   llvm::SmallPtrSet<VarDecl *, 8> ReturnSlots;
0253 
0254   void setFlags(Scope *Parent, unsigned F);
0255 
0256 public:
0257   Scope(Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag)
0258       : ErrorTrap(Diag) {
0259     Init(Parent, ScopeFlags);
0260   }
0261 
0262   /// getFlags - Return the flags for this scope.
0263   unsigned getFlags() const { return Flags; }
0264 
0265   void setFlags(unsigned F) { setFlags(getParent(), F); }
0266 
0267   /// isBlockScope - Return true if this scope correspond to a closure.
0268   bool isBlockScope() const { return Flags & BlockScope; }
0269 
0270   /// getParent - Return the scope that this is nested in.
0271   const Scope *getParent() const { return AnyParent; }
0272   Scope *getParent() { return AnyParent; }
0273 
0274   /// getFnParent - Return the closest scope that is a function body.
0275   const Scope *getFnParent() const { return FnParent; }
0276   Scope *getFnParent() { return FnParent; }
0277 
0278   const Scope *getMSLastManglingParent() const {
0279     return MSLastManglingParent;
0280   }
0281   Scope *getMSLastManglingParent() { return MSLastManglingParent; }
0282 
0283   /// getContinueParent - Return the closest scope that a continue statement
0284   /// would be affected by.
0285   Scope *getContinueParent() {
0286     return ContinueParent;
0287   }
0288 
0289   const Scope *getContinueParent() const {
0290     return const_cast<Scope*>(this)->getContinueParent();
0291   }
0292 
0293   // Set whether we're in the scope of a condition variable, where 'continue'
0294   // is disallowed despite being a continue scope.
0295   void setIsConditionVarScope(bool InConditionVarScope) {
0296     Flags = (Flags & ~ConditionVarScope) |
0297             (InConditionVarScope ? ConditionVarScope : 0);
0298   }
0299 
0300   bool isConditionVarScope() const {
0301     return Flags & ConditionVarScope;
0302   }
0303 
0304   /// getBreakParent - Return the closest scope that a break statement
0305   /// would be affected by.
0306   Scope *getBreakParent() {
0307     return BreakParent;
0308   }
0309   const Scope *getBreakParent() const {
0310     return const_cast<Scope*>(this)->getBreakParent();
0311   }
0312 
0313   Scope *getBlockParent() { return BlockParent; }
0314   const Scope *getBlockParent() const { return BlockParent; }
0315 
0316   Scope *getTemplateParamParent() { return TemplateParamParent; }
0317   const Scope *getTemplateParamParent() const { return TemplateParamParent; }
0318 
0319   Scope *getDeclParent() { return DeclParent; }
0320   const Scope *getDeclParent() const { return DeclParent; }
0321 
0322   /// Returns the depth of this scope. The translation-unit has scope depth 0.
0323   unsigned getDepth() const { return Depth; }
0324 
0325   /// Returns the number of function prototype scopes in this scope
0326   /// chain.
0327   unsigned getFunctionPrototypeDepth() const {
0328     return PrototypeDepth;
0329   }
0330 
0331   /// Return the number of parameters declared in this function
0332   /// prototype, increasing it by one for the next call.
0333   unsigned getNextFunctionPrototypeIndex() {
0334     assert(isFunctionPrototypeScope());
0335     return PrototypeIndex++;
0336   }
0337 
0338   using decl_range = llvm::iterator_range<DeclSetTy::iterator>;
0339 
0340   decl_range decls() const {
0341     return decl_range(DeclsInScope.begin(), DeclsInScope.end());
0342   }
0343 
0344   bool decl_empty() const { return DeclsInScope.empty(); }
0345 
0346   void AddDecl(Decl *D) {
0347     if (auto *VD = dyn_cast<VarDecl>(D))
0348       if (!isa<ParmVarDecl>(VD))
0349         ReturnSlots.insert(VD);
0350 
0351     DeclsInScope.insert(D);
0352   }
0353 
0354   void RemoveDecl(Decl *D) { DeclsInScope.erase(D); }
0355 
0356   void incrementMSManglingNumber() {
0357     if (Scope *MSLMP = getMSLastManglingParent()) {
0358       MSLMP->MSLastManglingNumber += 1;
0359       MSCurManglingNumber += 1;
0360     }
0361   }
0362 
0363   void decrementMSManglingNumber() {
0364     if (Scope *MSLMP = getMSLastManglingParent()) {
0365       MSLMP->MSLastManglingNumber -= 1;
0366       MSCurManglingNumber -= 1;
0367     }
0368   }
0369 
0370   unsigned getMSLastManglingNumber() const {
0371     if (const Scope *MSLMP = getMSLastManglingParent())
0372       return MSLMP->MSLastManglingNumber;
0373     return 1;
0374   }
0375 
0376   unsigned getMSCurManglingNumber() const {
0377     return MSCurManglingNumber;
0378   }
0379 
0380   /// isDeclScope - Return true if this is the scope that the specified decl is
0381   /// declared in.
0382   bool isDeclScope(const Decl *D) const { return DeclsInScope.contains(D); }
0383 
0384   /// Get the entity corresponding to this scope.
0385   DeclContext *getEntity() const {
0386     return isTemplateParamScope() ? nullptr : Entity;
0387   }
0388 
0389   /// Get the DeclContext in which to continue unqualified lookup after a
0390   /// lookup in this scope.
0391   DeclContext *getLookupEntity() const { return Entity; }
0392 
0393   void setEntity(DeclContext *E) {
0394     assert(!isTemplateParamScope() &&
0395            "entity associated with template param scope");
0396     Entity = E;
0397   }
0398   void setLookupEntity(DeclContext *E) { Entity = E; }
0399 
0400   /// Determine whether any unrecoverable errors have occurred within this
0401   /// scope. Note that this may return false even if the scope contains invalid
0402   /// declarations or statements, if the errors for those invalid constructs
0403   /// were suppressed because some prior invalid construct was referenced.
0404   bool hasUnrecoverableErrorOccurred() const {
0405     return ErrorTrap.hasUnrecoverableErrorOccurred();
0406   }
0407 
0408   /// isFunctionScope() - Return true if this scope is a function scope.
0409   bool isFunctionScope() const { return getFlags() & Scope::FnScope; }
0410 
0411   /// isClassScope - Return true if this scope is a class/struct/union scope.
0412   bool isClassScope() const { return getFlags() & Scope::ClassScope; }
0413 
0414   /// Determines whether this scope is between inheritance colon and the real
0415   /// class/struct definition.
0416   bool isClassInheritanceScope() const {
0417     return getFlags() & Scope::ClassInheritanceScope;
0418   }
0419 
0420   /// isInCXXInlineMethodScope - Return true if this scope is a C++ inline
0421   /// method scope or is inside one.
0422   bool isInCXXInlineMethodScope() const {
0423     if (const Scope *FnS = getFnParent()) {
0424       assert(FnS->getParent() && "TUScope not created?");
0425       return FnS->getParent()->isClassScope();
0426     }
0427     return false;
0428   }
0429 
0430   /// isInObjcMethodScope - Return true if this scope is, or is contained in, an
0431   /// Objective-C method body.  Note that this method is not constant time.
0432   bool isInObjcMethodScope() const {
0433     for (const Scope *S = this; S; S = S->getParent()) {
0434       // If this scope is an objc method scope, then we succeed.
0435       if (S->getFlags() & ObjCMethodScope)
0436         return true;
0437     }
0438     return false;
0439   }
0440 
0441   /// isInObjcMethodOuterScope - Return true if this scope is an
0442   /// Objective-C method outer most body.
0443   bool isInObjcMethodOuterScope() const {
0444     if (const Scope *S = this) {
0445       // If this scope is an objc method scope, then we succeed.
0446       if (S->getFlags() & ObjCMethodScope)
0447         return true;
0448     }
0449     return false;
0450   }
0451 
0452   /// isTemplateParamScope - Return true if this scope is a C++
0453   /// template parameter scope.
0454   bool isTemplateParamScope() const {
0455     return getFlags() & Scope::TemplateParamScope;
0456   }
0457 
0458   /// isFunctionPrototypeScope - Return true if this scope is a
0459   /// function prototype scope.
0460   bool isFunctionPrototypeScope() const {
0461     return getFlags() & Scope::FunctionPrototypeScope;
0462   }
0463 
0464   /// isFunctionDeclarationScope - Return true if this scope is a
0465   /// function prototype scope.
0466   bool isFunctionDeclarationScope() const {
0467     return getFlags() & Scope::FunctionDeclarationScope;
0468   }
0469 
0470   /// isAtCatchScope - Return true if this scope is \@catch.
0471   bool isAtCatchScope() const {
0472     return getFlags() & Scope::AtCatchScope;
0473   }
0474 
0475   /// isCatchScope - Return true if this scope is a C++ catch statement.
0476   bool isCatchScope() const { return getFlags() & Scope::CatchScope; }
0477 
0478   /// isSwitchScope - Return true if this scope is a switch scope.
0479   bool isSwitchScope() const {
0480     for (const Scope *S = this; S; S = S->getParent()) {
0481       if (S->getFlags() & Scope::SwitchScope)
0482         return true;
0483       else if (S->getFlags() & (Scope::FnScope | Scope::ClassScope |
0484                                 Scope::BlockScope | Scope::TemplateParamScope |
0485                                 Scope::FunctionPrototypeScope |
0486                                 Scope::AtCatchScope | Scope::ObjCMethodScope))
0487         return false;
0488     }
0489     return false;
0490   }
0491 
0492   /// Return true if this scope is a loop.
0493   bool isLoopScope() const {
0494     // 'switch' is the only loop that is not a 'break' scope as well, so we can
0495     // just check BreakScope and not SwitchScope.
0496     return (getFlags() & Scope::BreakScope) &&
0497            !(getFlags() & Scope::SwitchScope);
0498   }
0499 
0500   /// Determines whether this scope is the OpenMP directive scope
0501   bool isOpenMPDirectiveScope() const {
0502     return (getFlags() & Scope::OpenMPDirectiveScope);
0503   }
0504 
0505   /// Determine whether this scope is some OpenMP loop directive scope
0506   /// (for example, 'omp for', 'omp simd').
0507   bool isOpenMPLoopDirectiveScope() const {
0508     if (getFlags() & Scope::OpenMPLoopDirectiveScope) {
0509       assert(isOpenMPDirectiveScope() &&
0510              "OpenMP loop directive scope is not a directive scope");
0511       return true;
0512     }
0513     return false;
0514   }
0515 
0516   /// Determine whether this scope is (or is nested into) some OpenMP
0517   /// loop simd directive scope (for example, 'omp simd', 'omp for simd').
0518   bool isOpenMPSimdDirectiveScope() const {
0519     return getFlags() & Scope::OpenMPSimdDirectiveScope;
0520   }
0521 
0522   /// Determine whether this scope is a loop having OpenMP loop
0523   /// directive attached.
0524   bool isOpenMPLoopScope() const {
0525     const Scope *P = getParent();
0526     return P && P->isOpenMPLoopDirectiveScope();
0527   }
0528 
0529   /// Determine whether this scope is some OpenMP directive with
0530   /// order clause which specifies concurrent scope.
0531   bool isOpenMPOrderClauseScope() const {
0532     return getFlags() & Scope::OpenMPOrderClauseScope;
0533   }
0534 
0535   /// Determine whether this scope is the statement associated with an OpenACC
0536   /// Compute construct directive.
0537   bool isOpenACCComputeConstructScope() const {
0538     return getFlags() & Scope::OpenACCComputeConstructScope;
0539   }
0540 
0541   /// Determine if this scope (or its parents) are a compute construct. If the
0542   /// argument is provided, the search will stop at any of the specified scopes.
0543   /// Otherwise, it will stop only at the normal 'no longer search' scopes.
0544   bool isInOpenACCComputeConstructScope(ScopeFlags Flags = NoScope) const {
0545     for (const Scope *S = this; S; S = S->getParent()) {
0546       if (S->isOpenACCComputeConstructScope())
0547         return true;
0548 
0549       if (S->getFlags() & Flags)
0550         return false;
0551 
0552       else if (S->getFlags() &
0553                (Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
0554                 Scope::TemplateParamScope | Scope::FunctionPrototypeScope |
0555                 Scope::AtCatchScope | Scope::ObjCMethodScope))
0556         return false;
0557     }
0558     return false;
0559   }
0560 
0561   /// Determine whether this scope is a while/do/for statement, which can have
0562   /// continue statements embedded into it.
0563   bool isContinueScope() const {
0564     return getFlags() & ScopeFlags::ContinueScope;
0565   }
0566 
0567   /// Determine whether this scope is a C++ 'try' block.
0568   bool isTryScope() const { return getFlags() & Scope::TryScope; }
0569 
0570   /// Determine whether this scope is a function-level C++ try or catch scope.
0571   bool isFnTryCatchScope() const {
0572     return getFlags() & ScopeFlags::FnTryCatchScope;
0573   }
0574 
0575   /// Determine whether this scope is a SEH '__try' block.
0576   bool isSEHTryScope() const { return getFlags() & Scope::SEHTryScope; }
0577 
0578   /// Determine whether this scope is a SEH '__except' block.
0579   bool isSEHExceptScope() const { return getFlags() & Scope::SEHExceptScope; }
0580 
0581   /// Determine whether this scope is a compound statement scope.
0582   bool isCompoundStmtScope() const {
0583     return getFlags() & Scope::CompoundStmtScope;
0584   }
0585 
0586   /// Determine whether this scope is a controlling scope in a
0587   /// if/switch/while/for statement.
0588   bool isControlScope() const { return getFlags() & Scope::ControlScope; }
0589 
0590   /// Determine whether this scope is a type alias scope.
0591   bool isTypeAliasScope() const { return getFlags() & Scope::TypeAliasScope; }
0592 
0593   /// Determine whether this scope is a friend scope.
0594   bool isFriendScope() const { return getFlags() & Scope::FriendScope; }
0595 
0596   /// Returns if rhs has a higher scope depth than this.
0597   ///
0598   /// The caller is responsible for calling this only if one of the two scopes
0599   /// is an ancestor of the other.
0600   bool Contains(const Scope& rhs) const { return Depth < rhs.Depth; }
0601 
0602   /// containedInPrototypeScope - Return true if this or a parent scope
0603   /// is a FunctionPrototypeScope.
0604   bool containedInPrototypeScope() const;
0605 
0606   void PushUsingDirective(UsingDirectiveDecl *UDir) {
0607     UsingDirectives.push_back(UDir);
0608   }
0609 
0610   using using_directives_range =
0611       llvm::iterator_range<UsingDirectivesTy::iterator>;
0612 
0613   using_directives_range using_directives() {
0614     return using_directives_range(UsingDirectives.begin(),
0615                                   UsingDirectives.end());
0616   }
0617 
0618   void updateNRVOCandidate(VarDecl *VD);
0619 
0620   void applyNRVO();
0621 
0622   /// Init - This is used by the parser to implement scope caching.
0623   void Init(Scope *parent, unsigned flags);
0624 
0625   /// Sets up the specified scope flags and adjusts the scope state
0626   /// variables accordingly.
0627   void AddFlags(unsigned Flags);
0628 
0629   void dumpImpl(raw_ostream &OS) const;
0630   void dump() const;
0631 };
0632 
0633 } // namespace clang
0634 
0635 #endif // LLVM_CLANG_SEMA_SCOPE_H