@@ -14212,29 +14212,29 @@ StmtResult SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(
14212
14212
}
14213
14213
14214
14214
/// Overloaded base case function
14215
- template <typename T, typename F> static bool tryHandleAs(T *t , F &&) {
14215
+ template <typename T, typename F> static bool tryHandleAs(T *, F &&) {
14216
14216
return false;
14217
14217
}
14218
14218
14219
- /// Tries to recursively cast `t ` to one of the given types and invokes `f` if
14220
- /// successful.
14219
+ /// Tries to recursively cast `Type ` to one of the given types and invokes
14220
+ /// `Func` if successful.
14221
14221
///
14222
- /// @ tparam Class The first type to check.
14223
- /// @ tparam Rest The remaining types to check.
14224
- /// @ tparam T The base type of `t `.
14225
- /// @ tparam F The callable type for the function to invoke upon a successful
14222
+ /// \ tparam Class The first type to check.
14223
+ /// \ tparam Rest The remaining types to check.
14224
+ /// \ tparam T The base type of `Type `.
14225
+ /// \ tparam F The callable type for the function to invoke upon a successful
14226
14226
/// cast.
14227
- /// @ param t The object to be checked.
14228
- /// @ param f The function to invoke if `t ` matches `Class`.
14229
- /// @ return `true` if `t ` matched any type and `f ` was called, otherwise
14227
+ /// \ param Type The object to be checked.
14228
+ /// \ param Func The function to invoke if `Type ` matches `Class`.
14229
+ /// \ return `true` if `Type ` matched any type and `Func ` was called, otherwise
14230
14230
/// `false`.
14231
14231
template <typename Class, typename... Rest, typename T, typename F>
14232
- static bool tryHandleAs(T *t , F &&f ) {
14233
- if (Class *c = dyn_cast<Class>(t )) {
14234
- f(c );
14232
+ static bool tryHandleAs(T *Type , F &&Func ) {
14233
+ if (Class *C = dyn_cast<Class>(Type )) {
14234
+ Func(C );
14235
14235
return true;
14236
14236
}
14237
- return tryHandleAs<Rest...>(t , std::forward<F>(f ));
14237
+ return tryHandleAs<Rest...>(Type , std::forward<F>(Func ));
14238
14238
}
14239
14239
14240
14240
/// Updates OriginalInits by checking Transform against loop transformation
@@ -14314,7 +14314,7 @@ bool SemaOpenMP::checkTransformableLoopNest(
14314
14314
/// }
14315
14315
/// }
14316
14316
/// Result: Loop 'i' contains 2 loops, Loop 'r' also contains 2 loops
14317
- class NestedLoopCounterVisitor : public DynamicRecursiveASTVisitor {
14317
+ class NestedLoopCounterVisitor final : public DynamicRecursiveASTVisitor {
14318
14318
private:
14319
14319
unsigned NestedLoopCount = 0;
14320
14320
@@ -14402,22 +14402,21 @@ bool SemaOpenMP::analyzeLoopSequence(
14402
14402
LoopSeqSize += NumGeneratedLoopNests;
14403
14403
NumLoops += NumGeneratedLoops;
14404
14404
return true;
14405
- } else {
14406
- // Unroll full (0 loops produced)
14407
- Diag(Child->getBeginLoc(), diag::err_omp_not_for)
14408
- << 0 << getOpenMPDirectiveName(Kind);
14409
- return false;
14410
14405
}
14406
+ // Unroll full (0 loops produced)
14407
+ Diag(Child->getBeginLoc(), diag::err_omp_not_for)
14408
+ << 0 << getOpenMPDirectiveName(Kind);
14409
+ return false;
14411
14410
}
14412
14411
// Handle loop transformations with multiple loop nests
14413
14412
// Unroll full
14414
- if (NumGeneratedLoopNests <= 0 ) {
14413
+ if (! NumGeneratedLoopNests) {
14415
14414
Diag(Child->getBeginLoc(), diag::err_omp_not_for)
14416
14415
<< 0 << getOpenMPDirectiveName(Kind);
14417
14416
return false;
14418
14417
}
14419
14418
// Loop transformatons such as split or loopranged fuse
14420
- else if (NumGeneratedLoopNests > 1) {
14419
+ if (NumGeneratedLoopNests > 1) {
14421
14420
// Get the preinits related to this loop sequence generating
14422
14421
// loop transformation (i.e loopranged fuse, split...)
14423
14422
LoopSequencePreInits.emplace_back();
@@ -14430,30 +14429,29 @@ bool SemaOpenMP::analyzeLoopSequence(
14430
14429
LoopHelpers, ForStmts, OriginalInits,
14431
14430
TransformsPreInits, LoopSequencePreInits,
14432
14431
LoopCategories, Context, Kind);
14433
- } else {
14434
- // Vast majority: (Tile, Unroll, Stripe, Reverse, Interchange, Fuse all)
14435
- // Process the transformed loop statement
14436
- OriginalInits.emplace_back();
14437
- TransformsPreInits.emplace_back();
14438
- LoopHelpers.emplace_back();
14439
- LoopCategories.push_back(OMPLoopCategory::TransformSingleLoop);
14440
-
14441
- unsigned IsCanonical =
14442
- checkOpenMPLoop(Kind, nullptr, nullptr, TransformedStmt, SemaRef,
14443
- *DSAStack, TmpDSA, LoopHelpers[LoopSeqSize]);
14444
-
14445
- if (!IsCanonical) {
14446
- Diag(TransformedStmt->getBeginLoc(), diag::err_omp_not_canonical_loop)
14447
- << getOpenMPDirectiveName(Kind);
14448
- return false;
14449
- }
14450
- StoreLoopStatements(TransformedStmt);
14451
- updatePreInits(LoopTransform, TransformsPreInits);
14432
+ }
14433
+ // Vast majority: (Tile, Unroll, Stripe, Reverse, Interchange, Fuse all)
14434
+ // Process the transformed loop statement
14435
+ OriginalInits.emplace_back();
14436
+ TransformsPreInits.emplace_back();
14437
+ LoopHelpers.emplace_back();
14438
+ LoopCategories.push_back(OMPLoopCategory::TransformSingleLoop);
14452
14439
14453
- NumLoops += NumGeneratedLoops;
14454
- ++LoopSeqSize;
14455
- return true;
14440
+ unsigned IsCanonical =
14441
+ checkOpenMPLoop(Kind, nullptr, nullptr, TransformedStmt, SemaRef,
14442
+ *DSAStack, TmpDSA, LoopHelpers[LoopSeqSize]);
14443
+
14444
+ if (!IsCanonical) {
14445
+ Diag(TransformedStmt->getBeginLoc(), diag::err_omp_not_canonical_loop)
14446
+ << getOpenMPDirectiveName(Kind);
14447
+ return false;
14456
14448
}
14449
+ StoreLoopStatements(TransformedStmt);
14450
+ updatePreInits(LoopTransform, TransformsPreInits);
14451
+
14452
+ NumLoops += NumGeneratedLoops;
14453
+ ++LoopSeqSize;
14454
+ return true;
14457
14455
};
14458
14456
14459
14457
/// Modularized code for handling regular canonical loops
@@ -16320,7 +16318,7 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
16320
16318
// Only TransformSingleLoop requires inserting pre-inits here
16321
16319
16322
16320
if (LoopCategories[I] == OMPLoopCategory::TransformSingleLoop) {
16323
- auto TransformPreInit = TransformsPreInits[TransformIndex++];
16321
+ const auto & TransformPreInit = TransformsPreInits[TransformIndex++];
16324
16322
if (!TransformPreInit.empty()) {
16325
16323
llvm::append_range(PreInits, TransformPreInit);
16326
16324
}
@@ -17483,15 +17481,13 @@ OMPClause *SemaOpenMP::ActOnOpenMPLoopRangeClause(
17483
17481
if (CountVal.isInvalid())
17484
17482
Count = nullptr;
17485
17483
17486
- SmallVector<Expr *, 2> ArgsVec = {First, Count};
17487
-
17488
17484
// OpenMP [6.0, Restrictions]
17489
17485
// first + count - 1 must not evaluate to a value greater than the
17490
17486
// loop sequence length of the associated canonical loop sequence.
17491
17487
// This check must be performed afterwards due to the delayed
17492
17488
// parsing and computation of the associated loop sequence
17493
17489
return OMPLoopRangeClause::Create(getASTContext(), StartLoc, LParenLoc,
17494
- FirstLoc, CountLoc, EndLoc, ArgsVec );
17490
+ FirstLoc, CountLoc, EndLoc, First, Count );
17495
17491
}
17496
17492
17497
17493
OMPClause *SemaOpenMP::ActOnOpenMPAlignClause(Expr *A, SourceLocation StartLoc,
0 commit comments