#include "CheckExprLifetime.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/IgnoreExpr.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/EnterExpressionEvaluationContext.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/Ownership.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaCUDA.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenMP.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
usingnamespaceclang;
usingnamespacesema;
StmtResult Sema::ActOnExprStmt(ExprResult FE, bool DiscardedValue) { … }
StmtResult Sema::ActOnExprStmtError() { … }
StmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc,
bool HasLeadingEmptyMacro) { … }
StmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg, SourceLocation StartLoc,
SourceLocation EndLoc) { … }
void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) { … }
static bool DiagnoseUnusedComparison(Sema &S, const Expr *E) { … }
static bool DiagnoseNoDiscard(Sema &S, const WarnUnusedResultAttr *A,
SourceLocation Loc, SourceRange R1,
SourceRange R2, bool IsCtor) { … }
void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) { … }
void Sema::ActOnStartOfCompoundStmt(bool IsStmtExpr) { … }
void Sema::ActOnAfterCompoundStatementLeadingPragmas() { … }
void Sema::ActOnFinishOfCompoundStmt() { … }
sema::CompoundScopeInfo &Sema::getCurCompoundScope() const { … }
StmtResult Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R,
ArrayRef<Stmt *> Elts, bool isStmtExpr) { … }
ExprResult
Sema::ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val) { … }
StmtResult
Sema::ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHSVal,
SourceLocation DotDotDotLoc, ExprResult RHSVal,
SourceLocation ColonLoc) { … }
void Sema::ActOnCaseStmtBody(Stmt *S, Stmt *SubStmt) { … }
StmtResult
Sema::ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc,
Stmt *SubStmt, Scope *CurScope) { … }
StmtResult
Sema::ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl,
SourceLocation ColonLoc, Stmt *SubStmt) { … }
StmtResult Sema::BuildAttributedStmt(SourceLocation AttrsLoc,
ArrayRef<const Attr *> Attrs,
Stmt *SubStmt) { … }
StmtResult Sema::ActOnAttributedStmt(const ParsedAttributes &Attrs,
Stmt *SubStmt) { … }
bool Sema::checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA) { … }
bool Sema::checkMustTailAttr(const Stmt *St, const Attr &MTA) { … }
namespace {
class CommaVisitor : public EvaluatedExprVisitor<CommaVisitor> { … };
}
StmtResult Sema::ActOnIfStmt(SourceLocation IfLoc,
IfStatementKind StatementKind,
SourceLocation LParenLoc, Stmt *InitStmt,
ConditionResult Cond, SourceLocation RParenLoc,
Stmt *thenStmt, SourceLocation ElseLoc,
Stmt *elseStmt) { … }
StmtResult Sema::BuildIfStmt(SourceLocation IfLoc,
IfStatementKind StatementKind,
SourceLocation LParenLoc, Stmt *InitStmt,
ConditionResult Cond, SourceLocation RParenLoc,
Stmt *thenStmt, SourceLocation ElseLoc,
Stmt *elseStmt) { … }
namespace {
struct CaseCompareFunctor { … };
}
static bool CmpCaseVals(const std::pair<llvm::APSInt, CaseStmt*>& lhs,
const std::pair<llvm::APSInt, CaseStmt*>& rhs) { … }
static bool CmpEnumVals(const std::pair<llvm::APSInt, EnumConstantDecl*>& lhs,
const std::pair<llvm::APSInt, EnumConstantDecl*>& rhs)
{ … }
static bool EqEnumVals(const std::pair<llvm::APSInt, EnumConstantDecl*>& lhs,
const std::pair<llvm::APSInt, EnumConstantDecl*>& rhs)
{ … }
static QualType GetTypeBeforeIntegralPromotion(const Expr *&E) { … }
ExprResult Sema::CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond) { … }
StmtResult Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
SourceLocation LParenLoc,
Stmt *InitStmt, ConditionResult Cond,
SourceLocation RParenLoc) { … }
static void AdjustAPSInt(llvm::APSInt &Val, unsigned BitWidth, bool IsSigned) { … }
static void checkCaseValue(Sema &S, SourceLocation Loc, const llvm::APSInt &Val,
unsigned UnpromotedWidth, bool UnpromotedSign) { … }
EnumValsTy;
static bool ShouldDiagnoseSwitchCaseNotInEnum(const Sema &S,
const EnumDecl *ED,
const Expr *CaseExpr,
EnumValsTy::iterator &EI,
EnumValsTy::iterator &EIEnd,
const llvm::APSInt &Val) { … }
static void checkEnumTypesInSwitchStmt(Sema &S, const Expr *Cond,
const Expr *Case) { … }
StmtResult
Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
Stmt *BodyStmt) { … }
void
Sema::DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
Expr *SrcExpr) { … }
StmtResult Sema::ActOnWhileStmt(SourceLocation WhileLoc,
SourceLocation LParenLoc, ConditionResult Cond,
SourceLocation RParenLoc, Stmt *Body) { … }
StmtResult
Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
SourceLocation WhileLoc, SourceLocation CondLParen,
Expr *Cond, SourceLocation CondRParen) { … }
namespace {
DeclSetVector;
class DeclExtractor : public EvaluatedExprVisitor<DeclExtractor> { … };
class DeclMatcher : public EvaluatedExprVisitor<DeclMatcher> { … };
void CheckForLoopConditionalStatement(Sema &S, Expr *Second,
Expr *Third, Stmt *Body) { … }
bool ProcessIterationStmt(Sema &S, Stmt* Statement, bool &Increment,
DeclRefExpr *&DRE) { … }
class BreakContinueFinder : public ConstEvaluatedExprVisitor<BreakContinueFinder> { … };
void CheckForRedundantIteration(Sema &S, Expr *Third, Stmt *Body) { … }
}
void Sema::CheckBreakContinueBinding(Expr *E) { … }
StmtResult Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
Stmt *First, ConditionResult Second,
FullExprArg third, SourceLocation RParenLoc,
Stmt *Body) { … }
StmtResult Sema::ActOnForEachLValueExpr(Expr *E) { … }
static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init,
SourceLocation Loc, int DiagID) { … }
namespace {
enum BeginEndFunction { … };
void NoteForRangeBeginEndFunction(Sema &SemaRef, Expr *E,
BeginEndFunction BEF) { … }
VarDecl *BuildForRangeVarDecl(Sema &SemaRef, SourceLocation Loc,
QualType Type, StringRef Name) { … }
}
static bool ObjCEnumerationCollection(Expr *Collection) { … }
StmtResult Sema::ActOnCXXForRangeStmt(
Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt,
Stmt *First, SourceLocation ColonLoc, Expr *Range, SourceLocation RParenLoc,
BuildForRangeKind Kind,
ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps) { … }
static Sema::ForRangeStatus
BuildNonArrayForRange(Sema &SemaRef, Expr *BeginRange, Expr *EndRange,
QualType RangeType, VarDecl *BeginVar, VarDecl *EndVar,
SourceLocation ColonLoc, SourceLocation CoawaitLoc,
OverloadCandidateSet *CandidateSet, ExprResult *BeginExpr,
ExprResult *EndExpr, BeginEndFunction *BEF) { … }
static StmtResult RebuildForRangeWithDereference(Sema &SemaRef, Scope *S,
SourceLocation ForLoc,
SourceLocation CoawaitLoc,
Stmt *InitStmt,
Stmt *LoopVarDecl,
SourceLocation ColonLoc,
Expr *Range,
SourceLocation RangeLoc,
SourceLocation RParenLoc) { … }
StmtResult Sema::BuildCXXForRangeStmt(
SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt,
SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End,
Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc,
BuildForRangeKind Kind,
ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps) { … }
static void DiagnoseForRangeReferenceVariableCopies(Sema &SemaRef,
const VarDecl *VD,
QualType RangeInitType) { … }
static bool hasTrivialABIAttr(QualType VariableType) { … }
static void DiagnoseForRangeConstVariableCopies(Sema &SemaRef,
const VarDecl *VD) { … }
static void DiagnoseForRangeVariableCopies(Sema &SemaRef,
const CXXForRangeStmt *ForStmt) { … }
StmtResult Sema::FinishCXXForRangeStmt(Stmt *S, Stmt *B) { … }
StmtResult Sema::ActOnGotoStmt(SourceLocation GotoLoc,
SourceLocation LabelLoc,
LabelDecl *TheDecl) { … }
StmtResult
Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
Expr *E) { … }
static void CheckJumpOutOfSEHFinally(Sema &S, SourceLocation Loc,
const Scope &DestScope) { … }
StmtResult
Sema::ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope) { … }
StmtResult
Sema::ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope) { … }
Sema::NamedReturnInfo Sema::getNamedReturnInfo(Expr *&E,
SimplerImplicitMoveMode Mode) { … }
Sema::NamedReturnInfo Sema::getNamedReturnInfo(const VarDecl *VD) { … }
const VarDecl *Sema::getCopyElisionCandidate(NamedReturnInfo &Info,
QualType ReturnType) { … }
static bool
VerifyInitializationSequenceCXX98(const Sema &S,
const InitializationSequence &Seq) { … }
ExprResult Sema::PerformMoveOrCopyInitialization(
const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value,
bool SupressSimplerImplicitMoves) { … }
static bool hasDeducedReturnType(FunctionDecl *FD) { … }
StmtResult Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc,
Expr *RetValExp,
NamedReturnInfo &NRInfo,
bool SupressSimplerImplicitMoves) { … }
namespace {
class LocalTypedefNameReferencer
: public RecursiveASTVisitor<LocalTypedefNameReferencer> { … };
bool LocalTypedefNameReferencer::VisitRecordType(const RecordType *RT) { … }
}
TypeLoc Sema::getReturnTypeLoc(FunctionDecl *FD) const { … }
bool Sema::DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD,
SourceLocation ReturnLoc,
Expr *RetExpr, const AutoType *AT) { … }
StmtResult
Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
Scope *CurScope) { … }
static bool CheckSimplerImplicitMovesMSVCWorkaround(const Sema &S,
const Expr *E) { … }
StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
bool AllowRecovery) { … }
StmtResult
Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl,
Stmt *HandlerBlock) { … }
namespace {
class CatchHandlerType { … };
}
namespace llvm {
template <> struct DenseMapInfo<CatchHandlerType> { … };
}
namespace {
class CatchTypePublicBases { … };
}
StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
ArrayRef<Stmt *> Handlers) { … }
StmtResult Sema::ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc,
Stmt *TryBlock, Stmt *Handler) { … }
StmtResult Sema::ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr,
Stmt *Block) { … }
void Sema::ActOnStartSEHFinallyBlock() { … }
void Sema::ActOnAbortSEHFinallyBlock() { … }
StmtResult Sema::ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block) { … }
StmtResult
Sema::ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope) { … }
StmtResult Sema::BuildMSDependentExistsStmt(SourceLocation KeywordLoc,
bool IsIfExists,
NestedNameSpecifierLoc QualifierLoc,
DeclarationNameInfo NameInfo,
Stmt *Nested)
{ … }
StmtResult Sema::ActOnMSDependentExistsStmt(SourceLocation KeywordLoc,
bool IsIfExists,
CXXScopeSpec &SS,
UnqualifiedId &Name,
Stmt *Nested) { … }
RecordDecl*
Sema::CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc,
unsigned NumParams) { … }
static bool
buildCapturedStmtCaptureList(Sema &S, CapturedRegionScopeInfo *RSI,
SmallVectorImpl<CapturedStmt::Capture> &Captures,
SmallVectorImpl<Expr *> &CaptureInits) { … }
void Sema::ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
CapturedRegionKind Kind,
unsigned NumParams) { … }
void Sema::ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
CapturedRegionKind Kind,
ArrayRef<CapturedParamNameType> Params,
unsigned OpenMPCaptureLevel) { … }
void Sema::ActOnCapturedRegionError() { … }
StmtResult Sema::ActOnCapturedRegionEnd(Stmt *S) { … }