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;
79 JumpScopeChecker(
Stmt *Body,
Sema &S);
81 void BuildScopeInformation(
Decl *D,
unsigned &ParentScope);
83 unsigned &ParentScope);
85 void BuildScopeInformation(
Stmt *S,
unsigned &origParentScope);
88 void VerifyIndirectJumps();
89 void VerifyMustTailStmts();
91 void DiagnoseIndirectOrAsmJump(
Stmt *IG,
unsigned IGScope,
LabelDecl *Target,
92 unsigned TargetScope);
94 unsigned JumpDiag,
unsigned JumpDiagWarning,
95 unsigned JumpDiagCXX98Compat);
99 unsigned GetDeepestCommonScope(
unsigned A,
unsigned B);
103#define CHECK_PERMISSIVE(x) (assert(Permissive || !(x)), (Permissive && (x)))
105JumpScopeChecker::JumpScopeChecker(
Stmt *Body,
Sema &
s)
106 : S(
s), Permissive(
s.hasAnyUnrecoverableErrorsInThisFunction()) {
112 unsigned BodyParentScope = 0;
113 BuildScopeInformation(Body, BodyParentScope);
117 VerifyIndirectJumps();
118 VerifyMustTailStmts();
123unsigned JumpScopeChecker::GetDeepestCommonScope(
unsigned A,
unsigned B) {
128 assert(Scopes[B].ParentScope < B);
129 B = Scopes[B].ParentScope;
131 assert(Scopes[A].ParentScope < A);
132 A = Scopes[A].ParentScope;
143 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
145 unsigned OutDiag = 0;
147 if (VD->getType()->isVariablyModifiedType())
148 InDiag = diag::note_protected_by_vla;
150 if (VD->hasAttr<BlocksAttr>())
151 return ScopePair(diag::note_protected_by___block,
152 diag::note_exits___block);
154 if (VD->hasAttr<CleanupAttr>())
155 return ScopePair(diag::note_protected_by_cleanup,
156 diag::note_exits_cleanup);
158 if (VD->hasLocalStorage()) {
159 switch (VD->getType().isDestructedType()) {
161 return ScopePair(diag::note_protected_by_objc_strong_init,
162 diag::note_exits_objc_strong);
165 return ScopePair(diag::note_protected_by_objc_weak_init,
166 diag::note_exits_objc_weak);
169 return ScopePair(diag::note_protected_by_non_trivial_c_struct_init,
170 diag::note_exits_dtor);
173 OutDiag = diag::note_exits_dtor;
197 InDiag = diag::note_protected_by_variable_init;
207 InDiag = diag::note_protected_by_variable_nontriv_destructor;
209 InDiag = diag::note_protected_by_variable_non_pod;
220 if (TD->getUnderlyingType()->isVariablyModifiedType())
222 ? diag::note_protected_by_vla_typedef
223 : diag::note_protected_by_vla_type_alias,
231void JumpScopeChecker::BuildScopeInformation(
Decl *D,
unsigned &ParentScope) {
234 if (Diags.first || Diags.second) {
235 Scopes.push_back(GotoScope(ParentScope, Diags.first, Diags.second,
237 ParentScope = Scopes.size()-1;
242 if (
VarDecl *VD = dyn_cast<VarDecl>(D))
244 BuildScopeInformation(
Init, ParentScope);
248void JumpScopeChecker::BuildScopeInformation(
VarDecl *D,
250 unsigned &ParentScope) {
258 std::pair<unsigned,unsigned> Diags;
259 switch (destructKind) {
261 Diags =
ScopePair(diag::note_enters_block_captures_cxx_obj,
262 diag::note_exits_block_captures_cxx_obj);
265 Diags =
ScopePair(diag::note_enters_block_captures_strong,
266 diag::note_exits_block_captures_strong);
269 Diags =
ScopePair(diag::note_enters_block_captures_weak,
270 diag::note_exits_block_captures_weak);
273 Diags =
ScopePair(diag::note_enters_block_captures_non_trivial_c_struct,
274 diag::note_exits_block_captures_non_trivial_c_struct);
277 llvm_unreachable(
"non-lifetime captured variable");
282 Scopes.push_back(GotoScope(ParentScope,
283 Diags.first, Diags.second, Loc));
284 ParentScope = Scopes.size()-1;
291 unsigned &ParentScope) {
292 unsigned InDiag = diag::note_enters_compound_literal_scope;
293 unsigned OutDiag = diag::note_exits_compound_literal_scope;
294 Scopes.push_back(GotoScope(ParentScope, InDiag, OutDiag, CLE->
getExprLoc()));
295 ParentScope = Scopes.size() - 1;
302void JumpScopeChecker::BuildScopeInformation(
Stmt *S,
303 unsigned &origParentScope) {
307 unsigned independentParentScope = origParentScope;
308 unsigned &ParentScope = ((isa<Expr>(S) && !isa<StmtExpr>(S))
309 ? origParentScope : independentParentScope);
311 unsigned StmtsToSkip = 0u;
314 switch (S->getStmtClass()) {
315 case Stmt::AddrLabelExprClass:
316 IndirectJumpTargets.push_back(cast<AddrLabelExpr>(S)->getLabel());
319 case Stmt::ObjCForCollectionStmtClass: {
320 auto *CS = cast<ObjCForCollectionStmt>(S);
321 unsigned Diag = diag::note_protected_by_objc_fast_enumeration;
322 unsigned NewParentScope = Scopes.size();
323 Scopes.push_back(GotoScope(ParentScope,
Diag, 0, S->getBeginLoc()));
324 BuildScopeInformation(CS->getBody(), NewParentScope);
328 case Stmt::IndirectGotoStmtClass:
334 if (cast<IndirectGotoStmt>(S)->getConstantTarget())
335 goto RecordJumpScope;
337 LabelAndGotoScopes[S] = ParentScope;
338 IndirectJumps.push_back(S);
341 case Stmt::SwitchStmtClass:
344 if (
Stmt *
Init = cast<SwitchStmt>(S)->getInit()) {
345 BuildScopeInformation(
Init, ParentScope);
348 if (
VarDecl *Var = cast<SwitchStmt>(S)->getConditionVariable()) {
349 BuildScopeInformation(Var, ParentScope);
352 goto RecordJumpScope;
354 case Stmt::GCCAsmStmtClass:
355 if (!cast<GCCAsmStmt>(S)->isAsmGoto())
359 case Stmt::GotoStmtClass:
363 LabelAndGotoScopes[S] = ParentScope;
367 case Stmt::IfStmtClass: {
368 IfStmt *IS = cast<IfStmt>(S);
373 unsigned Diag = diag::note_protected_by_if_available;
375 Diag = diag::note_protected_by_constexpr_if;
377 Diag = diag::note_protected_by_consteval_if;
380 BuildScopeInformation(Var, ParentScope);
383 unsigned NewParentScope = Scopes.size();
387 BuildScopeInformation(IS->
getCond(), NewParentScope);
390 NewParentScope = Scopes.size();
392 BuildScopeInformation(IS->
getThen(), NewParentScope);
394 NewParentScope = Scopes.size();
396 BuildScopeInformation(Else, NewParentScope);
401 case Stmt::CXXTryStmtClass: {
404 unsigned NewParentScope = Scopes.size();
405 Scopes.push_back(GotoScope(ParentScope,
406 diag::note_protected_by_cxx_try,
407 diag::note_exits_cxx_try,
410 BuildScopeInformation(TryBlock, NewParentScope);
416 unsigned NewParentScope = Scopes.size();
417 Scopes.push_back(GotoScope(ParentScope,
418 diag::note_protected_by_cxx_catch,
419 diag::note_exits_cxx_catch,
426 case Stmt::SEHTryStmtClass: {
429 unsigned NewParentScope = Scopes.size();
430 Scopes.push_back(GotoScope(ParentScope,
431 diag::note_protected_by_seh_try,
432 diag::note_exits_seh_try,
435 BuildScopeInformation(TryBlock, NewParentScope);
440 unsigned NewParentScope = Scopes.size();
441 Scopes.push_back(GotoScope(ParentScope,
442 diag::note_protected_by_seh_except,
443 diag::note_exits_seh_except,
444 Except->getSourceRange().getBegin()));
445 BuildScopeInformation(Except->getBlock(), NewParentScope);
447 unsigned NewParentScope = Scopes.size();
448 Scopes.push_back(GotoScope(ParentScope,
449 diag::note_protected_by_seh_finally,
450 diag::note_exits_seh_finally,
451 Finally->getSourceRange().getBegin()));
452 BuildScopeInformation(Finally->getBlock(), NewParentScope);
458 case Stmt::DeclStmtClass: {
464 for (
auto *I : DS->
decls())
465 BuildScopeInformation(I, origParentScope);
469 case Stmt::StmtExprClass: {
476 unsigned NewParentScope = Scopes.size();
477 Scopes.push_back(GotoScope(ParentScope,
478 diag::note_enters_statement_expression,
480 BuildScopeInformation(SE->
getSubStmt(), NewParentScope);
484 case Stmt::ObjCAtTryStmtClass: {
490 unsigned NewParentScope = Scopes.size();
491 Scopes.push_back(GotoScope(ParentScope,
492 diag::note_protected_by_objc_try,
493 diag::note_exits_objc_try,
496 BuildScopeInformation(TryPart, NewParentScope);
501 unsigned NewParentScope = Scopes.size();
502 Scopes.push_back(GotoScope(ParentScope,
503 diag::note_protected_by_objc_catch,
504 diag::note_exits_objc_catch,
505 AC->getAtCatchLoc()));
507 BuildScopeInformation(AC->getCatchBody(), NewParentScope);
512 unsigned NewParentScope = Scopes.size();
513 Scopes.push_back(GotoScope(ParentScope,
514 diag::note_protected_by_objc_finally,
515 diag::note_exits_objc_finally,
516 AF->getAtFinallyLoc()));
517 BuildScopeInformation(AF, NewParentScope);
523 case Stmt::ObjCAtSynchronizedStmtClass: {
533 unsigned NewParentScope = Scopes.size();
534 Scopes.push_back(GotoScope(ParentScope,
535 diag::note_protected_by_objc_synchronized,
536 diag::note_exits_objc_synchronized,
538 BuildScopeInformation(AS->
getSynchBody(), NewParentScope);
542 case Stmt::ObjCAutoreleasePoolStmtClass: {
547 unsigned NewParentScope = Scopes.size();
548 Scopes.push_back(GotoScope(ParentScope,
549 diag::note_protected_by_objc_autoreleasepool,
550 diag::note_exits_objc_autoreleasepool,
552 BuildScopeInformation(AS->
getSubStmt(), NewParentScope);
556 case Stmt::ExprWithCleanupsClass: {
561 for (
unsigned i = 0, e = EWC->
getNumObjects(); i != e; ++i) {
563 for (
const auto &CI : BDecl->
captures()) {
564 VarDecl *variable = CI.getVariable();
565 BuildScopeInformation(variable, BDecl, origParentScope);
568 BuildScopeInformation(CLE, origParentScope);
570 llvm_unreachable(
"unexpected cleanup object type");
575 case Stmt::MaterializeTemporaryExprClass: {
582 const Expr *ExtendedObject =
586 Scopes.push_back(GotoScope(ParentScope, 0,
587 diag::note_exits_temporary_dtor,
589 origParentScope = Scopes.size()-1;
595 case Stmt::CaseStmtClass:
596 case Stmt::DefaultStmtClass:
597 case Stmt::LabelStmtClass:
598 LabelAndGotoScopes[S] = ParentScope;
601 case Stmt::AttributedStmtClass: {
603 if (GetMustTailAttr(AS)) {
604 LabelAndGotoScopes[AS] = ParentScope;
605 MustTailStmts.push_back(AS);
611 if (
auto *ED = dyn_cast<OMPExecutableDirective>(S)) {
612 if (!ED->isStandaloneDirective()) {
613 unsigned NewParentScope = Scopes.size();
614 Scopes.emplace_back(ParentScope,
615 diag::note_omp_protected_structured_block,
616 diag::note_omp_exits_structured_block,
617 ED->getStructuredBlock()->getBeginLoc());
618 BuildScopeInformation(ED->getStructuredBlock(), NewParentScope);
625 for (
Stmt *SubStmt : S->children()) {
638 if (
SwitchCase *SC = dyn_cast<SwitchCase>(SubStmt))
639 Next = SC->getSubStmt();
640 else if (
LabelStmt *LS = dyn_cast<LabelStmt>(SubStmt))
641 Next = LS->getSubStmt();
645 LabelAndGotoScopes[SubStmt] = ParentScope;
650 BuildScopeInformation(SubStmt, ParentScope);
656void JumpScopeChecker::VerifyJumps() {
657 while (!Jumps.empty()) {
658 Stmt *Jump = Jumps.pop_back_val();
661 if (
GotoStmt *GS = dyn_cast<GotoStmt>(Jump)) {
663 if (GS->getLabel()->getStmt()) {
664 CheckJump(GS, GS->getLabel()->getStmt(), GS->getGotoLoc(),
665 diag::err_goto_into_protected_scope,
666 diag::ext_goto_into_protected_scope,
667 diag::warn_cxx98_compat_goto_into_protected_scope);
678 if (
auto *G = dyn_cast<GCCAsmStmt>(Jump)) {
681 unsigned JumpScope = LabelAndGotoScopes[G];
682 unsigned TargetScope = LabelAndGotoScopes[LD->
getStmt()];
683 if (JumpScope != TargetScope)
684 DiagnoseIndirectOrAsmJump(G, JumpScope, LD, TargetScope);
692 CheckJump(IGS,
Target->getStmt(), IGS->getGotoLoc(),
693 diag::err_goto_into_protected_scope,
694 diag::ext_goto_into_protected_scope,
695 diag::warn_cxx98_compat_goto_into_protected_scope);
705 if (
CaseStmt *CS = dyn_cast<CaseStmt>(SC))
707 else if (
DefaultStmt *DS = dyn_cast<DefaultStmt>(SC))
710 Loc = SC->getBeginLoc();
711 CheckJump(SS, SC, Loc, diag::err_switch_into_protected_scope, 0,
712 diag::warn_cxx98_compat_switch_into_protected_scope);
734void JumpScopeChecker::VerifyIndirectJumps() {
735 if (IndirectJumps.empty())
739 if (IndirectJumpTargets.empty()) {
740 S.
Diag(IndirectJumps[0]->getBeginLoc(),
741 diag::err_indirect_goto_without_addrlabel);
747 using JumpScope = std::pair<unsigned, Stmt *>;
750 llvm::DenseMap<unsigned, Stmt*> JumpScopesMap;
751 for (
Stmt *IG : IndirectJumps) {
754 unsigned IGScope = LabelAndGotoScopes[IG];
755 if (!JumpScopesMap.contains(IGScope))
756 JumpScopesMap[IGScope] = IG;
758 JumpScopes.reserve(JumpScopesMap.size());
759 for (
auto &Pair : JumpScopesMap)
760 JumpScopes.emplace_back(Pair);
766 llvm::DenseMap<unsigned, LabelDecl*> TargetScopes;
767 for (
LabelDecl *TheLabel : IndirectJumpTargets) {
770 unsigned LabelScope = LabelAndGotoScopes[TheLabel->getStmt()];
771 if (!TargetScopes.contains(LabelScope))
772 TargetScopes[LabelScope] = TheLabel;
783 llvm::BitVector Reachable(Scopes.size(),
false);
784 for (
auto [TargetScope, TargetLabel] : TargetScopes) {
790 unsigned Min = TargetScope;
798 if (Scopes[Min].InDiag)
break;
800 Min = Scopes[Min].ParentScope;
805 for (
auto [JumpScope, JumpStmt] : JumpScopes) {
806 unsigned Scope = JumpScope;
812 bool IsReachable =
false;
814 if (Reachable.test(
Scope)) {
817 for (
unsigned S = JumpScope; S !=
Scope; S = Scopes[S].ParentScope)
828 if (Scopes[
Scope].OutDiag)
break;
834 if (IsReachable)
continue;
836 DiagnoseIndirectOrAsmJump(JumpStmt, JumpScope, TargetLabel, TargetScope);
844 return (JumpDiag == diag::err_goto_into_protected_scope &&
845 (InDiagNote == diag::note_protected_by_variable_init ||
846 InDiagNote == diag::note_protected_by_variable_nontriv_destructor));
853 InDiagNote == diag::note_protected_by_variable_non_pod;
861 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
862 S.
Diag(Jump->
getBeginLoc(), diag::err_indirect_goto_in_protected_scope)
864 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
873 for (
unsigned I = 0, E = ToScopes.size(); I != E; ++I)
874 if (Scopes[ToScopes[I]].InDiag)
875 S.
Diag(Scopes[ToScopes[I]].Loc, Scopes[ToScopes[I]].InDiag);
879void JumpScopeChecker::DiagnoseIndirectOrAsmJump(
Stmt *Jump,
unsigned JumpScope,
881 unsigned TargetScope) {
885 unsigned Common = GetDeepestCommonScope(JumpScope, TargetScope);
886 bool Diagnosed =
false;
889 for (
unsigned I = JumpScope; I != Common; I = Scopes[I].ParentScope)
890 if (Scopes[I].OutDiag) {
892 S.
Diag(Scopes[I].Loc, Scopes[I].OutDiag);
898 for (
unsigned I = TargetScope; I != Common; I = Scopes[I].ParentScope)
900 ToScopesCXX98Compat.push_back(I);
901 else if (Scopes[I].InDiag) {
903 S.
Diag(Scopes[I].Loc, Scopes[I].InDiag);
907 if (!Diagnosed && !ToScopesCXX98Compat.empty()) {
908 bool IsAsmGoto = isa<GCCAsmStmt>(Jump);
910 diag::warn_cxx98_compat_indirect_goto_in_protected_scope)
912 S.
Diag(
Target->getStmt()->getIdentLoc(), diag::note_indirect_goto_target)
914 NoteJumpIntoScopes(ToScopesCXX98Compat);
921 unsigned JumpDiagError,
unsigned JumpDiagWarning,
922 unsigned JumpDiagCXX98Compat) {
928 unsigned FromScope = LabelAndGotoScopes[From];
929 unsigned ToScope = LabelAndGotoScopes[To];
932 if (FromScope == ToScope)
return;
935 if (isa<GotoStmt>(From) || isa<IndirectGotoStmt>(From)) {
938 for (
unsigned I = FromScope; I > ToScope; I = Scopes[I].ParentScope) {
939 if (Scopes[I].InDiag == diag::note_protected_by_seh_finally) {
943 if (Scopes[I].InDiag == diag::note_omp_protected_structured_block) {
951 unsigned CommonScope = GetDeepestCommonScope(FromScope, ToScope);
954 if (CommonScope == ToScope)
return;
960 for (
unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) {
961 if (S.
getLangOpts().MSVCCompat && JumpDiagWarning != 0 &&
963 ToScopesWarning.push_back(I);
965 ToScopesCXX98Compat.push_back(I);
966 else if (Scopes[I].InDiag)
967 ToScopesError.push_back(I);
971 if (!ToScopesWarning.empty()) {
972 S.
Diag(DiagLoc, JumpDiagWarning);
973 NoteJumpIntoScopes(ToScopesWarning);
974 assert(isa<LabelStmt>(To));
976 Label->setSideEntry(
true);
980 if (!ToScopesError.empty()) {
981 S.
Diag(DiagLoc, JumpDiagError);
982 NoteJumpIntoScopes(ToScopesError);
986 if (ToScopesError.empty() && !ToScopesCXX98Compat.empty()) {
987 S.
Diag(DiagLoc, JumpDiagCXX98Compat);
988 NoteJumpIntoScopes(ToScopesCXX98Compat);
992void JumpScopeChecker::CheckGotoStmt(
GotoStmt *GS) {
1001void JumpScopeChecker::VerifyMustTailStmts() {
1003 for (
unsigned I = LabelAndGotoScopes[AS]; I; I = Scopes[I].ParentScope) {
1004 if (Scopes[I].OutDiag) {
1006 S.
Diag(Scopes[I].Loc, Scopes[I].OutDiag);
1015 llvm::find_if(Attrs, [](
const Attr *A) {
return isa<MustTailAttr>(A); });
1016 return Iter != Attrs.end() ? *
Iter :
nullptr;
1020 (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 __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
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
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)
@ SD_Automatic
Automatic storage duration (most local variables).