From 74a05c94455479485d9f0727b31be0699cddc799 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Tue, 15 Jul 2014 02:55:09 +0000 Subject: [PATCH] [OPENMP] Several cosmetic fixes in comments, tests and the code for '#pragma omp single'. llvm-svn: 213040 --- clang/include/clang/Basic/OpenMPKinds.def | 4 ++-- clang/lib/Sema/SemaOpenMP.cpp | 3 +++ clang/test/OpenMP/nesting_of_regions.cpp | 8 -------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index f64b137..85295b4 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -107,7 +107,7 @@ OPENMP_SIMD_CLAUSE(safelen) OPENMP_SIMD_CLAUSE(collapse) OPENMP_SIMD_CLAUSE(reduction) -// TODO more clauses allowed for directive 'omp for'. +// Clauses allowed for directive 'omp for'. OPENMP_FOR_CLAUSE(private) OPENMP_FOR_CLAUSE(lastprivate) OPENMP_FOR_CLAUSE(firstprivate) @@ -124,7 +124,7 @@ OPENMP_SECTIONS_CLAUSE(firstprivate) OPENMP_SECTIONS_CLAUSE(reduction) OPENMP_SECTIONS_CLAUSE(nowait) -// TODO more clauses allowed for directive 'omp single'. +// Clauses allowed for directive 'omp single'. OPENMP_SINGLE_CLAUSE(private) OPENMP_SINGLE_CLAUSE(firstprivate) OPENMP_SINGLE_CLAUSE(copyprivate) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index f065014..0dfec26 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1899,7 +1899,10 @@ StmtResult Sema::ActOnOpenMPSingleDirective(ArrayRef Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc) { + assert(AStmt && isa(AStmt) && "Captured statement expected"); + getCurFunction()->setHasBranchProtectedScope(); + return OMPSingleDirective::Create(Context, StartLoc, EndLoc, Clauses, AStmt); } diff --git a/clang/test/OpenMP/nesting_of_regions.cpp b/clang/test/OpenMP/nesting_of_regions.cpp index f56cc0e..c2e2526 100644 --- a/clang/test/OpenMP/nesting_of_regions.cpp +++ b/clang/test/OpenMP/nesting_of_regions.cpp @@ -215,14 +215,6 @@ void foo() { } #pragma omp sections { -#pragma omp section - { -#pragma omp single // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp single' directive into a parallel region?}} - bar(); - } - } -#pragma omp sections - { #pragma omp parallel { #pragma omp single // OK -- 2.7.4