17 #include "llvm/Support/raw_ostream.h"
19 using namespace clang;
25 if (parent && !(flags &
FnScope)) {
26 BreakParent = parent->BreakParent;
27 ContinueParent = parent->ContinueParent;
31 BreakParent = ContinueParent =
nullptr;
35 Depth = parent->Depth + 1;
36 PrototypeDepth = parent->PrototypeDepth;
38 FnParent = parent->FnParent;
39 BlockParent = parent->BlockParent;
40 TemplateParamParent = parent->TemplateParamParent;
41 MSLastManglingParent = parent->MSLastManglingParent;
51 MSLastManglingParent = FnParent = BlockParent =
nullptr;
52 TemplateParamParent =
nullptr;
53 MSLastManglingNumber = 1;
54 MSCurManglingNumber = 1;
58 if (flags & FnScope) FnParent =
this;
63 MSLastManglingParent =
this;
64 MSCurManglingNumber = 1;
75 if (flags & FunctionPrototypeScope)
88 UsingDirectives.clear();
91 NRVO.setPointerAndInt(
nullptr, 0);
106 "Unsupported scope flags");
108 assert((Flags & BreakScope) == 0 &&
"Already set");
112 assert((Flags & ContinueScope) == 0 &&
"Already set");
113 ContinueParent =
this;
119 if (
VarDecl *Candidate = NRVO.getPointer()) {
121 Candidate->setNRVOVariable(
true);
129 else if (NRVO.getPointer())
137 bool HasFlags = Flags != 0;
148 Flags &= ~BreakScope;
150 OS <<
"ContinueScope";
151 Flags &= ~ContinueScope;
156 OS <<
"ControlScope";
157 Flags &= ~ControlScope;
160 Flags &= ~ClassScope;
163 Flags &= ~BlockScope;
165 OS <<
"TemplateParamScope";
166 Flags &= ~TemplateParamScope;
168 OS <<
"FunctionPrototypeScope";
169 Flags &= ~FunctionPrototypeScope;
171 OS <<
"FunctionDeclarationScope";
172 Flags &= ~FunctionDeclarationScope;
174 OS <<
"AtCatchScope";
175 Flags &= ~AtCatchScope;
177 OS <<
"ObjCMethodScope";
178 Flags &= ~ObjCMethodScope;
181 Flags &= ~SwitchScope;
186 OS <<
"FnTryCatchScope";
187 Flags &= ~FnTryCatchScope;
190 Flags &= ~SEHTryScope;
192 OS <<
"SEHExceptScope";
193 Flags &= ~SEHExceptScope;
195 OS <<
"OpenMPDirectiveScope";
196 Flags &= ~OpenMPDirectiveScope;
198 OS <<
"OpenMPLoopDirectiveScope";
199 Flags &= ~OpenMPLoopDirectiveScope;
201 OS <<
"OpenMPSimdDirectiveScope";
202 Flags &= ~OpenMPSimdDirectiveScope;
212 OS <<
"Parent: (clang::Scope*)" << Parent <<
'\n';
214 OS <<
"Depth: " << Depth <<
'\n';
218 OS <<
"Entity : (clang::DeclContext*)" << DC <<
'\n';
221 OS <<
"NRVO not allowed\n";
222 else if (NRVO.getPointer())
223 OS <<
"NRVO candidate : (clang::VarDecl*)" << NRVO.getPointer() <<
'\n';
void AddFlags(unsigned Flags)
Sets up the specified scope flags and adjusts the scope state variables accordingly.
unsigned getFlags() const
This is the scope of a C++ try statement.
This is a scope that corresponds to the parameters within a function prototype.
const Scope * getParent() const
This is a while, do, switch, for, etc that can have break statements embedded into it...
This indicates that the scope corresponds to a function, which means that labels are set here...
The controlling scope in a if/switch/while/for statement.
This is a scope that corresponds to a block/closure object. Blocks serve as top-level scopes for some...
This scope corresponds to an enum.
This is a scope that corresponds to a switch statement.
This is a while, do, for, which can have continue statements embedded into it.
void incrementMSManglingNumber()
unsigned getMSLastManglingNumber() const
bool isDeclScope(Decl *D)
This is the scope of OpenMP executable directive.
This scope corresponds to an SEH try.
This scope corresponds to an SEH except.
This is a scope that corresponds to the parameters within a function prototype for a function declara...
DeclContext * getEntity() const
bool containedInPrototypeScope() const
This is a scope that corresponds to the Objective-C @catch statement.
void reset()
Set to initial state of "no errors occurred".
void dumpImpl(raw_ostream &OS) const
void Init(Scope *parent, unsigned flags)
The scope of a struct/union/class definition.
unsigned getMSCurManglingNumber() const
This is the scope of some OpenMP simd directive. For example, it is used for 'omp simd'...
void addNRVOCandidate(VarDecl *VD)
This is a scope that corresponds to the template parameters of a C++ template. Template parameter sco...
void mergeNRVOIntoParent()
This is the scope for a function-level C++ try or catch scope.
This is a scope that can contain a declaration. Some scopes just contain loop constructs but don't co...
bool isFunctionPrototypeScope() const
bool isClassScope() const
isClassScope - Return true if this scope is a class/struct/union scope.
This is the scope of some OpenMP loop directive.
This scope corresponds to an Objective-C method body. It always has FnScope and DeclScope set as well...