22#include "llvm/ADT/BitVector.h"
37class JumpScopeChecker {
42 const bool Permissive;
65 GotoScope(
unsigned parentScope,
unsigned InDiag,
unsigned OutDiag,
67 : ParentScope(parentScope), InDiag(InDiag), OutDiag(OutDiag), Loc(L) {}
71 llvm::DenseMap<Stmt*, unsigned> LabelAndGotoScopes;
80 JumpScopeChecker(
Stmt *Body,
Sema &S);
82 void BuildScopeInformation(
Decl *D,
unsigned &ParentScope);
84 unsigned &ParentScope);
86 void BuildScopeInformation(
Stmt *S,
unsigned &origParentScope);
89 void VerifyIndirectOrAsmJumps(
bool IsAsmGoto);
90 void VerifyMustTailStmts();
92 void DiagnoseIndirectOrAsmJump(
Stmt *IG,
unsigned IGScope,
LabelDecl *Target,
93 unsigned TargetScope);
95 unsigned JumpDiag,
unsigned JumpDiagWarning,
96 unsigned JumpDiagCXX98Compat);
100 unsigned GetDeepestCommonScope(
unsigned A,
unsigned B);
104#define CHECK_PERMISSIVE(x) (assert(Permissive || !(x)), (Permissive && (x)))
106JumpScopeChecker::JumpScopeChecker(
Stmt *Body,
Sema &
s)
107 : S(
s), Permissive(
s.hasAnyUnrecoverableErrorsInThisFunction()) {
113 unsigned BodyParentScope = 0;
114 BuildScopeInformation(Body, BodyParentScope);
118 VerifyIndirectOrAsmJumps(
false);
119 VerifyIndirectOrAsmJumps(
true);
120 VerifyMustTailStmts();
125unsigned JumpScopeChecker::GetDeepestCommonScope(
unsigned A,
unsigned B) {
130 assert(Scopes[B].ParentScope < B);
131 B = Scopes[B].ParentScope;
133 assert(Scopes[A].ParentScope < A);
134 A = Scopes[A].ParentScope;
145 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
147 unsigned OutDiag = 0;
149 if (VD->getType()->isVariablyModifiedType())
150 InDiag = diag::note_protected_by_vla;
152 if (VD->hasAttr<BlocksAttr>())
153 return ScopePair(diag::note_protected_by___block,
154 diag::note_exits___block);
156 if (VD->hasAttr<CleanupAttr>())
157 return ScopePair(diag::note_protected_by_cleanup,
158 diag::note_exits_cleanup);
160 if (VD->hasLocalStorage()) {
161 switch (VD->getType().isDestructedType()) {
163 return ScopePair(diag::note_protected_by_objc_strong_init,
164 diag::note_exits_objc_strong);
167 return ScopePair(diag::note_protected_by_objc_weak_init,
168 diag::note_exits_objc_weak);
171 return ScopePair(diag::note_protected_by_non_trivial_c_struct_init,
172 diag::note_exits_dtor);
175 OutDiag = diag::note_exits_dtor;
183 const Expr *Init = VD->getInit();
199 InDiag = diag::note_protected_by_variable_init;
209 InDiag = diag::note_protected_by_variable_nontriv_destructor;
211 InDiag = diag::note_protected_by_variable_non_pod;
222 if (TD->getUnderlyingType()->isVariablyModifiedType())
224 ? diag::note_protected_by_vla_typedef
225 : diag::note_protected_by_vla_type_alias,
233void JumpScopeChecker::BuildScopeInformation(
Decl *D,
unsigned &ParentScope) {
236 if (Diags.first || Diags.second) {
237 Scopes.push_back(GotoScope(ParentScope, Diags.first, Diags.second,
239 ParentScope = Scopes.size()-1;
244 if (
VarDecl *VD = dyn_cast<VarDecl>(D))
245 if (
Expr *Init = VD->getInit())
246 BuildScopeInformation(Init, ParentScope);
250void JumpScopeChecker::BuildScopeInformation(
VarDecl *D,
252 unsigned &ParentScope) {
260 std::pair<unsigned,unsigned> Diags;
261 switch (destructKind) {
263 Diags =
ScopePair(diag::note_enters_block_captures_cxx_obj,
264 diag::note_exits_block_captures_cxx_obj);
267 Diags =
ScopePair(diag::note_enters_block_captures_strong,
268 diag::note_exits_block_captures_strong);
271 Diags =
ScopePair(diag::note_enters_block_captures_weak,
272 diag::note_exits_block_captures_weak);
275 Diags =
ScopePair(diag::note_enters_block_captures_non_trivial_c_struct,
276 diag::note_exits_block_captures_non_trivial_c_struct);
279 llvm_unreachable(
"non-lifetime captured variable");
284 Scopes.push_back(GotoScope(ParentScope,
285 Diags.first, Diags.second, Loc));
286 ParentScope = Scopes.size()-1;
293 unsigned &ParentScope) {
294 unsigned InDiag = diag::note_enters_compound_literal_scope;
295 unsigned OutDiag = diag::note_exits_compound_literal_scope;
296 Scopes.push_back(GotoScope(ParentScope, InDiag, OutDiag, CLE->
getExprLoc()));
297 ParentScope = Scopes.size() - 1;
304void JumpScopeChecker::BuildScopeInformation(
Stmt *S,
305 unsigned &origParentScope) {
309 unsigned independentParentScope = origParentScope;
310 unsigned &ParentScope = ((isa<Expr>(S) && !isa<StmtExpr>(S))
311 ? origParentScope : independentParentScope);
313 unsigned StmtsToSkip = 0u;
316 switch (S->getStmtClass()) {
317 case Stmt::AddrLabelExprClass:
318 IndirectJumpTargets.push_back(cast<AddrLabelExpr>(S)->getLabel());
321 case Stmt::ObjCForCollectionStmtClass: {
322 auto *CS = cast<ObjCForCollectionStmt>(S);
323 unsigned Diag = diag::note_protected_by_objc_fast_enumeration;
324 unsigned NewParentScope = Scopes.size();
325 Scopes.push_back(GotoScope(ParentScope,
Diag, 0, S->getBeginLoc()));
326 BuildScopeInformation(CS->getBody(), NewParentScope);
330 case Stmt::IndirectGotoStmtClass:
336 if (cast<IndirectGotoStmt>(S)->getConstantTarget()) {
337 LabelAndGotoScopes[S] = ParentScope;
342 LabelAndGotoScopes[S] = ParentScope;
343 IndirectJumps.push_back(S);
346 case Stmt::SwitchStmtClass:
349 if (
Stmt *Init = cast<SwitchStmt>(S)->getInit()) {
350 BuildScopeInformation(Init, ParentScope);
353 if (
VarDecl *Var = cast<SwitchStmt>(S)->getConditionVariable()) {
354 BuildScopeInformation(Var, ParentScope);
359 case Stmt::GotoStmtClass:
362 LabelAndGotoScopes[S] = ParentScope;
366 case Stmt::GCCAsmStmtClass:
367 if (
auto *GS = dyn_cast<GCCAsmStmt>(S))
368 if (GS->isAsmGoto()) {
371 LabelAndGotoScopes[S] = ParentScope;
372 AsmJumps.push_back(GS);
373 for (
auto *E : GS->labels())
374 AsmJumpTargets.push_back(E->getLabel());
378 case Stmt::IfStmtClass: {
379 IfStmt *IS = cast<IfStmt>(S);
384 unsigned Diag = diag::note_protected_by_if_available;
386 Diag = diag::note_protected_by_constexpr_if;
388 Diag = diag::note_protected_by_consteval_if;
391 BuildScopeInformation(Var, ParentScope);
394 unsigned NewParentScope = Scopes.size();
398 BuildScopeInformation(IS->
getCond(), NewParentScope);
401 NewParentScope = Scopes.size();
403 BuildScopeInformation(IS->
getThen(), NewParentScope);
405 NewParentScope = Scopes.size();
407 BuildScopeInformation(Else, NewParentScope);
412 case Stmt::CXXTryStmtClass: {
415 unsigned NewParentScope = Scopes.size();
416 Scopes.push_back(GotoScope(ParentScope,
417 diag::note_protected_by_cxx_try,
418 diag::note_exits_cxx_try,
421 BuildScopeInformation(TryBlock, NewParentScope);
427 unsigned NewParentScope = Scopes.size();
428 Scopes.push_back(GotoScope(ParentScope,
429 diag::note_protected_by_cxx_catch,
430 diag::note_exits_cxx_catch,
437 case Stmt::SEHTryStmtClass: {
440 unsigned NewParentScope = Scopes.size();
441 Scopes.push_back(GotoScope(ParentScope,
442 diag::note_protected_by_seh_try,
443 diag::note_exits_seh_try,
446 BuildScopeInformation(TryBlock, NewParentScope);
451 unsigned NewParentScope = Scopes.size();
452 Scopes.push_back(GotoScope(ParentScope,
453 diag::note_protected_by_seh_except,
454 diag::note_exits_seh_except,
455 Except->getSourceRange().getBegin()));
456 BuildScopeInformation(Except->getBlock(), NewParentScope);
458 unsigned NewParentScope = Scopes.size();
459 Scopes.push_back(GotoScope(ParentScope,
460 diag::note_protected_by_seh_finally,
461 diag::note_exits_seh_finally,
462 Finally->getSourceRange().getBegin()));
463 BuildScopeInformation(Finally->getBlock(), NewParentScope);
469 case Stmt::DeclStmtClass: {
475 for (
auto *I : DS->
decls())
476 BuildScopeInformation(I, origParentScope);
480 case Stmt::ObjCAtTryStmtClass: {
486 unsigned NewParentScope = Scopes.size();
487 Scopes.push_back(GotoScope(ParentScope,
488 diag::note_protected_by_objc_try,
489 diag::note_exits_objc_try,
492 BuildScopeInformation(TryPart, NewParentScope);
497 unsigned NewParentScope = Scopes.size();
498 Scopes.push_back(GotoScope(ParentScope,
499 diag::note_protected_by_objc_catch,
500 diag::note_exits_objc_catch,
501 AC->getAtCatchLoc()));
503 BuildScopeInformation(AC->getCatchBody(), NewParentScope);
508 unsigned NewParentScope = Scopes.size();
509 Scopes.push_back(GotoScope(ParentScope,
510 diag::note_protected_by_objc_finally,
511 diag::note_exits_objc_finally,
512 AF->getAtFinallyLoc()));
513 BuildScopeInformation(AF, NewParentScope);
519 case Stmt::ObjCAtSynchronizedStmtClass: {
529 unsigned NewParentScope = Scopes.size();
530 Scopes.push_back(GotoScope(ParentScope,
531 diag::note_protected_by_objc_synchronized,
532 diag::note_exits_objc_synchronized,
534 BuildScopeInformation(AS->
getSynchBody(), NewParentScope);
538 case Stmt::ObjCAutoreleasePoolStmtClass: {
543 unsigned NewParentScope = Scopes.size();
544 Scopes.push_back(GotoScope(ParentScope,
545 diag::note_protected_by_objc_autoreleasepool,
546 diag::note_exits_objc_autoreleasepool,
548 BuildScopeInformation(AS->
getSubStmt(), NewParentScope);
552 case Stmt::ExprWithCleanupsClass: {
557 for (
unsigned i = 0, e = EWC->
getNumObjects(); i != e; ++i) {
559 for (
const auto &CI : BDecl->
captures()) {
560 VarDecl *variable = CI.getVariable();
561 BuildScopeInformation(variable, BDecl, origParentScope);
564 BuildScopeInformation(CLE, origParentScope);
566 llvm_unreachable(
"unexpected cleanup object type");
571 case Stmt::MaterializeTemporaryExprClass: {
578 const Expr *ExtendedObject =
582 Scopes.push_back(GotoScope(ParentScope, 0,
583 diag::note_exits_temporary_dtor,
585 origParentScope = Scopes.size()-1;
591 case Stmt::CaseStmtClass:
592 case Stmt::DefaultStmtClass:
593 case Stmt::LabelStmtClass:
594 LabelAndGotoScopes[S] = ParentScope;
597 case Stmt::AttributedStmtClass: {
599 if (GetMustTailAttr(AS)) {
600 LabelAndGotoScopes[AS] = ParentScope;
601 MustTailStmts.push_back(AS);
607 if (
auto *ED = dyn_cast<OMPExecutableDirective>(S)) {
608 if (!ED->isStandaloneDirective()) {
609 unsigned NewParentScope = Scopes.size();
610 Scopes.emplace_back(ParentScope,
611 diag::note_omp_protected_structured_block,
612 diag::note_omp_exits_structured_block,
613 ED->getStructuredBlock()->getBeginLoc());
614 BuildScopeInformation(ED->getStructuredBlock(), NewParentScope);
621 for (
Stmt *SubStmt : S->children()) {
634 if (
SwitchCase *SC = dyn_cast<SwitchCase>(SubStmt))
635 Next = SC->getSubStmt();
636 else if (
LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt))
637 Next = LS->getSubStmt();
641 LabelAndGotoScopes[SubStmt] = ParentScope;
646 BuildScopeInformation(SubStmt, ParentScope);
652void JumpScopeChecker::VerifyJumps() {
653 while (!Jumps.empty()) {
654 Stmt *Jump = Jumps.pop_back_val();
657 if (
GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) {
659 if (GS->getLabel()->getStmt()) {
660 CheckJump(GS, GS->getLabel()->getStmt(), GS->getGotoLoc(),
661 diag::err_goto_into_protected_scope,
662 diag::ext_goto_into_protected_scope,
663 diag::warn_cxx98_compat_goto_into_protected_scope);
672 CheckJump(IGS,
Target->getStmt(), IGS->getGotoLoc(),
673 diag::err_goto_into_protected_scope,
674 diag::ext_goto_into_protected_scope,
675 diag::warn_cxx98_compat_goto_into_protected_scope);
685 if (
CaseStmt *CS = dyn_cast<CaseStmt>(SC))
687 else if (
DefaultStmt *DS = dyn_cast<DefaultStmt>(SC))
690 Loc = SC->getBeginLoc();
691 CheckJump(SS, SC, Loc, diag::err_switch_into_protected_scope, 0,
692 diag::warn_cxx98_compat_switch_into_protected_scope);
715void JumpScopeChecker::VerifyIndirectOrAsmJumps(
bool IsAsmGoto) {
717 if (GotoJumps.empty())
720 IsAsmGoto ? AsmJumpTargets : IndirectJumpTargets;
723 if (JumpTargets.empty()) {
724 assert(!IsAsmGoto &&
"only indirect goto can get here");
725 S.
Diag(GotoJumps[0]->getBeginLoc(),
726 diag::err_indirect_goto_without_addrlabel);
732 typedef std::pair<unsigned, Stmt*> JumpScope;
735 llvm::DenseMap<unsigned, Stmt*> JumpScopesMap;
742 unsigned IGScope = LabelAndGotoScopes[IG];
743 Stmt *&Entry = JumpScopesMap[IGScope];
744 if (!Entry) Entry = IG;
746 JumpScopes.reserve(JumpScopesMap.size());
747 for (llvm::DenseMap<unsigned, Stmt *>::iterator I = JumpScopesMap.begin(),
748 E = JumpScopesMap.end();
750 JumpScopes.push_back(*I);
756 llvm::DenseMap<unsigned, LabelDecl*> TargetScopes;
758 E = JumpTargets.end();
763 unsigned LabelScope = LabelAndGotoScopes[TheLabel->
getStmt()];
765 if (!Target)
Target = TheLabel;
776 llvm::BitVector Reachable(Scopes.size(),
false);
777 for (llvm::DenseMap<unsigned,LabelDecl*>::iterator
778 TI = TargetScopes.begin(), TE = TargetScopes.end(); TI != TE; ++TI) {
779 unsigned TargetScope = TI->first;
787 unsigned Min = TargetScope;
795 if (Scopes[Min].InDiag)
break;
797 Min = Scopes[Min].ParentScope;
803 I = JumpScopes.begin(), E = JumpScopes.end(); I != E; ++I) {
804 unsigned Scope = I->first;
811 bool IsReachable =
false;
813 if (Reachable.test(
Scope)) {
816 for (
unsigned S = I->first; S !=
Scope; S = Scopes[S].ParentScope)
827 if (Scopes[
Scope].OutDiag)
break;
833 if (IsReachable)
continue;
835 DiagnoseIndirectOrAsmJump(I->second, I->first, TargetLabel, TargetScope);
843 return (JumpDiag == diag::err_goto_into_protected_scope &&
844 (InDiagNote == diag::note_protected_by_variable_init ||
845 InDiagNote == diag::note_protected_by_variable_nontriv_destructor));
852 InDiagNote == diag::note_protected_by_variable_non_pod;
860 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
861 S.
Diag(Jump->
getBeginLoc(), diag::err_indirect_goto_in_protected_scope)
863 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
872 for (
unsigned I = 0, E = ToScopes.size(); I != E; ++I)
873 if (Scopes[ToScopes[I]].InDiag)
874 S.
Diag(Scopes[ToScopes[I]].Loc, Scopes[ToScopes[I]].InDiag);
878void JumpScopeChecker::DiagnoseIndirectOrAsmJump(
Stmt *Jump,
unsigned JumpScope,
880 unsigned TargetScope) {
884 unsigned Common = GetDeepestCommonScope(JumpScope, TargetScope);
885 bool Diagnosed =
false;
888 for (
unsigned I = JumpScope; I != Common; I = Scopes[I].ParentScope)
889 if (Scopes[I].OutDiag) {
891 S.
Diag(Scopes[I].Loc, Scopes[I].OutDiag);
897 for (
unsigned I = TargetScope; I != Common; I = Scopes[I].ParentScope)
899 ToScopesCXX98Compat.push_back(I);
900 else if (Scopes[I].InDiag) {
902 S.
Diag(Scopes[I].Loc, Scopes[I].InDiag);
906 if (!Diagnosed && !ToScopesCXX98Compat.empty()) {
907 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
909 diag::warn_cxx98_compat_indirect_goto_in_protected_scope)
911 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
913 NoteJumpIntoScopes(ToScopesCXX98Compat);
920 unsigned JumpDiagError,
unsigned JumpDiagWarning,
921 unsigned JumpDiagCXX98Compat) {
927 unsigned FromScope = LabelAndGotoScopes[From];
928 unsigned ToScope = LabelAndGotoScopes[To];
931 if (FromScope == ToScope)
return;
934 if (isa<GotoStmt>(From) || isa<IndirectGotoStmt>(From)) {
937 for (
unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) {
938 if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) {
942 if (Scopes[I].InDiag == diag::note_omp_protected_structured_block) {
950 unsigned CommonScope = GetDeepestCommonScope(FromScope, ToScope);
953 if (CommonScope == ToScope)
return;
959 for (
unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) {
960 if (S.
getLangOpts().MSVCCompat && JumpDiagWarning != 0 &&
962 ToScopesWarning.push_back(I);
964 ToScopesCXX98Compat.push_back(I);
965 else if (Scopes[I].InDiag)
966 ToScopesError.push_back(I);
970 if (!ToScopesWarning.empty()) {
971 S.
Diag(DiagLoc, JumpDiagWarning);
972 NoteJumpIntoScopes(ToScopesWarning);
973 assert(isa<LabelStmt>(To));
975 Label->setSideEntry(
true);
979 if (!ToScopesError.empty()) {
980 S.
Diag(DiagLoc, JumpDiagError);
981 NoteJumpIntoScopes(ToScopesError);
985 if (ToScopesError.empty() && !ToScopesCXX98Compat.empty()) {
986 S.
Diag(DiagLoc, JumpDiagCXX98Compat);
987 NoteJumpIntoScopes(ToScopesCXX98Compat);
991void JumpScopeChecker::CheckGotoStmt(
GotoStmt *GS) {
1000void JumpScopeChecker::VerifyMustTailStmts() {
1002 for (
unsigned I = LabelAndGotoScopes[AS]; I; I = Scopes[I].ParentScope) {
1003 if (Scopes[I].OutDiag) {
1005 S.
Diag(Scopes[I].Loc, Scopes[I].OutDiag);
1014 llvm::find_if(Attrs, [](
const Attr *A) {
return isa<MustTailAttr>(A); });
1015 return Iter != Attrs.end() ? *Iter :
nullptr;
1019 (void)JumpScopeChecker(Body, *
this);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
std::pair< unsigned, unsigned > ScopePair
static ScopePair GetDiagForGotoScopeDecl(Sema &S, const Decl *D)
GetDiagForGotoScopeDecl - If this decl induces a new goto scope, return a diagnostic that should be e...
static bool IsCXX98CompatWarning(Sema &S, unsigned InDiagNote)
Return true if a particular note should be downgraded to a compatibility warning in C++11 mode.
static bool IsMicrosoftJumpWarning(unsigned JumpDiag, unsigned InDiagNote)
Return true if a particular error+note combination must be downgraded to a warning in Microsoft mode.
#define CHECK_PERMISSIVE(x)
static void DiagnoseIndirectOrAsmJumpStmt(Sema &S, Stmt *Jump, LabelDecl *Target, bool &Diagnosed)
Produce primary diagnostic for an indirect jump statement.
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.
Defines the clang::SourceLocation class and associated facilities.
Defines the Objective-C statement AST node classes.
This file defines OpenMP AST classes for executable directives and clauses.
__device__ __2f16 float bool s
const LangOptions & getLangOpts() const
Attr - This represents one attribute.
Represents an attribute applied to a statement.
ArrayRef< const Attr * > getAttrs() const
SourceLocation getBeginLoc() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
ArrayRef< Capture > captures() const
CXXCatchStmt - This represents a C++ catch block.
Stmt * getHandlerBlock() const
SourceLocation getBeginLoc() const LLVM_READONLY
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
bool isDefaultConstructor() const
Whether this constructor is a default constructor (C++ [class.ctor]p5), which can be used to default-...
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
bool isPOD() const
Whether this class is a POD-type (C++ [class]p4)
CXXTryStmt - A C++ try block, including all handlers.
CXXCatchStmt * getHandler(unsigned i)
unsigned getNumHandlers() const
CompoundStmt * getTryBlock()
CaseStmt - Represent a case statement.
CompoundLiteralExpr - [C99 6.5.2.5].
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
SourceLocation getBeginLoc() const LLVM_READONLY
Decl - This represents one declaration (or definition), e.g.
SourceLocation getLocation() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
CleanupObject getObject(unsigned i) const
unsigned getNumObjects() const
This represents one expression.
const Expr * skipRValueSubobjectAdjustments(SmallVectorImpl< const Expr * > &CommaLHS, SmallVectorImpl< SubobjectAdjustment > &Adjustments) const
Walk outwards from an expression we want to bind a reference to and find the expression whose lifetim...
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
GotoStmt - This represents a direct goto.
SourceLocation getGotoLoc() const
LabelDecl * getLabel() const
IfStmt - This represents an if/then/else.
bool isObjCAvailabilityCheck() const
SourceLocation getBeginLoc() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
IndirectGotoStmt - This represents an indirect goto.
Represents the declaration of a label.
LabelStmt * getStmt() const
bool isMSAsmLabel() const
LabelStmt - Represents a label, which has a substatement.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Represents Objective-C's @catch statement.
Represents Objective-C's @finally statement.
Represents Objective-C's @synchronized statement.
const Expr * getSynchExpr() const
const CompoundStmt * getSynchBody() const
SourceLocation getAtSynchronizedLoc() const
Represents Objective-C's @try ... @catch ... @finally statement.
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
const Stmt * getTryBody() const
Retrieve the @try body.
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
catch_range catch_stmts()
Represents Objective-C's @autoreleasepool Statement.
SourceLocation getAtLoc() const
const Stmt * getSubStmt() const
A (possibly-)qualified type.
@ DK_objc_strong_lifetime
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
CompoundStmt * getTryBlock() const
SEHFinallyStmt * getFinallyHandler() const
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Scope - A scope is a transient data structure that is used while parsing the program.
Sema - This implements semantic analysis and AST building for C.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
const LangOptions & getLangOpts() const
void DiagnoseInvalidJumps(Stmt *Body)
Encodes a location in the source.
SourceLocation getBegin() const
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
const SwitchCase * getNextSwitchCase() const
SwitchStmt - This represents a 'switch' stmt.
SwitchCase * getSwitchCaseList()
Base class for declarations which introduce a typedef-name.
Represents a variable declaration or definition.
@ CallInit
Call-style initialization (C++98)
@ SD_Automatic
Automatic storage duration (most local variables).