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 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 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;
184 !
Init->containsErrors()) {
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))
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 goto RecordJumpScope;
339 LabelAndGotoScopes[S] = ParentScope;
340 IndirectJumps.push_back(S);
343 case Stmt::SwitchStmtClass:
346 if (
Stmt *
Init = cast<SwitchStmt>(S)->getInit()) {
347 BuildScopeInformation(
Init, ParentScope);
350 if (
VarDecl *Var = cast<SwitchStmt>(S)->getConditionVariable()) {
351 BuildScopeInformation(Var, ParentScope);
354 goto RecordJumpScope;
356 case Stmt::GCCAsmStmtClass:
357 if (!cast<GCCAsmStmt>(S)->isAsmGoto())
361 case Stmt::GotoStmtClass:
365 LabelAndGotoScopes[S] = ParentScope;
369 case Stmt::IfStmtClass: {
370 IfStmt *IS = cast<IfStmt>(S);
375 unsigned Diag = diag::note_protected_by_if_available;
377 Diag = diag::note_protected_by_constexpr_if;
379 Diag = diag::note_protected_by_consteval_if;
382 BuildScopeInformation(Var, ParentScope);
385 unsigned NewParentScope = Scopes.size();
389 BuildScopeInformation(IS->
getCond(), NewParentScope);
392 NewParentScope = Scopes.size();
394 BuildScopeInformation(IS->
getThen(), NewParentScope);
396 NewParentScope = Scopes.size();
398 BuildScopeInformation(Else, NewParentScope);
403 case Stmt::CXXTryStmtClass: {
406 unsigned NewParentScope = Scopes.size();
407 Scopes.push_back(GotoScope(ParentScope,
408 diag::note_protected_by_cxx_try,
409 diag::note_exits_cxx_try,
412 BuildScopeInformation(TryBlock, NewParentScope);
418 unsigned NewParentScope = Scopes.size();
419 Scopes.push_back(GotoScope(ParentScope,
420 diag::note_protected_by_cxx_catch,
421 diag::note_exits_cxx_catch,
428 case Stmt::SEHTryStmtClass: {
431 unsigned NewParentScope = Scopes.size();
432 Scopes.push_back(GotoScope(ParentScope,
433 diag::note_protected_by_seh_try,
434 diag::note_exits_seh_try,
437 BuildScopeInformation(TryBlock, NewParentScope);
442 unsigned NewParentScope = Scopes.size();
443 Scopes.push_back(GotoScope(ParentScope,
444 diag::note_protected_by_seh_except,
445 diag::note_exits_seh_except,
446 Except->getSourceRange().getBegin()));
447 BuildScopeInformation(Except->getBlock(), NewParentScope);
449 unsigned NewParentScope = Scopes.size();
450 Scopes.push_back(GotoScope(ParentScope,
451 diag::note_protected_by_seh_finally,
452 diag::note_exits_seh_finally,
453 Finally->getSourceRange().getBegin()));
454 BuildScopeInformation(Finally->getBlock(), NewParentScope);
460 case Stmt::DeclStmtClass: {
466 for (
auto *I : DS->
decls())
467 BuildScopeInformation(I, origParentScope);
471 case Stmt::StmtExprClass: {
478 unsigned NewParentScope = Scopes.size();
479 Scopes.push_back(GotoScope(ParentScope,
480 diag::note_enters_statement_expression,
482 BuildScopeInformation(SE->
getSubStmt(), NewParentScope);
486 case Stmt::ObjCAtTryStmtClass: {
492 unsigned NewParentScope = Scopes.size();
493 Scopes.push_back(GotoScope(ParentScope,
494 diag::note_protected_by_objc_try,
495 diag::note_exits_objc_try,
498 BuildScopeInformation(TryPart, NewParentScope);
503 unsigned NewParentScope = Scopes.size();
504 Scopes.push_back(GotoScope(ParentScope,
505 diag::note_protected_by_objc_catch,
506 diag::note_exits_objc_catch,
507 AC->getAtCatchLoc()));
509 BuildScopeInformation(AC->getCatchBody(), NewParentScope);
514 unsigned NewParentScope = Scopes.size();
515 Scopes.push_back(GotoScope(ParentScope,
516 diag::note_protected_by_objc_finally,
517 diag::note_exits_objc_finally,
518 AF->getAtFinallyLoc()));
519 BuildScopeInformation(AF, NewParentScope);
525 case Stmt::ObjCAtSynchronizedStmtClass: {
535 unsigned NewParentScope = Scopes.size();
536 Scopes.push_back(GotoScope(ParentScope,
537 diag::note_protected_by_objc_synchronized,
538 diag::note_exits_objc_synchronized,
540 BuildScopeInformation(AS->
getSynchBody(), NewParentScope);
544 case Stmt::ObjCAutoreleasePoolStmtClass: {
549 unsigned NewParentScope = Scopes.size();
550 Scopes.push_back(GotoScope(ParentScope,
551 diag::note_protected_by_objc_autoreleasepool,
552 diag::note_exits_objc_autoreleasepool,
554 BuildScopeInformation(AS->
getSubStmt(), NewParentScope);
558 case Stmt::ExprWithCleanupsClass: {
563 for (
unsigned i = 0, e = EWC->
getNumObjects(); i != e; ++i) {
565 for (
const auto &CI : BDecl->
captures()) {
566 VarDecl *variable = CI.getVariable();
567 BuildScopeInformation(variable, BDecl, origParentScope);
570 BuildScopeInformation(CLE, origParentScope);
572 llvm_unreachable(
"unexpected cleanup object type");
577 case Stmt::MaterializeTemporaryExprClass: {
582 const Expr *ExtendedObject =
585 Scopes.push_back(GotoScope(ParentScope, 0,
586 diag::note_exits_temporary_dtor,
588 origParentScope = Scopes.size()-1;
594 case Stmt::CaseStmtClass:
595 case Stmt::DefaultStmtClass:
596 case Stmt::LabelStmtClass:
597 LabelAndGotoScopes[S] = ParentScope;
600 case Stmt::AttributedStmtClass: {
602 if (GetMustTailAttr(AS)) {
603 LabelAndGotoScopes[AS] = ParentScope;
604 MustTailStmts.push_back(AS);
609 case Stmt::OpenACCComputeConstructClass: {
610 unsigned NewParentScope = Scopes.size();
612 Scopes.push_back(GotoScope(
613 ParentScope, diag::note_acc_branch_into_compute_construct,
614 diag::note_acc_branch_out_of_compute_construct, CC->
getBeginLoc()));
620 if (
auto *ED = dyn_cast<OMPExecutableDirective>(S)) {
621 if (!ED->isStandaloneDirective()) {
622 unsigned NewParentScope = Scopes.size();
623 Scopes.emplace_back(ParentScope,
624 diag::note_omp_protected_structured_block,
625 diag::note_omp_exits_structured_block,
626 ED->getStructuredBlock()->getBeginLoc());
627 BuildScopeInformation(ED->getStructuredBlock(), NewParentScope);
634 for (
Stmt *SubStmt : S->children()) {
647 if (
SwitchCase *SC = dyn_cast<SwitchCase>(SubStmt))
648 Next = SC->getSubStmt();
649 else if (
LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt))
650 Next = LS->getSubStmt();
654 LabelAndGotoScopes[SubStmt] = ParentScope;
659 BuildScopeInformation(SubStmt, ParentScope);
665void JumpScopeChecker::VerifyJumps() {
666 while (!Jumps.empty()) {
667 Stmt *Jump = Jumps.pop_back_val();
670 if (
GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) {
672 if (GS->getLabel()->getStmt()) {
673 CheckJump(GS, GS->getLabel()->getStmt(), GS->getGotoLoc(),
674 diag::err_goto_into_protected_scope,
675 diag::ext_goto_into_protected_scope,
676 diag::warn_cxx98_compat_goto_into_protected_scope);
687 if (
auto *G = dyn_cast<GCCAsmStmt>(Jump)) {
690 unsigned JumpScope = LabelAndGotoScopes[G];
691 unsigned TargetScope = LabelAndGotoScopes[LD->
getStmt()];
692 if (JumpScope != TargetScope)
693 DiagnoseIndirectOrAsmJump(G, JumpScope, LD, TargetScope);
701 CheckJump(IGS,
Target->getStmt(), IGS->getGotoLoc(),
702 diag::err_goto_into_protected_scope,
703 diag::ext_goto_into_protected_scope,
704 diag::warn_cxx98_compat_goto_into_protected_scope);
714 if (
CaseStmt *CS = dyn_cast<CaseStmt>(SC))
716 else if (
DefaultStmt *DS = dyn_cast<DefaultStmt>(SC))
719 Loc = SC->getBeginLoc();
720 CheckJump(SS, SC,
Loc, diag::err_switch_into_protected_scope, 0,
721 diag::warn_cxx98_compat_switch_into_protected_scope);
743void JumpScopeChecker::VerifyIndirectJumps() {
744 if (IndirectJumps.empty())
748 if (IndirectJumpTargets.empty()) {
749 S.
Diag(IndirectJumps[0]->getBeginLoc(),
750 diag::err_indirect_goto_without_addrlabel);
756 using JumpScope = std::pair<unsigned, Stmt *>;
759 llvm::DenseMap<unsigned, Stmt*> JumpScopesMap;
760 for (
Stmt *IG : IndirectJumps) {
763 unsigned IGScope = LabelAndGotoScopes[IG];
764 if (!JumpScopesMap.contains(IGScope))
765 JumpScopesMap[IGScope] = IG;
767 JumpScopes.reserve(JumpScopesMap.size());
768 for (
auto &Pair : JumpScopesMap)
769 JumpScopes.emplace_back(Pair);
775 llvm::DenseMap<unsigned, LabelDecl*> TargetScopes;
776 for (
LabelDecl *TheLabel : IndirectJumpTargets) {
779 unsigned LabelScope = LabelAndGotoScopes[TheLabel->getStmt()];
780 if (!TargetScopes.contains(LabelScope))
781 TargetScopes[LabelScope] = TheLabel;
792 llvm::BitVector Reachable(Scopes.size(),
false);
793 for (
auto [TargetScope, TargetLabel] : TargetScopes) {
799 unsigned Min = TargetScope;
807 if (Scopes[
Min].InDiag)
break;
809 Min = Scopes[
Min].ParentScope;
814 for (
auto [JumpScope, JumpStmt] : JumpScopes) {
815 unsigned Scope = JumpScope;
821 bool IsReachable =
false;
823 if (Reachable.test(
Scope)) {
826 for (
unsigned S = JumpScope; S !=
Scope; S = Scopes[S].ParentScope)
837 if (Scopes[
Scope].OutDiag)
break;
843 if (IsReachable)
continue;
845 DiagnoseIndirectOrAsmJump(JumpStmt, JumpScope, TargetLabel, TargetScope);
853 return (JumpDiag == diag::err_goto_into_protected_scope &&
854 (InDiagNote == diag::note_protected_by_variable_init ||
855 InDiagNote == diag::note_protected_by_variable_nontriv_destructor));
862 InDiagNote == diag::note_protected_by_variable_non_pod;
870 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
871 S.
Diag(Jump->
getBeginLoc(), diag::err_indirect_goto_in_protected_scope)
873 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
882 for (
unsigned I = 0,
E = ToScopes.size(); I !=
E; ++I)
883 if (Scopes[ToScopes[I]].InDiag)
884 S.
Diag(Scopes[ToScopes[I]].
Loc, Scopes[ToScopes[I]].InDiag);
888void JumpScopeChecker::DiagnoseIndirectOrAsmJump(
Stmt *Jump,
unsigned JumpScope,
890 unsigned TargetScope) {
894 unsigned Common = GetDeepestCommonScope(JumpScope, TargetScope);
895 bool Diagnosed =
false;
898 for (
unsigned I = JumpScope; I != Common; I = Scopes[I].ParentScope)
899 if (Scopes[I].OutDiag) {
901 S.
Diag(Scopes[I].
Loc, Scopes[I].OutDiag);
907 for (
unsigned I = TargetScope; I != Common; I = Scopes[I].ParentScope)
909 ToScopesCXX98Compat.push_back(I);
910 else if (Scopes[I].InDiag) {
912 S.
Diag(Scopes[I].
Loc, Scopes[I].InDiag);
916 if (!Diagnosed && !ToScopesCXX98Compat.empty()) {
917 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
919 diag::warn_cxx98_compat_indirect_goto_in_protected_scope)
921 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
923 NoteJumpIntoScopes(ToScopesCXX98Compat);
930 unsigned JumpDiagError,
unsigned JumpDiagWarning,
931 unsigned JumpDiagCXX98Compat) {
937 unsigned FromScope = LabelAndGotoScopes[From];
938 unsigned ToScope = LabelAndGotoScopes[To];
941 if (FromScope == ToScope)
return;
944 if (isa<GotoStmt>(From) || isa<IndirectGotoStmt>(From)) {
947 for (
unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) {
948 if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) {
951 }
else if (Scopes[I].InDiag ==
952 diag::note_omp_protected_structured_block) {
956 }
else if (Scopes[I].InDiag ==
957 diag::note_acc_branch_into_compute_construct) {
959 S.
Diag(Scopes[I].
Loc, diag::note_acc_branch_out_of_compute_construct);
965 unsigned CommonScope = GetDeepestCommonScope(FromScope, ToScope);
968 if (CommonScope == ToScope)
return;
974 for (
unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) {
975 if (S.
getLangOpts().MSVCCompat && JumpDiagWarning != 0 &&
977 ToScopesWarning.push_back(I);
979 ToScopesCXX98Compat.push_back(I);
980 else if (Scopes[I].InDiag)
981 ToScopesError.push_back(I);
985 if (!ToScopesWarning.empty()) {
986 S.
Diag(DiagLoc, JumpDiagWarning);
987 NoteJumpIntoScopes(ToScopesWarning);
988 assert(isa<LabelStmt>(To));
990 Label->setSideEntry(
true);
994 if (!ToScopesError.empty()) {
995 S.
Diag(DiagLoc, JumpDiagError);
996 NoteJumpIntoScopes(ToScopesError);
1000 if (ToScopesError.empty() && !ToScopesCXX98Compat.empty()) {
1001 S.
Diag(DiagLoc, JumpDiagCXX98Compat);
1002 NoteJumpIntoScopes(ToScopesCXX98Compat);
1006void JumpScopeChecker::CheckGotoStmt(
GotoStmt *GS) {
1015void JumpScopeChecker::VerifyMustTailStmts() {
1017 for (
unsigned I = LabelAndGotoScopes[AS]; I; I = Scopes[I].ParentScope) {
1018 if (Scopes[I].OutDiag) {
1020 S.
Diag(Scopes[I].
Loc, Scopes[I].OutDiag);
1029 llvm::find_if(Attrs, [](
const Attr *A) {
return isa<MustTailAttr>(A); });
1030 return Iter != Attrs.end() ? *
Iter :
nullptr;
1034 (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.
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
const LangOptions & getLangOpts() const
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
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
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