forked from OSchip/llvm-project
Revert "[Sema] Make getCurFunction() return null outside function parsing"
This reverts r326965. It seems to have caused repeating test failures in clang/test/Sema/diagnose_if.c on some buildbots. I cannot reproduce the problem, and it's not immediately obvious what the problem is, so let's revert to green. llvm-svn: 326974
This commit is contained in:
parent
5d3310208a
commit
8d485b845b
|
@ -528,10 +528,12 @@ public:
|
||||||
/// full expression.
|
/// full expression.
|
||||||
llvm::SmallPtrSet<Expr*, 2> MaybeODRUseExprs;
|
llvm::SmallPtrSet<Expr*, 2> MaybeODRUseExprs;
|
||||||
|
|
||||||
std::unique_ptr<sema::FunctionScopeInfo> PreallocatedFunctionScope;
|
|
||||||
|
|
||||||
/// \brief Stack containing information about each of the nested
|
/// \brief Stack containing information about each of the nested
|
||||||
/// function, block, and method scopes that are currently active.
|
/// function, block, and method scopes that are currently active.
|
||||||
|
///
|
||||||
|
/// This array is never empty. Clients should ignore the first
|
||||||
|
/// element, which is used to cache a single FunctionScopeInfo
|
||||||
|
/// that's used to parse every top-level function.
|
||||||
SmallVector<sema::FunctionScopeInfo *, 4> FunctionScopes;
|
SmallVector<sema::FunctionScopeInfo *, 4> FunctionScopes;
|
||||||
|
|
||||||
typedef LazyVector<TypedefNameDecl *, ExternalSemaSource,
|
typedef LazyVector<TypedefNameDecl *, ExternalSemaSource,
|
||||||
|
@ -1316,15 +1318,11 @@ public:
|
||||||
const BlockExpr *blkExpr = nullptr);
|
const BlockExpr *blkExpr = nullptr);
|
||||||
|
|
||||||
sema::FunctionScopeInfo *getCurFunction() const {
|
sema::FunctionScopeInfo *getCurFunction() const {
|
||||||
return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
|
return FunctionScopes.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
sema::FunctionScopeInfo *getEnclosingFunction() const;
|
sema::FunctionScopeInfo *getEnclosingFunction() const;
|
||||||
|
|
||||||
void setFunctionHasBranchIntoScope();
|
|
||||||
void setFunctionHasBranchProtectedScope();
|
|
||||||
void setFunctionHasIndirectGoto();
|
|
||||||
|
|
||||||
void PushCompoundScope(bool IsStmtExpr);
|
void PushCompoundScope(bool IsStmtExpr);
|
||||||
void PopCompoundScope();
|
void PopCompoundScope();
|
||||||
|
|
||||||
|
|
|
@ -632,19 +632,18 @@ struct CheckFallThroughDiagnostics {
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
/// CheckFallThroughForBody - Check that we don't fall off the end of a
|
/// CheckFallThroughForFunctionDef - Check that we don't fall off the end of a
|
||||||
/// function that should return a value. Check that we don't fall off the end
|
/// function that should return a value. Check that we don't fall off the end
|
||||||
/// of a noreturn function. We assume that functions and blocks not marked
|
/// of a noreturn function. We assume that functions and blocks not marked
|
||||||
/// noreturn will return.
|
/// noreturn will return.
|
||||||
static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body,
|
static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body,
|
||||||
const BlockExpr *blkExpr,
|
const BlockExpr *blkExpr,
|
||||||
const CheckFallThroughDiagnostics &CD,
|
const CheckFallThroughDiagnostics& CD,
|
||||||
AnalysisDeclContext &AC,
|
AnalysisDeclContext &AC) {
|
||||||
sema::FunctionScopeInfo *FSI) {
|
|
||||||
|
|
||||||
bool ReturnsVoid = false;
|
bool ReturnsVoid = false;
|
||||||
bool HasNoReturn = false;
|
bool HasNoReturn = false;
|
||||||
bool IsCoroutine = FSI->isCoroutine();
|
bool IsCoroutine = S.getCurFunction() && S.getCurFunction()->isCoroutine();
|
||||||
|
|
||||||
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
|
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
|
||||||
if (const auto *CBody = dyn_cast<CoroutineBodyStmt>(Body))
|
if (const auto *CBody = dyn_cast<CoroutineBodyStmt>(Body))
|
||||||
|
@ -676,7 +675,7 @@ static void CheckFallThroughForBody(Sema &S, const Decl *D, const Stmt *Body,
|
||||||
SourceLocation LBrace = Body->getLocStart(), RBrace = Body->getLocEnd();
|
SourceLocation LBrace = Body->getLocStart(), RBrace = Body->getLocEnd();
|
||||||
auto EmitDiag = [&](SourceLocation Loc, unsigned DiagID) {
|
auto EmitDiag = [&](SourceLocation Loc, unsigned DiagID) {
|
||||||
if (IsCoroutine)
|
if (IsCoroutine)
|
||||||
S.Diag(Loc, DiagID) << FSI->CoroutinePromise->getType();
|
S.Diag(Loc, DiagID) << S.getCurFunction()->CoroutinePromise->getType();
|
||||||
else
|
else
|
||||||
S.Diag(Loc, DiagID);
|
S.Diag(Loc, DiagID);
|
||||||
};
|
};
|
||||||
|
@ -2144,7 +2143,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
|
||||||
: (fscope->isCoroutine()
|
: (fscope->isCoroutine()
|
||||||
? CheckFallThroughDiagnostics::MakeForCoroutine(D)
|
? CheckFallThroughDiagnostics::MakeForCoroutine(D)
|
||||||
: CheckFallThroughDiagnostics::MakeForFunction(D)));
|
: CheckFallThroughDiagnostics::MakeForFunction(D)));
|
||||||
CheckFallThroughForBody(S, D, Body, blkExpr, CD, AC, fscope);
|
CheckFallThroughForBody(S, D, Body, blkExpr, CD, AC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: check for unreachable code
|
// Warning: check for unreachable code
|
||||||
|
|
|
@ -162,7 +162,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
|
||||||
ExpressionEvaluationContext::PotentiallyEvaluated, 0, CleanupInfo{},
|
ExpressionEvaluationContext::PotentiallyEvaluated, 0, CleanupInfo{},
|
||||||
nullptr, false);
|
nullptr, false);
|
||||||
|
|
||||||
PreallocatedFunctionScope.reset(new FunctionScopeInfo(Diags));
|
FunctionScopes.push_back(new FunctionScopeInfo(Diags));
|
||||||
|
|
||||||
// Initilization of data sharing attributes stack for OpenMP
|
// Initilization of data sharing attributes stack for OpenMP
|
||||||
InitDataSharingAttributesStack();
|
InitDataSharingAttributesStack();
|
||||||
|
@ -332,11 +332,11 @@ void Sema::Initialize() {
|
||||||
|
|
||||||
Sema::~Sema() {
|
Sema::~Sema() {
|
||||||
if (VisContext) FreeVisContext();
|
if (VisContext) FreeVisContext();
|
||||||
|
|
||||||
// Kill all the active scopes.
|
// Kill all the active scopes.
|
||||||
for (sema::FunctionScopeInfo *FSI : FunctionScopes)
|
for (unsigned I = 1, E = FunctionScopes.size(); I != E; ++I)
|
||||||
if (FSI != PreallocatedFunctionScope.get())
|
delete FunctionScopes[I];
|
||||||
delete FSI;
|
if (FunctionScopes.size() == 1)
|
||||||
|
delete FunctionScopes[0];
|
||||||
|
|
||||||
// Tell the SemaConsumer to forget about us; we're going out of scope.
|
// Tell the SemaConsumer to forget about us; we're going out of scope.
|
||||||
if (SemaConsumer *SC = dyn_cast<SemaConsumer>(&Consumer))
|
if (SemaConsumer *SC = dyn_cast<SemaConsumer>(&Consumer))
|
||||||
|
@ -1340,13 +1340,17 @@ Scope *Sema::getScopeForContext(DeclContext *Ctx) {
|
||||||
|
|
||||||
/// \brief Enter a new function scope
|
/// \brief Enter a new function scope
|
||||||
void Sema::PushFunctionScope() {
|
void Sema::PushFunctionScope() {
|
||||||
if (FunctionScopes.empty()) {
|
if (FunctionScopes.size() == 1) {
|
||||||
// Use PreallocatedFunctionScope to avoid allocating memory when possible.
|
// Use the "top" function scope rather than having to allocate
|
||||||
PreallocatedFunctionScope->Clear();
|
// memory for a new scope.
|
||||||
FunctionScopes.push_back(PreallocatedFunctionScope.get());
|
FunctionScopes.back()->Clear();
|
||||||
} else {
|
FunctionScopes.push_back(FunctionScopes.back());
|
||||||
FunctionScopes.push_back(new FunctionScopeInfo(getDiagnostics()));
|
if (LangOpts.OpenMP)
|
||||||
|
pushOpenMPFunctionRegion();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FunctionScopes.push_back(new FunctionScopeInfo(getDiagnostics()));
|
||||||
if (LangOpts.OpenMP)
|
if (LangOpts.OpenMP)
|
||||||
pushOpenMPFunctionRegion();
|
pushOpenMPFunctionRegion();
|
||||||
}
|
}
|
||||||
|
@ -1373,8 +1377,8 @@ void Sema::RecordParsingTemplateParameterDepth(unsigned Depth) {
|
||||||
|
|
||||||
void Sema::PopFunctionScopeInfo(const AnalysisBasedWarnings::Policy *WP,
|
void Sema::PopFunctionScopeInfo(const AnalysisBasedWarnings::Policy *WP,
|
||||||
const Decl *D, const BlockExpr *blkExpr) {
|
const Decl *D, const BlockExpr *blkExpr) {
|
||||||
assert(!FunctionScopes.empty() && "mismatched push/pop!");
|
|
||||||
FunctionScopeInfo *Scope = FunctionScopes.pop_back_val();
|
FunctionScopeInfo *Scope = FunctionScopes.pop_back_val();
|
||||||
|
assert(!FunctionScopes.empty() && "mismatched push/pop!");
|
||||||
|
|
||||||
if (LangOpts.OpenMP)
|
if (LangOpts.OpenMP)
|
||||||
popOpenMPFunctionRegion(Scope);
|
popOpenMPFunctionRegion(Scope);
|
||||||
|
@ -1386,8 +1390,7 @@ void Sema::PopFunctionScopeInfo(const AnalysisBasedWarnings::Policy *WP,
|
||||||
for (const auto &PUD : Scope->PossiblyUnreachableDiags)
|
for (const auto &PUD : Scope->PossiblyUnreachableDiags)
|
||||||
Diag(PUD.Loc, PUD.PD);
|
Diag(PUD.Loc, PUD.PD);
|
||||||
|
|
||||||
// Delete the scope unless its our preallocated scope.
|
if (FunctionScopes.back() != Scope)
|
||||||
if (Scope != PreallocatedFunctionScope.get())
|
|
||||||
delete Scope;
|
delete Scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1408,21 +1411,6 @@ bool Sema::hasAnyUnrecoverableErrorsInThisFunction() const {
|
||||||
return getCurFunction()->ErrorTrap.hasUnrecoverableErrorOccurred();
|
return getCurFunction()->ErrorTrap.hasUnrecoverableErrorOccurred();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sema::setFunctionHasBranchIntoScope() {
|
|
||||||
if (!FunctionScopes.empty())
|
|
||||||
FunctionScopes.back()->setHasBranchIntoScope();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sema::setFunctionHasBranchProtectedScope() {
|
|
||||||
if (!FunctionScopes.empty())
|
|
||||||
FunctionScopes.back()->setHasBranchProtectedScope();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sema::setFunctionHasIndirectGoto() {
|
|
||||||
if (!FunctionScopes.empty())
|
|
||||||
FunctionScopes.back()->setHasIndirectGoto();
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockScopeInfo *Sema::getCurBlock() {
|
BlockScopeInfo *Sema::getCurBlock() {
|
||||||
if (FunctionScopes.empty())
|
if (FunctionScopes.empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -5747,7 +5747,7 @@ Sema::CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *NewTD) {
|
||||||
TypeSourceInfo *TInfo = NewTD->getTypeSourceInfo();
|
TypeSourceInfo *TInfo = NewTD->getTypeSourceInfo();
|
||||||
QualType T = TInfo->getType();
|
QualType T = TInfo->getType();
|
||||||
if (T->isVariablyModifiedType()) {
|
if (T->isVariablyModifiedType()) {
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
if (S->getFnParent() == nullptr) {
|
if (S->getFnParent() == nullptr) {
|
||||||
bool SizeIsNegative;
|
bool SizeIsNegative;
|
||||||
|
@ -7407,7 +7407,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
|
||||||
bool isVM = T->isVariablyModifiedType();
|
bool isVM = T->isVariablyModifiedType();
|
||||||
if (isVM || NewVD->hasAttr<CleanupAttr>() ||
|
if (isVM || NewVD->hasAttr<CleanupAttr>() ||
|
||||||
NewVD->hasAttr<BlocksAttr>())
|
NewVD->hasAttr<BlocksAttr>())
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
if ((isVM && NewVD->hasLinkage()) ||
|
if ((isVM && NewVD->hasLinkage()) ||
|
||||||
(T->isVariableArrayType() && NewVD->hasGlobalStorage())) {
|
(T->isVariableArrayType() && NewVD->hasGlobalStorage())) {
|
||||||
|
@ -10644,7 +10644,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VDecl->hasLocalStorage())
|
if (VDecl->hasLocalStorage())
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
if (DiagnoseUnexpandedParameterPack(Init, UPPC_Initializer)) {
|
if (DiagnoseUnexpandedParameterPack(Init, UPPC_Initializer)) {
|
||||||
VDecl->setInvalidDecl();
|
VDecl->setInvalidDecl();
|
||||||
|
@ -11178,11 +11178,11 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
|
||||||
if (const RecordType *Record
|
if (const RecordType *Record
|
||||||
= Context.getBaseElementType(Type)->getAs<RecordType>()) {
|
= Context.getBaseElementType(Type)->getAs<RecordType>()) {
|
||||||
CXXRecordDecl *CXXRecord = cast<CXXRecordDecl>(Record->getDecl());
|
CXXRecordDecl *CXXRecord = cast<CXXRecordDecl>(Record->getDecl());
|
||||||
// Mark the function (if we're in one) for further checking even if the
|
// Mark the function for further checking even if the looser rules of
|
||||||
// looser rules of C++11 do not require such checks, so that we can
|
// C++11 do not require such checks, so that we can diagnose
|
||||||
// diagnose incompatibilities with C++98.
|
// incompatibilities with C++98.
|
||||||
if (!CXXRecord->isPOD())
|
if (!CXXRecord->isPOD())
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11318,14 +11318,13 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) {
|
||||||
|
|
||||||
case Qualifiers::OCL_Weak:
|
case Qualifiers::OCL_Weak:
|
||||||
case Qualifiers::OCL_Strong:
|
case Qualifiers::OCL_Strong:
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var->hasLocalStorage() &&
|
if (var->getType().isDestructedType() == QualType::DK_nontrivial_c_struct)
|
||||||
var->getType().isDestructedType() == QualType::DK_nontrivial_c_struct)
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
setFunctionHasBranchProtectedScope();
|
|
||||||
|
|
||||||
// Warn about externally-visible variables being defined without a
|
// Warn about externally-visible variables being defined without a
|
||||||
// prior declaration. We only want to do this for global
|
// prior declaration. We only want to do this for global
|
||||||
|
|
|
@ -13126,7 +13126,7 @@ ExprResult Sema::ActOnBlockStmtExpr(SourceLocation CaretLoc,
|
||||||
for (const auto &CI : Result->getBlockDecl()->captures()) {
|
for (const auto &CI : Result->getBlockDecl()->captures()) {
|
||||||
const VarDecl *var = CI.getVariable();
|
const VarDecl *var = CI.getVariable();
|
||||||
if (var->getType().isDestructedType() != QualType::DK_none) {
|
if (var->getType().isDestructedType() != QualType::DK_none) {
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1114,9 +1114,8 @@ bool Sema::CheckCXXThisCapture(SourceLocation Loc, const bool Explicit,
|
||||||
|
|
||||||
assert((!ByCopy || Explicit) && "cannot implicitly capture *this by value");
|
assert((!ByCopy || Explicit) && "cannot implicitly capture *this by value");
|
||||||
|
|
||||||
const int MaxFunctionScopesIndex = FunctionScopeIndexToStopAt
|
const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt ?
|
||||||
? *FunctionScopeIndexToStopAt
|
*FunctionScopeIndexToStopAt : FunctionScopes.size() - 1;
|
||||||
: FunctionScopes.size() - 1;
|
|
||||||
|
|
||||||
// Check that we can capture the *enclosing object* (referred to by '*this')
|
// Check that we can capture the *enclosing object* (referred to by '*this')
|
||||||
// by the capturing-entity/closure (lambda/block/etc) at
|
// by the capturing-entity/closure (lambda/block/etc) at
|
||||||
|
@ -1142,7 +1141,7 @@ bool Sema::CheckCXXThisCapture(SourceLocation Loc, const bool Explicit,
|
||||||
|
|
||||||
|
|
||||||
unsigned NumCapturingClosures = 0;
|
unsigned NumCapturingClosures = 0;
|
||||||
for (int idx = MaxFunctionScopesIndex; idx >= 0; idx--) {
|
for (unsigned idx = MaxFunctionScopesIndex; idx != 0; idx--) {
|
||||||
if (CapturingScopeInfo *CSI =
|
if (CapturingScopeInfo *CSI =
|
||||||
dyn_cast<CapturingScopeInfo>(FunctionScopes[idx])) {
|
dyn_cast<CapturingScopeInfo>(FunctionScopes[idx])) {
|
||||||
if (CSI->CXXThisCaptureIndex != 0) {
|
if (CSI->CXXThisCaptureIndex != 0) {
|
||||||
|
@ -1197,8 +1196,8 @@ bool Sema::CheckCXXThisCapture(SourceLocation Loc, const bool Explicit,
|
||||||
// FIXME: We need to delay this marking in PotentiallyPotentiallyEvaluated
|
// FIXME: We need to delay this marking in PotentiallyPotentiallyEvaluated
|
||||||
// contexts.
|
// contexts.
|
||||||
QualType ThisTy = getCurrentThisType();
|
QualType ThisTy = getCurrentThisType();
|
||||||
for (int idx = MaxFunctionScopesIndex; NumCapturingClosures;
|
for (unsigned idx = MaxFunctionScopesIndex; NumCapturingClosures;
|
||||||
--idx, --NumCapturingClosures) {
|
--idx, --NumCapturingClosures) {
|
||||||
CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FunctionScopes[idx]);
|
CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FunctionScopes[idx]);
|
||||||
Expr *ThisExpr = nullptr;
|
Expr *ThisExpr = nullptr;
|
||||||
|
|
||||||
|
@ -7177,6 +7176,9 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
|
||||||
|
|
||||||
const bool IsFullExprInstantiationDependent = FE->isInstantiationDependent();
|
const bool IsFullExprInstantiationDependent = FE->isInstantiationDependent();
|
||||||
|
|
||||||
|
ArrayRef<const FunctionScopeInfo *> FunctionScopesArrayRef(
|
||||||
|
S.FunctionScopes.data(), S.FunctionScopes.size());
|
||||||
|
|
||||||
// All the potentially captureable variables in the current nested
|
// All the potentially captureable variables in the current nested
|
||||||
// lambda (within a generic outer lambda), must be captured by an
|
// lambda (within a generic outer lambda), must be captured by an
|
||||||
// outer lambda that is enclosed within a non-dependent context.
|
// outer lambda that is enclosed within a non-dependent context.
|
||||||
|
@ -7205,7 +7207,7 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
|
||||||
// capture the variable in that lambda (and all its enclosing lambdas).
|
// capture the variable in that lambda (and all its enclosing lambdas).
|
||||||
if (const Optional<unsigned> Index =
|
if (const Optional<unsigned> Index =
|
||||||
getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
||||||
S.FunctionScopes, Var, S)) {
|
FunctionScopesArrayRef, Var, S)) {
|
||||||
const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
|
const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
|
||||||
MarkVarDeclODRUsed(Var, VarExpr->getExprLoc(), S,
|
MarkVarDeclODRUsed(Var, VarExpr->getExprLoc(), S,
|
||||||
&FunctionScopeIndexOfCapturableLambda);
|
&FunctionScopeIndexOfCapturableLambda);
|
||||||
|
@ -7241,7 +7243,7 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
|
||||||
// 'this' in that lambda (and all its enclosing lambdas).
|
// 'this' in that lambda (and all its enclosing lambdas).
|
||||||
if (const Optional<unsigned> Index =
|
if (const Optional<unsigned> Index =
|
||||||
getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
getStackIndexOfNearestEnclosingCaptureCapableLambda(
|
||||||
S.FunctionScopes, /*0 is 'this'*/ nullptr, S)) {
|
FunctionScopesArrayRef, /*0 is 'this'*/ nullptr, S)) {
|
||||||
const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
|
const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
|
||||||
S.CheckCXXThisCapture(CurrentLSI->PotentialThisCaptureLocation,
|
S.CheckCXXThisCapture(CurrentLSI->PotentialThisCaptureLocation,
|
||||||
/*Explicit*/ false, /*BuildAndDiagnose*/ true,
|
/*Explicit*/ false, /*BuildAndDiagnose*/ true,
|
||||||
|
|
|
@ -3572,7 +3572,7 @@ StmtResult Sema::ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
// longjmp() and throw() must not violate the entry/exit criteria.
|
// longjmp() and throw() must not violate the entry/exit criteria.
|
||||||
CS->getCapturedDecl()->setNothrow();
|
CS->getCapturedDecl()->setNothrow();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPParallelDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
return OMPParallelDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
||||||
DSAStack->isCancelRegion());
|
DSAStack->isCancelRegion());
|
||||||
|
@ -5281,7 +5281,7 @@ StmtResult Sema::ActOnOpenMPSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPSimdDirective::Create(Context, StartLoc, EndLoc, NestedLoopCount,
|
return OMPSimdDirective::Create(Context, StartLoc, EndLoc, NestedLoopCount,
|
||||||
Clauses, AStmt, B);
|
Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -5317,7 +5317,7 @@ StmtResult Sema::ActOnOpenMPForDirective(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPForDirective::Create(Context, StartLoc, EndLoc, NestedLoopCount,
|
return OMPForDirective::Create(Context, StartLoc, EndLoc, NestedLoopCount,
|
||||||
Clauses, AStmt, B, DSAStack->isCancelRegion());
|
Clauses, AStmt, B, DSAStack->isCancelRegion());
|
||||||
}
|
}
|
||||||
|
@ -5357,7 +5357,7 @@ StmtResult Sema::ActOnOpenMPForSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPForSimdDirective::Create(Context, StartLoc, EndLoc, NestedLoopCount,
|
return OMPForSimdDirective::Create(Context, StartLoc, EndLoc, NestedLoopCount,
|
||||||
Clauses, AStmt, B);
|
Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -5394,7 +5394,7 @@ StmtResult Sema::ActOnOpenMPSectionsDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
return StmtError();
|
return StmtError();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPSectionsDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
return OMPSectionsDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
||||||
DSAStack->isCancelRegion());
|
DSAStack->isCancelRegion());
|
||||||
|
@ -5408,7 +5408,7 @@ StmtResult Sema::ActOnOpenMPSectionDirective(Stmt *AStmt,
|
||||||
|
|
||||||
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
DSAStack->setParentCancelRegion(DSAStack->isCancelRegion());
|
DSAStack->setParentCancelRegion(DSAStack->isCancelRegion());
|
||||||
|
|
||||||
return OMPSectionDirective::Create(Context, StartLoc, EndLoc, AStmt,
|
return OMPSectionDirective::Create(Context, StartLoc, EndLoc, AStmt,
|
||||||
|
@ -5424,7 +5424,7 @@ StmtResult Sema::ActOnOpenMPSingleDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
|
|
||||||
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
// OpenMP [2.7.3, single Construct, Restrictions]
|
// OpenMP [2.7.3, single Construct, Restrictions]
|
||||||
// The copyprivate clause must not be used with the nowait clause.
|
// The copyprivate clause must not be used with the nowait clause.
|
||||||
|
@ -5454,7 +5454,7 @@ StmtResult Sema::ActOnOpenMPMasterDirective(Stmt *AStmt,
|
||||||
|
|
||||||
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPMasterDirective::Create(Context, StartLoc, EndLoc, AStmt);
|
return OMPMasterDirective::Create(Context, StartLoc, EndLoc, AStmt);
|
||||||
}
|
}
|
||||||
|
@ -5508,7 +5508,7 @@ StmtResult Sema::ActOnOpenMPCriticalDirective(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
auto *Dir = OMPCriticalDirective::Create(Context, DirName, StartLoc, EndLoc,
|
auto *Dir = OMPCriticalDirective::Create(Context, DirName, StartLoc, EndLoc,
|
||||||
Clauses, AStmt);
|
Clauses, AStmt);
|
||||||
|
@ -5556,7 +5556,7 @@ StmtResult Sema::ActOnOpenMPParallelForDirective(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPParallelForDirective::Create(Context, StartLoc, EndLoc,
|
return OMPParallelForDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt, B,
|
NestedLoopCount, Clauses, AStmt, B,
|
||||||
DSAStack->isCancelRegion());
|
DSAStack->isCancelRegion());
|
||||||
|
@ -5601,7 +5601,7 @@ StmtResult Sema::ActOnOpenMPParallelForSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPParallelForSimdDirective::Create(
|
return OMPParallelForSimdDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -5639,7 +5639,7 @@ Sema::ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
return StmtError();
|
return StmtError();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPParallelSectionsDirective::Create(
|
return OMPParallelSectionsDirective::Create(
|
||||||
Context, StartLoc, EndLoc, Clauses, AStmt, DSAStack->isCancelRegion());
|
Context, StartLoc, EndLoc, Clauses, AStmt, DSAStack->isCancelRegion());
|
||||||
|
@ -5659,7 +5659,7 @@ StmtResult Sema::ActOnOpenMPTaskDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
// longjmp() and throw() must not violate the entry/exit criteria.
|
// longjmp() and throw() must not violate the entry/exit criteria.
|
||||||
CS->getCapturedDecl()->setNothrow();
|
CS->getCapturedDecl()->setNothrow();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPTaskDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
return OMPTaskDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
||||||
DSAStack->isCancelRegion());
|
DSAStack->isCancelRegion());
|
||||||
|
@ -5689,7 +5689,7 @@ StmtResult Sema::ActOnOpenMPTaskgroupDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
|
|
||||||
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPTaskgroupDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
return OMPTaskgroupDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
||||||
AStmt,
|
AStmt,
|
||||||
|
@ -5772,7 +5772,7 @@ StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
if (AStmt) {
|
if (AStmt) {
|
||||||
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
return OMPOrderedDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt);
|
return OMPOrderedDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt);
|
||||||
|
@ -6442,7 +6442,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPAtomicDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
return OMPAtomicDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt,
|
||||||
X, V, E, UE, IsXLHSInRHSPart,
|
X, V, E, UE, IsXLHSInRHSPart,
|
||||||
|
@ -6507,7 +6507,7 @@ StmtResult Sema::ActOnOpenMPTargetDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPTargetDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt);
|
return OMPTargetDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt);
|
||||||
}
|
}
|
||||||
|
@ -6537,7 +6537,7 @@ Sema::ActOnOpenMPTargetParallelDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
CS->getCapturedDecl()->setNothrow();
|
CS->getCapturedDecl()->setNothrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPTargetParallelDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
return OMPTargetParallelDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
||||||
AStmt);
|
AStmt);
|
||||||
|
@ -6592,7 +6592,7 @@ StmtResult Sema::ActOnOpenMPTargetParallelForDirective(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetParallelForDirective::Create(Context, StartLoc, EndLoc,
|
return OMPTargetParallelForDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt,
|
NestedLoopCount, Clauses, AStmt,
|
||||||
B, DSAStack->isCancelRegion());
|
B, DSAStack->isCancelRegion());
|
||||||
|
@ -6629,7 +6629,7 @@ StmtResult Sema::ActOnOpenMPTargetDataDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
return StmtError();
|
return StmtError();
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPTargetDataDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
return OMPTargetDataDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
||||||
AStmt);
|
AStmt);
|
||||||
|
@ -6756,7 +6756,7 @@ StmtResult Sema::ActOnOpenMPTeamsDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
// longjmp() and throw() must not violate the entry/exit criteria.
|
// longjmp() and throw() must not violate the entry/exit criteria.
|
||||||
CS->getCapturedDecl()->setNothrow();
|
CS->getCapturedDecl()->setNothrow();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
||||||
|
|
||||||
|
@ -6879,7 +6879,7 @@ StmtResult Sema::ActOnOpenMPTaskLoopDirective(
|
||||||
if (checkReductionClauseWithNogroup(*this, Clauses))
|
if (checkReductionClauseWithNogroup(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTaskLoopDirective::Create(Context, StartLoc, EndLoc,
|
return OMPTaskLoopDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt, B);
|
NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -6929,7 +6929,7 @@ StmtResult Sema::ActOnOpenMPTaskLoopSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTaskLoopSimdDirective::Create(Context, StartLoc, EndLoc,
|
return OMPTaskLoopSimdDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt, B);
|
NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -6955,7 +6955,7 @@ StmtResult Sema::ActOnOpenMPDistributeDirective(
|
||||||
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
||||||
"omp for loop exprs were not built");
|
"omp for loop exprs were not built");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPDistributeDirective::Create(Context, StartLoc, EndLoc,
|
return OMPDistributeDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt, B);
|
NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -6999,7 +6999,7 @@ StmtResult Sema::ActOnOpenMPDistributeParallelForDirective(
|
||||||
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
||||||
"omp for loop exprs were not built");
|
"omp for loop exprs were not built");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPDistributeParallelForDirective::Create(
|
return OMPDistributeParallelForDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B,
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B,
|
||||||
DSAStack->isCancelRegion());
|
DSAStack->isCancelRegion());
|
||||||
|
@ -7058,7 +7058,7 @@ StmtResult Sema::ActOnOpenMPDistributeParallelForSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPDistributeParallelForSimdDirective::Create(
|
return OMPDistributeParallelForSimdDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -7115,7 +7115,7 @@ StmtResult Sema::ActOnOpenMPDistributeSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPDistributeSimdDirective::Create(Context, StartLoc, EndLoc,
|
return OMPDistributeSimdDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt, B);
|
NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -7171,7 +7171,7 @@ StmtResult Sema::ActOnOpenMPTargetParallelForSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetParallelForSimdDirective::Create(
|
return OMPTargetParallelForSimdDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -7228,7 +7228,7 @@ StmtResult Sema::ActOnOpenMPTargetSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetSimdDirective::Create(Context, StartLoc, EndLoc,
|
return OMPTargetSimdDirective::Create(Context, StartLoc, EndLoc,
|
||||||
NestedLoopCount, Clauses, AStmt, B);
|
NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -7271,7 +7271,7 @@ StmtResult Sema::ActOnOpenMPTeamsDistributeDirective(
|
||||||
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
||||||
"omp teams distribute loop exprs were not built");
|
"omp teams distribute loop exprs were not built");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
||||||
|
|
||||||
|
@ -7334,7 +7334,7 @@ StmtResult Sema::ActOnOpenMPTeamsDistributeSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
||||||
|
|
||||||
|
@ -7397,7 +7397,7 @@ StmtResult Sema::ActOnOpenMPTeamsDistributeParallelForSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
||||||
|
|
||||||
|
@ -7446,7 +7446,7 @@ StmtResult Sema::ActOnOpenMPTeamsDistributeParallelForDirective(
|
||||||
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
||||||
"omp for loop exprs were not built");
|
"omp for loop exprs were not built");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
DSAStack->setParentTeamsRegionLoc(StartLoc);
|
||||||
|
|
||||||
|
@ -7480,7 +7480,7 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDirective(ArrayRef<OMPClause *> Clauses,
|
||||||
// longjmp() and throw() must not violate the entry/exit criteria.
|
// longjmp() and throw() must not violate the entry/exit criteria.
|
||||||
CS->getCapturedDecl()->setNothrow();
|
CS->getCapturedDecl()->setNothrow();
|
||||||
}
|
}
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
return OMPTargetTeamsDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
return OMPTargetTeamsDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
||||||
AStmt);
|
AStmt);
|
||||||
|
@ -7525,7 +7525,7 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDistributeDirective(
|
||||||
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
assert((CurContext->isDependentContext() || B.builtAll()) &&
|
||||||
"omp target teams distribute loop exprs were not built");
|
"omp target teams distribute loop exprs were not built");
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetTeamsDistributeDirective::Create(
|
return OMPTargetTeamsDistributeDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -7580,7 +7580,7 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDistributeParallelForDirective(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetTeamsDistributeParallelForDirective::Create(
|
return OMPTargetTeamsDistributeParallelForDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B,
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B,
|
||||||
DSAStack->isCancelRegion());
|
DSAStack->isCancelRegion());
|
||||||
|
@ -7641,7 +7641,7 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetTeamsDistributeParallelForSimdDirective::Create(
|
return OMPTargetTeamsDistributeParallelForSimdDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -7699,7 +7699,7 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDistributeSimdDirective(
|
||||||
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
if (checkSimdlenSafelenSpecified(*this, Clauses))
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return OMPTargetTeamsDistributeSimdDirective::Create(
|
return OMPTargetTeamsDistributeSimdDirective::Create(
|
||||||
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B);
|
||||||
}
|
}
|
||||||
|
@ -12450,7 +12450,7 @@ void Sema::ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D) {
|
||||||
|
|
||||||
// Enter new function scope.
|
// Enter new function scope.
|
||||||
PushFunctionScope();
|
PushFunctionScope();
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
getCurFunction()->setHasOMPDeclareReductionCombiner();
|
getCurFunction()->setHasOMPDeclareReductionCombiner();
|
||||||
|
|
||||||
if (S != nullptr)
|
if (S != nullptr)
|
||||||
|
@ -12506,7 +12506,7 @@ VarDecl *Sema::ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D) {
|
||||||
|
|
||||||
// Enter new function scope.
|
// Enter new function scope.
|
||||||
PushFunctionScope();
|
PushFunctionScope();
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
if (S != nullptr)
|
if (S != nullptr)
|
||||||
PushDeclContext(S, DRD);
|
PushDeclContext(S, DRD);
|
||||||
|
|
|
@ -557,7 +557,7 @@ StmtResult Sema::BuildIfStmt(SourceLocation IfLoc, bool IsConstexpr,
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
if (IsConstexpr || isa<ObjCAvailabilityCheckExpr>(Cond.get().second))
|
if (IsConstexpr || isa<ObjCAvailabilityCheckExpr>(Cond.get().second))
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
DiagnoseUnusedExprResult(thenStmt);
|
DiagnoseUnusedExprResult(thenStmt);
|
||||||
DiagnoseUnusedExprResult(elseStmt);
|
DiagnoseUnusedExprResult(elseStmt);
|
||||||
|
@ -688,7 +688,7 @@ StmtResult Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc,
|
||||||
if (Cond.isInvalid())
|
if (Cond.isInvalid())
|
||||||
return StmtError();
|
return StmtError();
|
||||||
|
|
||||||
setFunctionHasBranchIntoScope();
|
getCurFunction()->setHasBranchIntoScope();
|
||||||
|
|
||||||
SwitchStmt *SS = new (Context)
|
SwitchStmt *SS = new (Context)
|
||||||
SwitchStmt(Context, InitStmt, Cond.get().first, Cond.get().second);
|
SwitchStmt(Context, InitStmt, Cond.get().first, Cond.get().second);
|
||||||
|
@ -1873,7 +1873,7 @@ StmtResult
|
||||||
Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
|
Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
|
||||||
Stmt *First, Expr *collection,
|
Stmt *First, Expr *collection,
|
||||||
SourceLocation RParenLoc) {
|
SourceLocation RParenLoc) {
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
|
|
||||||
ExprResult CollectionExprResult =
|
ExprResult CollectionExprResult =
|
||||||
CheckObjCForCollectionOperand(ForLoc, collection);
|
CheckObjCForCollectionOperand(ForLoc, collection);
|
||||||
|
@ -2784,7 +2784,7 @@ StmtResult Sema::FinishCXXForRangeStmt(Stmt *S, Stmt *B) {
|
||||||
StmtResult Sema::ActOnGotoStmt(SourceLocation GotoLoc,
|
StmtResult Sema::ActOnGotoStmt(SourceLocation GotoLoc,
|
||||||
SourceLocation LabelLoc,
|
SourceLocation LabelLoc,
|
||||||
LabelDecl *TheDecl) {
|
LabelDecl *TheDecl) {
|
||||||
setFunctionHasBranchIntoScope();
|
getCurFunction()->setHasBranchIntoScope();
|
||||||
TheDecl->markUsed(Context);
|
TheDecl->markUsed(Context);
|
||||||
return new (Context) GotoStmt(TheDecl, GotoLoc, LabelLoc);
|
return new (Context) GotoStmt(TheDecl, GotoLoc, LabelLoc);
|
||||||
}
|
}
|
||||||
|
@ -2811,7 +2811,7 @@ Sema::ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc,
|
||||||
return StmtError();
|
return StmtError();
|
||||||
E = ExprRes.get();
|
E = ExprRes.get();
|
||||||
|
|
||||||
setFunctionHasIndirectGoto();
|
getCurFunction()->setHasIndirectGoto();
|
||||||
|
|
||||||
return new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E);
|
return new (Context) IndirectGotoStmt(GotoLoc, StarLoc, E);
|
||||||
}
|
}
|
||||||
|
@ -3607,7 +3607,7 @@ Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try,
|
||||||
if (!getLangOpts().ObjCExceptions)
|
if (!getLangOpts().ObjCExceptions)
|
||||||
Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@try";
|
Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@try";
|
||||||
|
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
unsigned NumCatchStmts = CatchStmts.size();
|
unsigned NumCatchStmts = CatchStmts.size();
|
||||||
return ObjCAtTryStmt::Create(Context, AtLoc, Try, CatchStmts.data(),
|
return ObjCAtTryStmt::Create(Context, AtLoc, Try, CatchStmts.data(),
|
||||||
NumCatchStmts, Finally);
|
NumCatchStmts, Finally);
|
||||||
|
@ -3698,7 +3698,7 @@ StmtResult
|
||||||
Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr,
|
Sema::ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SyncExpr,
|
||||||
Stmt *SyncBody) {
|
Stmt *SyncBody) {
|
||||||
// We can't jump into or indirect-jump out of a @synchronized block.
|
// We can't jump into or indirect-jump out of a @synchronized block.
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return new (Context) ObjCAtSynchronizedStmt(AtLoc, SyncExpr, SyncBody);
|
return new (Context) ObjCAtSynchronizedStmt(AtLoc, SyncExpr, SyncBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3714,7 +3714,7 @@ Sema::ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl,
|
||||||
|
|
||||||
StmtResult
|
StmtResult
|
||||||
Sema::ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body) {
|
Sema::ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body) {
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
return new (Context) ObjCAutoreleasePoolStmt(AtLoc, Body);
|
return new (Context) ObjCAutoreleasePoolStmt(AtLoc, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -793,7 +793,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc,
|
||||||
ArrayRef<Expr*> Exprs,
|
ArrayRef<Expr*> Exprs,
|
||||||
SourceLocation EndLoc) {
|
SourceLocation EndLoc) {
|
||||||
bool IsSimple = (NumOutputs != 0 || NumInputs != 0);
|
bool IsSimple = (NumOutputs != 0 || NumInputs != 0);
|
||||||
setFunctionHasBranchProtectedScope();
|
getCurFunction()->setHasBranchProtectedScope();
|
||||||
MSAsmStmt *NS =
|
MSAsmStmt *NS =
|
||||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, IsSimple,
|
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, IsSimple,
|
||||||
/*IsVolatile*/ true, AsmToks, NumOutputs, NumInputs,
|
/*IsVolatile*/ true, AsmToks, NumOutputs, NumInputs,
|
||||||
|
|
Loading…
Reference in New Issue