23#include "llvm/ADT/BitVector.h"
38class JumpScopeChecker {
43 const bool Permissive;
66 GotoScope(
unsigned parentScope,
unsigned InDiag,
unsigned OutDiag,
68 : ParentScope(parentScope), InDiag(InDiag), OutDiag(OutDiag),
Loc(L) {}
72 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 VerifyIndirectJumps();
90 void VerifyMustTailStmts();
93 unsigned TargetScope);
95 unsigned JumpDiag,
unsigned JumpDiagWarning,
96 unsigned JumpDiagCompat);
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 VerifyIndirectJumps();
119 VerifyMustTailStmts();
124unsigned JumpScopeChecker::GetDeepestCommonScope(
unsigned A,
unsigned B) {
129 assert(Scopes[B].ParentScope < B);
130 B = Scopes[B].ParentScope;
132 assert(Scopes[A].ParentScope < A);
133 A = Scopes[A].ParentScope;
144 if (
const VarDecl *VD = dyn_cast<VarDecl>(
D)) {
146 unsigned OutDiag = 0;
148 if (VD->getType()->isVariablyModifiedType())
149 InDiag = diag::note_protected_by_vla;
151 if (VD->hasAttr<BlocksAttr>())
152 return ScopePair(diag::note_protected_by___block,
153 diag::note_exits___block);
155 if (VD->hasAttr<CleanupAttr>())
156 return ScopePair(diag::note_protected_by_cleanup,
157 diag::note_exits_cleanup);
159 if (VD->hasLocalStorage()) {
160 switch (VD->getType().isDestructedType()) {
162 return ScopePair(diag::note_protected_by_objc_strong_init,
163 diag::note_exits_objc_strong);
166 return ScopePair(diag::note_protected_by_objc_weak_init,
167 diag::note_exits_objc_weak);
170 return ScopePair(diag::note_protected_by_non_trivial_c_struct_init,
171 diag::note_exits_dtor);
174 OutDiag = diag::note_exits_dtor;
182 if (
const Expr *
Init = VD->getInit();
183 VD->hasLocalStorage() &&
Init && !
Init->containsErrors()) {
198 InDiag = diag::note_protected_by_variable_init;
208 InDiag = diag::note_protected_by_variable_nontriv_destructor;
210 InDiag = diag::note_protected_by_variable_non_pod;
221 if (TD->getUnderlyingType()->isVariablyModifiedType())
223 ? diag::note_protected_by_vla_typedef
224 : diag::note_protected_by_vla_type_alias,
232void JumpScopeChecker::BuildScopeInformation(
Decl *
D,
unsigned &ParentScope) {
235 if (Diags.first || Diags.second) {
236 Scopes.push_back(GotoScope(ParentScope, Diags.first, Diags.second,
238 ParentScope = Scopes.size()-1;
243 if (
VarDecl *VD = dyn_cast<VarDecl>(
D))
245 BuildScopeInformation(
Init, ParentScope);
249void JumpScopeChecker::BuildScopeInformation(
VarDecl *
D,
251 unsigned &ParentScope) {
259 std::pair<unsigned,unsigned> Diags;
260 switch (destructKind) {
262 Diags =
ScopePair(diag::note_enters_block_captures_cxx_obj,
263 diag::note_exits_block_captures_cxx_obj);
266 Diags =
ScopePair(diag::note_enters_block_captures_strong,
267 diag::note_exits_block_captures_strong);
270 Diags =
ScopePair(diag::note_enters_block_captures_weak,
271 diag::note_exits_block_captures_weak);
274 Diags =
ScopePair(diag::note_enters_block_captures_non_trivial_c_struct,
275 diag::note_exits_block_captures_non_trivial_c_struct);
278 llvm_unreachable(
"non-lifetime captured variable");
283 Scopes.push_back(GotoScope(ParentScope,
284 Diags.first, Diags.second,
Loc));
285 ParentScope = Scopes.size()-1;
292 unsigned &ParentScope) {
293 unsigned InDiag = diag::note_enters_compound_literal_scope;
294 unsigned OutDiag = diag::note_exits_compound_literal_scope;
295 Scopes.push_back(GotoScope(ParentScope, InDiag, OutDiag, CLE->
getExprLoc()));
296 ParentScope = Scopes.size() - 1;
303void JumpScopeChecker::BuildScopeInformation(
Stmt *S,
304 unsigned &origParentScope) {
308 unsigned independentParentScope = origParentScope;
309 unsigned &ParentScope = ((isa<Expr>(S) && !isa<StmtExpr>(S))
310 ? origParentScope : independentParentScope);
312 unsigned StmtsToSkip = 0u;
315 switch (S->getStmtClass()) {
316 case Stmt::AddrLabelExprClass:
317 IndirectJumpTargets.push_back(cast<AddrLabelExpr>(S)->getLabel());
320 case Stmt::ObjCForCollectionStmtClass: {
321 auto *CS = cast<ObjCForCollectionStmt>(S);
322 unsigned Diag = diag::note_protected_by_objc_fast_enumeration;
323 unsigned NewParentScope = Scopes.size();
324 Scopes.push_back(GotoScope(ParentScope,
Diag, 0, S->getBeginLoc()));
325 BuildScopeInformation(CS->getBody(), NewParentScope);
329 case Stmt::IndirectGotoStmtClass:
335 if (cast<IndirectGotoStmt>(S)->getConstantTarget())
336 goto RecordJumpScope;
338 LabelAndGotoScopes[S] = ParentScope;
339 IndirectJumps.push_back(S);
342 case Stmt::SwitchStmtClass:
345 if (
Stmt *
Init = cast<SwitchStmt>(S)->getInit()) {
346 BuildScopeInformation(
Init, ParentScope);
349 if (
VarDecl *Var = cast<SwitchStmt>(S)->getConditionVariable()) {
350 BuildScopeInformation(Var, ParentScope);
353 goto RecordJumpScope;
355 case Stmt::GCCAsmStmtClass:
356 if (!cast<GCCAsmStmt>(S)->isAsmGoto())
360 case Stmt::GotoStmtClass:
364 LabelAndGotoScopes[S] = ParentScope;
368 case Stmt::IfStmtClass: {
369 IfStmt *IS = cast<IfStmt>(S);
374 unsigned Diag = diag::note_protected_by_if_available;
376 Diag = diag::note_protected_by_constexpr_if;
378 Diag = diag::note_protected_by_consteval_if;
381 BuildScopeInformation(Var, ParentScope);
384 unsigned NewParentScope = Scopes.size();
388 BuildScopeInformation(IS->
getCond(), NewParentScope);
391 NewParentScope = Scopes.size();
393 BuildScopeInformation(IS->
getThen(), NewParentScope);
395 NewParentScope = Scopes.size();
397 BuildScopeInformation(Else, NewParentScope);
402 case Stmt::CXXTryStmtClass: {
405 unsigned NewParentScope = Scopes.size();
406 Scopes.push_back(GotoScope(ParentScope,
407 diag::note_protected_by_cxx_try,
408 diag::note_exits_cxx_try,
411 BuildScopeInformation(TryBlock, NewParentScope);
417 unsigned NewParentScope = Scopes.size();
418 Scopes.push_back(GotoScope(ParentScope,
419 diag::note_protected_by_cxx_catch,
420 diag::note_exits_cxx_catch,
427 case Stmt::SEHTryStmtClass: {
430 unsigned NewParentScope = Scopes.size();
431 Scopes.push_back(GotoScope(ParentScope,
432 diag::note_protected_by_seh_try,
433 diag::note_exits_seh_try,
436 BuildScopeInformation(TryBlock, NewParentScope);
441 unsigned NewParentScope = Scopes.size();
442 Scopes.push_back(GotoScope(ParentScope,
443 diag::note_protected_by_seh_except,
444 diag::note_exits_seh_except,
445 Except->getSourceRange().getBegin()));
446 BuildScopeInformation(Except->getBlock(), NewParentScope);
448 unsigned NewParentScope = Scopes.size();
449 Scopes.push_back(GotoScope(ParentScope,
450 diag::note_protected_by_seh_finally,
451 diag::note_exits_seh_finally,
452 Finally->getSourceRange().getBegin()));
453 BuildScopeInformation(Finally->getBlock(), NewParentScope);
459 case Stmt::DeclStmtClass: {
465 for (
auto *I : DS->
decls())
466 BuildScopeInformation(I, origParentScope);
470 case Stmt::StmtExprClass: {
477 unsigned NewParentScope = Scopes.size();
478 Scopes.push_back(GotoScope(ParentScope,
479 diag::note_enters_statement_expression,
481 BuildScopeInformation(SE->
getSubStmt(), NewParentScope);
485 case Stmt::ObjCAtTryStmtClass: {
491 unsigned NewParentScope = Scopes.size();
492 Scopes.push_back(GotoScope(ParentScope,
493 diag::note_protected_by_objc_try,
494 diag::note_exits_objc_try,
497 BuildScopeInformation(TryPart, NewParentScope);
502 unsigned NewParentScope = Scopes.size();
503 Scopes.push_back(GotoScope(ParentScope,
504 diag::note_protected_by_objc_catch,
505 diag::note_exits_objc_catch,
506 AC->getAtCatchLoc()));
508 BuildScopeInformation(AC->getCatchBody(), NewParentScope);
513 unsigned NewParentScope = Scopes.size();
514 Scopes.push_back(GotoScope(ParentScope,
515 diag::note_protected_by_objc_finally,
516 diag::note_exits_objc_finally,
517 AF->getAtFinallyLoc()));
518 BuildScopeInformation(AF, NewParentScope);
524 case Stmt::ObjCAtSynchronizedStmtClass: {
534 unsigned NewParentScope = Scopes.size();
535 Scopes.push_back(GotoScope(ParentScope,
536 diag::note_protected_by_objc_synchronized,
537 diag::note_exits_objc_synchronized,
539 BuildScopeInformation(AS->
getSynchBody(), NewParentScope);
543 case Stmt::ObjCAutoreleasePoolStmtClass: {
548 unsigned NewParentScope = Scopes.size();
549 Scopes.push_back(GotoScope(ParentScope,
550 diag::note_protected_by_objc_autoreleasepool,
551 diag::note_exits_objc_autoreleasepool,
553 BuildScopeInformation(AS->
getSubStmt(), NewParentScope);
557 case Stmt::ExprWithCleanupsClass: {
562 for (
unsigned i = 0, e = EWC->
getNumObjects(); i != e; ++i) {
563 if (
auto *BDecl = dyn_cast<BlockDecl *>(EWC->
getObject(i)))
564 for (
const auto &CI : BDecl->
captures()) {
565 VarDecl *variable = CI.getVariable();
566 BuildScopeInformation(variable, BDecl, origParentScope);
568 else if (
auto *CLE = dyn_cast<CompoundLiteralExpr *>(EWC->
getObject(i)))
569 BuildScopeInformation(CLE, origParentScope);
571 llvm_unreachable(
"unexpected cleanup object type");
576 case Stmt::MaterializeTemporaryExprClass: {
581 const Expr *ExtendedObject =
584 Scopes.push_back(GotoScope(ParentScope, 0,
585 diag::note_exits_temporary_dtor,
587 origParentScope = Scopes.size()-1;
593 case Stmt::CaseStmtClass:
594 case Stmt::DefaultStmtClass:
595 case Stmt::LabelStmtClass:
596 LabelAndGotoScopes[S] = ParentScope;
599 case Stmt::OpenACCComputeConstructClass: {
600 unsigned NewParentScope = Scopes.size();
602 Scopes.push_back(GotoScope(
603 ParentScope, diag::note_acc_branch_into_compute_construct,
604 diag::note_acc_branch_out_of_compute_construct, CC->
getBeginLoc()));
612 case Stmt::OpenACCCombinedConstructClass: {
613 unsigned NewParentScope = Scopes.size();
615 Scopes.push_back(GotoScope(
616 ParentScope, diag::note_acc_branch_into_compute_construct,
617 diag::note_acc_branch_out_of_compute_construct, CC->
getBeginLoc()));
621 BuildScopeInformation(CC->
getLoop(), NewParentScope);
626 if (
auto *ED = dyn_cast<OMPExecutableDirective>(S)) {
627 if (!ED->isStandaloneDirective()) {
628 unsigned NewParentScope = Scopes.size();
629 Scopes.emplace_back(ParentScope,
630 diag::note_omp_protected_structured_block,
631 diag::note_omp_exits_structured_block,
632 ED->getStructuredBlock()->getBeginLoc());
633 BuildScopeInformation(ED->getStructuredBlock(), NewParentScope);
640 for (
Stmt *SubStmt : S->children()) {
653 if (
SwitchCase *SC = dyn_cast<SwitchCase>(SubStmt))
654 Next = SC->getSubStmt();
655 else if (
LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt))
656 Next = LS->getSubStmt();
657 else if (
AttributedStmt *AS = dyn_cast<AttributedStmt>(SubStmt)) {
658 if (GetMustTailAttr(AS)) {
659 LabelAndGotoScopes[AS] = ParentScope;
660 MustTailStmts.push_back(AS);
666 LabelAndGotoScopes[SubStmt] = ParentScope;
671 BuildScopeInformation(SubStmt, ParentScope);
677void JumpScopeChecker::VerifyJumps() {
678 while (!Jumps.empty()) {
679 Stmt *Jump = Jumps.pop_back_val();
682 if (
GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) {
684 if (GS->getLabel()->getStmt()) {
685 CheckJump(GS, GS->getLabel()->getStmt(), GS->getGotoLoc(),
686 diag::err_goto_into_protected_scope,
687 diag::ext_goto_into_protected_scope,
689 ? diag::warn_cxx98_compat_goto_into_protected_scope
690 : diag::warn_cpp_compat_goto_into_protected_scope);
701 if (
auto *G = dyn_cast<GCCAsmStmt>(Jump)) {
704 unsigned JumpScope = LabelAndGotoScopes[G];
705 unsigned TargetScope = LabelAndGotoScopes[LD->
getStmt()];
706 if (JumpScope != TargetScope)
707 DiagnoseIndirectOrAsmJump(G, JumpScope, LD, TargetScope);
715 CheckJump(IGS,
Target->getStmt(), IGS->getGotoLoc(),
716 diag::err_goto_into_protected_scope,
717 diag::ext_goto_into_protected_scope,
719 ? diag::warn_cxx98_compat_goto_into_protected_scope
720 : diag::warn_cpp_compat_goto_into_protected_scope);
730 if (
CaseStmt *CS = dyn_cast<CaseStmt>(SC))
732 else if (
DefaultStmt *DS = dyn_cast<DefaultStmt>(SC))
735 Loc = SC->getBeginLoc();
736 CheckJump(SS, SC,
Loc, diag::err_switch_into_protected_scope, 0,
738 ? diag::warn_cxx98_compat_switch_into_protected_scope
739 : diag::warn_cpp_compat_switch_into_protected_scope);
761void JumpScopeChecker::VerifyIndirectJumps() {
762 if (IndirectJumps.empty())
766 if (IndirectJumpTargets.empty()) {
767 S.
Diag(IndirectJumps[0]->getBeginLoc(),
768 diag::err_indirect_goto_without_addrlabel);
774 using JumpScope = std::pair<unsigned, Stmt *>;
777 llvm::DenseMap<unsigned, Stmt*> JumpScopesMap;
778 for (
Stmt *IG : IndirectJumps) {
781 unsigned IGScope = LabelAndGotoScopes[IG];
782 JumpScopesMap.try_emplace(IGScope, IG);
784 JumpScopes.reserve(JumpScopesMap.size());
785 for (
auto &Pair : JumpScopesMap)
786 JumpScopes.emplace_back(Pair);
792 llvm::DenseMap<unsigned, LabelDecl*> TargetScopes;
793 for (
LabelDecl *TheLabel : IndirectJumpTargets) {
796 unsigned LabelScope = LabelAndGotoScopes[TheLabel->getStmt()];
797 TargetScopes.try_emplace(LabelScope, TheLabel);
808 llvm::BitVector Reachable(Scopes.size(),
false);
809 for (
auto [TargetScope, TargetLabel] : TargetScopes) {
815 unsigned Min = TargetScope;
823 if (Scopes[
Min].InDiag)
break;
825 Min = Scopes[
Min].ParentScope;
830 for (
auto [JumpScope, JumpStmt] : JumpScopes) {
831 unsigned Scope = JumpScope;
837 bool IsReachable =
false;
839 if (Reachable.test(
Scope)) {
842 for (
unsigned S = JumpScope; S !=
Scope; S = Scopes[S].ParentScope)
853 if (Scopes[
Scope].OutDiag)
break;
859 if (IsReachable)
continue;
861 DiagnoseIndirectOrAsmJump(JumpStmt, JumpScope, TargetLabel, TargetScope);
869 return (JumpDiag == diag::err_goto_into_protected_scope &&
870 (InDiagNote == diag::note_protected_by_variable_init ||
871 InDiagNote == diag::note_protected_by_variable_nontriv_destructor));
878 InDiagNote == diag::note_protected_by_variable_non_pod;
885 InDiagNote == diag::note_protected_by_variable_init;
893 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
894 S.
Diag(Jump->
getBeginLoc(), diag::err_indirect_goto_in_protected_scope)
896 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
905 for (
unsigned I = 0,
E = ToScopes.size(); I !=
E; ++I)
906 if (Scopes[ToScopes[I]].InDiag)
907 S.
Diag(Scopes[ToScopes[I]].
Loc, Scopes[ToScopes[I]].InDiag);
911void JumpScopeChecker::DiagnoseIndirectOrAsmJump(
Stmt *Jump,
unsigned JumpScope,
913 unsigned TargetScope) {
917 unsigned Common = GetDeepestCommonScope(JumpScope, TargetScope);
918 bool Diagnosed =
false;
921 for (
unsigned I = JumpScope; I != Common; I = Scopes[I].ParentScope)
922 if (Scopes[I].OutDiag) {
924 S.
Diag(Scopes[I].
Loc, Scopes[I].OutDiag);
930 for (
unsigned I = TargetScope; I != Common; I = Scopes[I].ParentScope)
932 ToScopesCXX98Compat.push_back(I);
934 ToScopesCppCompat.push_back(I);
935 else if (Scopes[I].InDiag) {
937 S.
Diag(Scopes[I].
Loc, Scopes[I].InDiag);
942 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
945 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
947 NoteJumpIntoScopes(Notes);
949 if (!ToScopesCXX98Compat.empty())
950 Diag(diag::warn_cxx98_compat_indirect_goto_in_protected_scope,
951 ToScopesCXX98Compat);
952 else if (!ToScopesCppCompat.empty())
953 Diag(diag::warn_cpp_compat_indirect_goto_in_protected_scope,
961 unsigned JumpDiagError,
962 unsigned JumpDiagWarning,
963 unsigned JumpDiagCompat) {
969 unsigned FromScope = LabelAndGotoScopes[From];
970 unsigned ToScope = LabelAndGotoScopes[To];
973 if (FromScope == ToScope)
return;
976 if (isa<GotoStmt>(From) || isa<IndirectGotoStmt>(From)) {
979 for (
unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) {
980 if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) {
983 }
else if (Scopes[I].InDiag ==
984 diag::note_omp_protected_structured_block) {
988 }
else if (Scopes[I].InDiag ==
989 diag::note_acc_branch_into_compute_construct) {
991 S.
Diag(Scopes[I].
Loc, diag::note_acc_branch_out_of_compute_construct);
997 unsigned CommonScope = GetDeepestCommonScope(FromScope, ToScope);
1000 if (CommonScope == ToScope)
return;
1006 for (
unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) {
1008 JumpDiagWarning != 0 &&
1010 ToScopesWarning.push_back(I);
1013 ToScopesCompat.push_back(I);
1014 else if (Scopes[I].InDiag)
1015 ToScopesError.push_back(I);
1019 if (!ToScopesWarning.empty()) {
1020 S.
Diag(DiagLoc, JumpDiagWarning);
1021 NoteJumpIntoScopes(ToScopesWarning);
1022 assert(isa<LabelStmt>(To));
1024 Label->setSideEntry(
true);
1028 if (!ToScopesError.empty()) {
1029 S.
Diag(DiagLoc, JumpDiagError);
1030 NoteJumpIntoScopes(ToScopesError);
1034 if (ToScopesError.empty() && !ToScopesCompat.empty()) {
1035 S.
Diag(DiagLoc, JumpDiagCompat);
1036 NoteJumpIntoScopes(ToScopesCompat);
1040void JumpScopeChecker::CheckGotoStmt(
GotoStmt *GS) {
1049void JumpScopeChecker::VerifyMustTailStmts() {
1051 for (
unsigned I = LabelAndGotoScopes[AS]; I; I = Scopes[I].ParentScope) {
1052 if (Scopes[I].OutDiag) {
1054 S.
Diag(Scopes[I].
Loc, Scopes[I].OutDiag);
1063 llvm::find_if(Attrs, [](
const Attr *A) {
return isa<MustTailAttr>(A); });
1064 return Iter != Attrs.end() ? *
Iter :
nullptr;
1068 (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.
static bool IsCppCompatWarning(Sema &S, unsigned InDiagNote)
Returns true if a particular note should be a C++ compatibility warning in C mode with -Wc++-compat.
#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.
llvm::MachO::Target Target
Defines the clang::SourceLocation class and associated facilities.
Defines the Objective-C statement AST node classes.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
__device__ __2f16 float __ockl_bool s
AddrLabelExpr - The GNU address of label extension, representing &&label.
Attr - This represents one attribute.
Represents an attribute applied to a statement.
ArrayRef< const Attr * > getAttrs() 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
SourceLocation getBeginLoc() const LLVM_READONLY
const Stmt * getSubStmt() const
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
Stmt * getStructuredBlock()
SourceLocation getBeginLoc() 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.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Sema - This implements semantic analysis and AST building for C.
const LangOptions & getLangOpts() const
void DiagnoseInvalidJumps(Stmt *Body)
Encodes a location in the source.
SourceLocation getBegin() const
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
CompoundStmt * getSubStmt()
SourceLocation getBeginLoc() const LLVM_READONLY
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)
The JSON file list parser is used to communicate input to InstallAPI.
@ SD_Automatic
Automatic storage duration (most local variables).
const FunctionProtoType * T