16#include "llvm/Support/raw_ostream.h" 
   20void Scope::setFlags(
Scope *parent, 
unsigned flags) {
 
   24  if (parent && !(flags & 
FnScope)) {
 
   25    BreakParent    = parent->BreakParent;
 
   26    ContinueParent = parent->ContinueParent;
 
   30    BreakParent = ContinueParent = 
nullptr;
 
   34    Depth = parent->Depth + 1;
 
   35    PrototypeDepth = parent->PrototypeDepth;
 
   37    FnParent       = parent->FnParent;
 
   38    BlockParent    = parent->BlockParent;
 
   39    TemplateParamParent = parent->TemplateParamParent;
 
   40    DeclParent = parent->DeclParent;
 
   41    MSLastManglingParent = parent->MSLastManglingParent;
 
   54    MSLastManglingParent = FnParent = BlockParent = 
nullptr;
 
   55    TemplateParamParent = 
nullptr;
 
   57    MSLastManglingNumber = 1;
 
   58    MSCurManglingNumber = 1;
 
   62  if (flags & 
FnScope)            FnParent = 
this;
 
   67    MSLastManglingParent = 
this;
 
   68    MSCurManglingNumber = 1;
 
   96  setFlags(parent, flags);
 
   99  UsingDirectives.clear();
 
  102  PrecedingLabel = 
nullptr;
 
 
  107  const Scope *S = 
this;
 
 
  118         "Unsupported scope flags");
 
  120    assert((Flags & 
BreakScope) == 0 && 
"Already set");
 
  125    ContinueParent = 
this;
 
 
  138  auto UpdateReturnSlotsInScopeForVD = [VD](
Scope *S) -> 
bool {
 
  139    bool IsReturnSlotFound = S->ReturnSlots.contains(VD);
 
  144    S->ReturnSlots.clear();
 
  146    if (IsReturnSlotFound)
 
  147      S->ReturnSlots.insert(VD);
 
  149    return IsReturnSlotFound;
 
  152  bool CanBePutInReturnSlot = 
false;
 
  154  for (
auto *S = 
this; S; S = S->getParent()) {
 
  155    CanBePutInReturnSlot |= UpdateReturnSlotsInScopeForVD(S);
 
  163  NRVO = CanBePutInReturnSlot ? VD : 
nullptr;
 
 
  168  if (!NRVO.has_value())
 
 
  201  bool HasFlags = Flags != 0;
 
  206  std::pair<unsigned, const char *> FlagInfo[] = {
 
  241  for (
auto Info : FlagInfo) {
 
  242    if (Flags & Info.first) {
 
  244      Flags &= ~Info.first;
 
  250  assert(Flags == 0 && 
"Unknown scope flags");
 
  256    OS << 
"Parent: (clang::Scope*)" << Parent << 
'\n';
 
  258  OS << 
"Depth: " << Depth << 
'\n';
 
  262    OS << 
"Entity : (clang::DeclContext*)" << DC << 
'\n';
 
  265    OS << 
"there is no NRVO candidate\n";
 
  267    OS << 
"NRVO candidate : (clang::VarDecl*)" << *NRVO << 
'\n';
 
  269    OS << 
"NRVO is not allowed\n";
 
 
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
 
Scope - A scope is a transient data structure that is used while parsing the program.
 
void Init(Scope *parent, unsigned flags)
Init - This is used by the parser to implement scope caching.
 
void AddFlags(unsigned Flags)
Sets up the specified scope flags and adjusts the scope state variables accordingly.
 
bool isClassScope() const
isClassScope - Return true if this scope is a class/struct/union scope.
 
void incrementMSManglingNumber()
 
unsigned getFlags() const
getFlags - Return the flags for this scope.
 
Scope(Scope *Parent, unsigned ScopeFlags, DiagnosticsEngine &Diag)
 
bool isDeclScope(const Decl *D) const
isDeclScope - Return true if this is the scope that the specified decl is declared in.
 
unsigned getMSLastManglingNumber() const
 
DeclContext * getEntity() const
Get the entity corresponding to this scope.
 
unsigned getMSCurManglingNumber() const
 
bool containedInPrototypeScope() const
containedInPrototypeScope - Return true if this or a parent scope is a FunctionPrototypeScope.
 
const Scope * getParent() const
getParent - Return the scope that this is nested in.
 
bool isFunctionPrototypeScope() const
isFunctionPrototypeScope - Return true if this scope is a function prototype scope.
 
void updateNRVOCandidate(VarDecl *VD)
 
void dumpImpl(raw_ostream &OS) const
 
@ OpenMPDirectiveScope
This is the scope of OpenMP executable directive.
 
@ FunctionPrototypeScope
This is a scope that corresponds to the parameters within a function prototype.
 
@ OpenMPOrderClauseScope
This is a scope of some OpenMP directive with order clause which specifies concurrent.
 
@ LambdaScope
This is the scope for a lambda, after the lambda introducer.
 
@ OpenACCLoopConstructScope
This is the scope of an OpenACC Loop/Combined construct, which is used to determine whether a 'cache'...
 
@ BlockScope
This is a scope that corresponds to a block/closure object.
 
@ SEHTryScope
This scope corresponds to an SEH try.
 
@ FriendScope
This is a scope of friend declaration.
 
@ ContinueScope
This is a while, do, for, which can have continue statements embedded into it.
 
@ OpenACCComputeConstructScope
This is the scope of an OpenACC Compute Construct, which restricts jumping into/out of it.
 
@ TypeAliasScope
This is a scope of type alias declaration.
 
@ ControlScope
The controlling scope in a if/switch/while/for statement.
 
@ ClassInheritanceScope
We are between inheritance colon and the real class/struct definition scope.
 
@ AtCatchScope
This is a scope that corresponds to the Objective-C @catch statement.
 
@ TemplateParamScope
This is a scope that corresponds to the template parameters of a C++ template.
 
@ SEHFilterScope
We are currently in the filter expression of an SEH except block.
 
@ SwitchScope
This is a scope that corresponds to a switch statement.
 
@ BreakScope
This is a while, do, switch, for, etc that can have break statements embedded into it.
 
@ CatchScope
This is the scope of a C++ catch statement.
 
@ CompoundStmtScope
This is a compound statement scope.
 
@ FnTryCatchScope
This is the scope for a function-level C++ try or catch scope.
 
@ SEHExceptScope
This scope corresponds to an SEH except.
 
@ ClassScope
The scope of a struct/union/class definition.
 
@ TryScope
This is the scope of a C++ try statement.
 
@ OpenMPSimdDirectiveScope
This is the scope of some OpenMP simd directive.
 
@ FunctionDeclarationScope
This is a scope that corresponds to the parameters within a function prototype for a function declara...
 
@ ConditionVarScope
This is a scope in which a condition variable is currently being parsed.
 
@ FnScope
This indicates that the scope corresponds to a function, which means that labels are set here.
 
@ ObjCMethodScope
This scope corresponds to an Objective-C method body.
 
@ EnumScope
This scope corresponds to an enum.
 
@ OpenMPLoopDirectiveScope
This is the scope of some OpenMP loop directive.
 
@ DeclScope
This is a scope that can contain a declaration.
 
Represents a variable declaration or definition.
 
void setNRVOVariable(bool NRVO)
 
The JSON file list parser is used to communicate input to InstallAPI.