[clang] [clang][OpenMP] Place some common code in functions (PR #96811)

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 26 12:14:54 PDT 2024


================
@@ -7994,13 +8016,9 @@ void SemaOpenMP::ActOnOpenMPDeclareVariantDirective(
   FD->addAttr(NewAttr);
 }
 
-StmtResult
-SemaOpenMP::ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,
-                                         Stmt *AStmt, SourceLocation StartLoc,
-                                         SourceLocation EndLoc) {
-  if (!AStmt)
-    return StmtError();
-
+static CapturedStmt *
+setBranchProtectedScope(Sema &SemaRef, OpenMPDirectiveKind DKind, Stmt *AStmt) {
+  assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
   auto *CS = cast<CapturedStmt>(AStmt);
----------------
alexey-bataev wrote:

```
auto *CS = dyn_cast<CapturedStmt>(AStmt);
assert(CS && ...);
```

https://github.com/llvm/llvm-project/pull/96811


More information about the cfe-commits mailing list