@@ -14195,29 +14195,29 @@ StmtResult SemaOpenMP::ActOnOpenMPTargetTeamsDistributeSimdDirective(
14195
14195
}
14196
14196
14197
14197
/// Overloaded base case function
14198
- template <typename T, typename F> static bool tryHandleAs(T *t , F &&) {
14198
+ template <typename T, typename F> static bool tryHandleAs(T *, F &&) {
14199
14199
return false;
14200
14200
}
14201
14201
14202
- /// Tries to recursively cast `t ` to one of the given types and invokes `f` if
14203
- /// successful.
14202
+ /// Tries to recursively cast `Type ` to one of the given types and invokes
14203
+ /// `Func` if successful.
14204
14204
///
14205
- /// @ tparam Class The first type to check.
14206
- /// @ tparam Rest The remaining types to check.
14207
- /// @ tparam T The base type of `t `.
14208
- /// @ tparam F The callable type for the function to invoke upon a successful
14205
+ /// \ tparam Class The first type to check.
14206
+ /// \ tparam Rest The remaining types to check.
14207
+ /// \ tparam T The base type of `Type `.
14208
+ /// \ tparam F The callable type for the function to invoke upon a successful
14209
14209
/// cast.
14210
- /// @ param t The object to be checked.
14211
- /// @ param f The function to invoke if `t ` matches `Class`.
14212
- /// @ return `true` if `t ` matched any type and `f ` was called, otherwise
14210
+ /// \ param Type The object to be checked.
14211
+ /// \ param Func The function to invoke if `Type ` matches `Class`.
14212
+ /// \ return `true` if `Type ` matched any type and `Func ` was called, otherwise
14213
14213
/// `false`.
14214
14214
template <typename Class, typename... Rest, typename T, typename F>
14215
- static bool tryHandleAs(T *t , F &&f ) {
14216
- if (Class *c = dyn_cast<Class>(t )) {
14217
- f(c );
14215
+ static bool tryHandleAs(T *Type , F &&Func ) {
14216
+ if (Class *C = dyn_cast<Class>(Type )) {
14217
+ Func(C );
14218
14218
return true;
14219
14219
}
14220
- return tryHandleAs<Rest...>(t , std::forward<F>(f ));
14220
+ return tryHandleAs<Rest...>(Type , std::forward<F>(Func ));
14221
14221
}
14222
14222
14223
14223
/// Updates OriginalInits by checking Transform against loop transformation
@@ -14297,7 +14297,7 @@ bool SemaOpenMP::checkTransformableLoopNest(
14297
14297
/// }
14298
14298
/// }
14299
14299
/// Result: Loop 'i' contains 2 loops, Loop 'r' also contains 2 loops
14300
- class NestedLoopCounterVisitor : public DynamicRecursiveASTVisitor {
14300
+ class NestedLoopCounterVisitor final : public DynamicRecursiveASTVisitor {
14301
14301
private:
14302
14302
unsigned NestedLoopCount = 0;
14303
14303
@@ -14385,22 +14385,21 @@ bool SemaOpenMP::analyzeLoopSequence(
14385
14385
LoopSeqSize += NumGeneratedLoopNests;
14386
14386
NumLoops += NumGeneratedLoops;
14387
14387
return true;
14388
- } else {
14389
- // Unroll full (0 loops produced)
14390
- Diag(Child->getBeginLoc(), diag::err_omp_not_for)
14391
- << 0 << getOpenMPDirectiveName(Kind);
14392
- return false;
14393
14388
}
14389
+ // Unroll full (0 loops produced)
14390
+ Diag(Child->getBeginLoc(), diag::err_omp_not_for)
14391
+ << 0 << getOpenMPDirectiveName(Kind);
14392
+ return false;
14394
14393
}
14395
14394
// Handle loop transformations with multiple loop nests
14396
14395
// Unroll full
14397
- if (NumGeneratedLoopNests <= 0 ) {
14396
+ if (! NumGeneratedLoopNests) {
14398
14397
Diag(Child->getBeginLoc(), diag::err_omp_not_for)
14399
14398
<< 0 << getOpenMPDirectiveName(Kind);
14400
14399
return false;
14401
14400
}
14402
14401
// Loop transformatons such as split or loopranged fuse
14403
- else if (NumGeneratedLoopNests > 1) {
14402
+ if (NumGeneratedLoopNests > 1) {
14404
14403
// Get the preinits related to this loop sequence generating
14405
14404
// loop transformation (i.e loopranged fuse, split...)
14406
14405
LoopSequencePreInits.emplace_back();
@@ -14413,30 +14412,29 @@ bool SemaOpenMP::analyzeLoopSequence(
14413
14412
LoopHelpers, ForStmts, OriginalInits,
14414
14413
TransformsPreInits, LoopSequencePreInits,
14415
14414
LoopCategories, Context, Kind);
14416
- } else {
14417
- // Vast majority: (Tile, Unroll, Stripe, Reverse, Interchange, Fuse all)
14418
- // Process the transformed loop statement
14419
- OriginalInits.emplace_back();
14420
- TransformsPreInits.emplace_back();
14421
- LoopHelpers.emplace_back();
14422
- LoopCategories.push_back(OMPLoopCategory::TransformSingleLoop);
14423
-
14424
- unsigned IsCanonical =
14425
- checkOpenMPLoop(Kind, nullptr, nullptr, TransformedStmt, SemaRef,
14426
- *DSAStack, TmpDSA, LoopHelpers[LoopSeqSize]);
14427
-
14428
- if (!IsCanonical) {
14429
- Diag(TransformedStmt->getBeginLoc(), diag::err_omp_not_canonical_loop)
14430
- << getOpenMPDirectiveName(Kind);
14431
- return false;
14432
- }
14433
- StoreLoopStatements(TransformedStmt);
14434
- updatePreInits(LoopTransform, TransformsPreInits);
14415
+ }
14416
+ // Vast majority: (Tile, Unroll, Stripe, Reverse, Interchange, Fuse all)
14417
+ // Process the transformed loop statement
14418
+ OriginalInits.emplace_back();
14419
+ TransformsPreInits.emplace_back();
14420
+ LoopHelpers.emplace_back();
14421
+ LoopCategories.push_back(OMPLoopCategory::TransformSingleLoop);
14435
14422
14436
- NumLoops += NumGeneratedLoops;
14437
- ++LoopSeqSize;
14438
- return true;
14423
+ unsigned IsCanonical =
14424
+ checkOpenMPLoop(Kind, nullptr, nullptr, TransformedStmt, SemaRef,
14425
+ *DSAStack, TmpDSA, LoopHelpers[LoopSeqSize]);
14426
+
14427
+ if (!IsCanonical) {
14428
+ Diag(TransformedStmt->getBeginLoc(), diag::err_omp_not_canonical_loop)
14429
+ << getOpenMPDirectiveName(Kind);
14430
+ return false;
14439
14431
}
14432
+ StoreLoopStatements(TransformedStmt);
14433
+ updatePreInits(LoopTransform, TransformsPreInits);
14434
+
14435
+ NumLoops += NumGeneratedLoops;
14436
+ ++LoopSeqSize;
14437
+ return true;
14440
14438
};
14441
14439
14442
14440
/// Modularized code for handling regular canonical loops
@@ -16303,7 +16301,7 @@ StmtResult SemaOpenMP::ActOnOpenMPFuseDirective(ArrayRef<OMPClause *> Clauses,
16303
16301
// Only TransformSingleLoop requires inserting pre-inits here
16304
16302
16305
16303
if (LoopCategories[I] == OMPLoopCategory::TransformSingleLoop) {
16306
- auto TransformPreInit = TransformsPreInits[TransformIndex++];
16304
+ const auto & TransformPreInit = TransformsPreInits[TransformIndex++];
16307
16305
if (!TransformPreInit.empty()) {
16308
16306
llvm::append_range(PreInits, TransformPreInit);
16309
16307
}
@@ -17456,15 +17454,13 @@ OMPClause *SemaOpenMP::ActOnOpenMPLoopRangeClause(
17456
17454
if (CountVal.isInvalid())
17457
17455
Count = nullptr;
17458
17456
17459
- SmallVector<Expr *, 2> ArgsVec = {First, Count};
17460
-
17461
17457
// OpenMP [6.0, Restrictions]
17462
17458
// first + count - 1 must not evaluate to a value greater than the
17463
17459
// loop sequence length of the associated canonical loop sequence.
17464
17460
// This check must be performed afterwards due to the delayed
17465
17461
// parsing and computation of the associated loop sequence
17466
17462
return OMPLoopRangeClause::Create(getASTContext(), StartLoc, LParenLoc,
17467
- FirstLoc, CountLoc, EndLoc, ArgsVec );
17463
+ FirstLoc, CountLoc, EndLoc, First, Count );
17468
17464
}
17469
17465
17470
17466
OMPClause *SemaOpenMP::ActOnOpenMPAlignClause(Expr *A, SourceLocation StartLoc,
0 commit comments