r212516 - [OPENMP] Parsing and sema analysis for 'omp parallel sections' directive.
Bataev, Alexey
a.bataev at hotmail.com
Mon Jul 21 19:45:45 PDT 2014
Michael, we leaving and additional space symbol only for directives with
clauses (as a separator between directive and the first clause in list).
If there are no clauses at all, this separator space is not required.
Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team
21.07.2014 17:53, Michael Wong пишет:
> Since all these
> parallel
> simd
> for
> sections
> section
> single
> master
> parallel for
> parallel sections
>
> use nearly the exact same format of changes (including changing the
> same file), I went through all of them together.
>
> If there is no delta then I will just refer to this review.
>
> So far this code looks good and all the pattern fits (except the
> TRY_TO case that TObias mentioned).
>
> One small comment I noticed so far:
> In
> StmtPrinter.cpp (some strings are missing an ending space. I am not
> sure this is important or even relevant, just for uniformity:
>
> Line 808: missing a space after section in the quoted string. This is
> the case for
> section
> master
> e.g.
>
> void StmtPrinter::VisitOMPSectionDirective(OMPSectionDirective *Node) {
> Indent() << "#pragma omp section";
> PrintOMPExecutableDirective(Node);
> }
>
> I will continue to add reviews for the others but mention this one as
> lead case.
> Thanks.
>
>
> On Tue, Jul 8, 2014 at 4:12 AM, Alexey Bataev <a.bataev at hotmail.com
> <mailto:a.bataev at hotmail.com>> wrote:
>
> Author: abataev
> Date: Tue Jul 8 03:12:03 2014
> New Revision: 212516
>
> URL: http://llvm.org/viewvc/llvm-project?rev=212516&view=rev
> Log:
> [OPENMP] Parsing and sema analysis for 'omp parallel sections'
> directive.
>
> Added:
> cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp (with props)
> cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_messages.cpp (with props)
> cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> (with props)
> cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> (with props)
> Modified:
> cfe/trunk/include/clang-c/Index.h
> cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
> cfe/trunk/include/clang/AST/StmtOpenMP.h
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Basic/OpenMPKinds.def
> cfe/trunk/include/clang/Basic/StmtNodes.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/lib/AST/Stmt.cpp
> cfe/trunk/lib/AST/StmtPrinter.cpp
> cfe/trunk/lib/AST/StmtProfile.cpp
> cfe/trunk/lib/Basic/OpenMPKinds.cpp
> cfe/trunk/lib/CodeGen/CGStmt.cpp
> cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
> cfe/trunk/lib/CodeGen/CodeGenFunction.h
> cfe/trunk/lib/Parse/ParseOpenMP.cpp
> cfe/trunk/lib/Sema/SemaOpenMP.cpp
> cfe/trunk/lib/Sema/TreeTransform.h
> cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
> cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> cfe/trunk/test/OpenMP/nesting_of_regions.cpp
> cfe/trunk/tools/libclang/CIndex.cpp
> cfe/trunk/tools/libclang/CXCursor.cpp
>
> Modified: cfe/trunk/include/clang-c/Index.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang-c/Index.h (original)
> +++ cfe/trunk/include/clang-c/Index.h Tue Jul 8 03:12:03 2014
> @@ -2159,9 +2159,13 @@ enum CXCursorKind {
> */
> CXCursor_OMPParallelForDirective = 238,
>
> + /** \brief OpenMP parallel sections directive.
> + */
> + CXCursor_OMPParallelSectionsDirective = 239,
> +
> /** \brief Windows Structured Exception Handling's leave statement.
> */
> - CXCursor_SEHLeaveStmt = 239,
> + CXCursor_SEHLeaveStmt = 240,
>
> CXCursor_LastStmt = CXCursor_SEHLeaveStmt,
>
>
> Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
> +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Tue Jul
> 8 03:12:03 2014
> @@ -2316,6 +2316,11 @@ DEF_TRAVERSE_STMT(OMPParallelForDirectiv
> return false;
> })
>
> +DEF_TRAVERSE_STMT(OMPParallelSectionsDirective, {
> + if (!TraverseOMPExecutableDirective(S))
> + return false;
> +})
> +
> // OpenMP clauses.
> template <typename Derived>
> bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
>
> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Jul 8
> 03:12:03 2014
> @@ -2338,6 +2338,11 @@ DEF_TRAVERSE_STMT(OMPParallelForDirectiv
> return false;
> })
>
> +DEF_TRAVERSE_STMT(OMPParallelSectionsDirective, {
> + if (!TraverseOMPExecutableDirective(S))
> + return false;
> +})
> +
> // OpenMP clauses.
> template <typename Derived>
> bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
>
> Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
> +++ cfe/trunk/include/clang/AST/StmtOpenMP.h Tue Jul 8 03:12:03 2014
> @@ -599,6 +599,65 @@ public:
> }
> };
>
> +/// \brief This represents '#pragma omp parallel sections' directive.
> +///
> +/// \code
> +/// #pragma omp parallel sections private(a,b) reduction(+:c,d)
> +/// \endcode
> +/// In this example directive '#pragma omp parallel sections' has
> clauses
> +/// 'private' with the variables 'a' and 'b' and 'reduction' with
> operator '+'
> +/// and variables 'c' and 'd'.
> +///
> +class OMPParallelSectionsDirective : public OMPExecutableDirective {
> + friend class ASTStmtReader;
> + /// \brief Build directive with the given start and end location.
> + ///
> + /// \param StartLoc Starting location of the directive kind.
> + /// \param EndLoc Ending location of the directive.
> + /// \param NumClauses Number of clauses.
> + ///
> + OMPParallelSectionsDirective(SourceLocation StartLoc,
> SourceLocation EndLoc,
> + unsigned NumClauses)
> + : OMPExecutableDirective(this,
> OMPParallelSectionsDirectiveClass,
> + OMPD_parallel_sections, StartLoc,
> EndLoc,
> + NumClauses, 1) {}
> +
> + /// \brief Build an empty directive.
> + ///
> + /// \param NumClauses Number of clauses.
> + ///
> + explicit OMPParallelSectionsDirective(unsigned NumClauses)
> + : OMPExecutableDirective(this,
> OMPParallelSectionsDirectiveClass,
> + OMPD_parallel_sections,
> SourceLocation(),
> + SourceLocation(), NumClauses, 1) {}
> +
> +public:
> + /// \brief Creates directive with a list of \a Clauses.
> + ///
> + /// \param C AST context.
> + /// \param StartLoc Starting location of the directive kind.
> + /// \param EndLoc Ending Location of the directive.
> + /// \param Clauses List of clauses.
> + /// \param AssociatedStmt Statement, associated with the directive.
> + ///
> + static OMPParallelSectionsDirective *
> + Create(const ASTContext &C, SourceLocation StartLoc,
> SourceLocation EndLoc,
> + ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt);
> +
> + /// \brief Creates an empty directive with the place for \a
> NumClauses
> + /// clauses.
> + ///
> + /// \param C AST context.
> + /// \param NumClauses Number of clauses.
> + ///
> + static OMPParallelSectionsDirective *
> + CreateEmpty(const ASTContext &C, unsigned NumClauses, EmptyShell);
> +
> + static bool classof(const Stmt *T) {
> + return T->getStmtClass() == OMPParallelSectionsDirectiveClass;
> + }
> +};
> +
> } // end namespace clang
>
> #endif
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Jul
> 8 03:12:03 2014
> @@ -7124,11 +7124,15 @@ def err_omp_prohibited_region_simd : Err
> "OpenMP constructs may not be nested inside a simd region">;
> def err_omp_sections_not_compound_stmt : Error<
> "the statement for '#pragma omp sections' must be a compound
> statement">;
> +def err_omp_parallel_sections_not_compound_stmt : Error<
> + "the statement for '#pragma omp parallel sections' must be a
> compound statement">;
> def err_omp_orphaned_section_directive : Error<
> "%select{orphaned 'omp section' directives are prohibited,
> it|'omp section' directive}0"
> " must be closely nested to a sections region%select{|, not a
> %1 region}0">;
> def err_omp_sections_substmt_not_section : Error<
> "statement in 'omp sections' directive must be enclosed into a
> section region">;
> +def err_omp_parallel_sections_substmt_not_section : Error<
> + "statement in 'omp parallel sections' directive must be
> enclosed into a section region">;
> } // end of OpenMP category
>
> let CategoryName = "Related Result Type Issue" in {
>
> Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
> +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Tue Jul 8
> 03:12:03 2014
> @@ -39,6 +39,9 @@
> #ifndef OPENMP_PARALLEL_FOR_CLAUSE
> # define OPENMP_PARALLEL_FOR_CLAUSE(Name)
> #endif
> +#ifndef OPENMP_PARALLEL_SECTIONS_CLAUSE
> +# define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name)
> +#endif
> #ifndef OPENMP_DEFAULT_KIND
> # define OPENMP_DEFAULT_KIND(Name)
> #endif
> @@ -59,6 +62,7 @@ OPENMP_DIRECTIVE(sections)
> OPENMP_DIRECTIVE(section)
> OPENMP_DIRECTIVE(single)
> OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for")
> +OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
>
> // OpenMP clauses.
> OPENMP_CLAUSE(if, OMPIfClause)
> @@ -153,6 +157,18 @@ OPENMP_PARALLEL_FOR_CLAUSE(collapse)
> OPENMP_PARALLEL_FOR_CLAUSE(schedule)
> OPENMP_PARALLEL_FOR_CLAUSE(ordered)
>
> +// Clauses allowed for OpenMP directive 'parallel sections'.
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(if)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(num_threads)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(default)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(proc_bind)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(private)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(firstprivate)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(shared)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(reduction)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(copyin)
> +OPENMP_PARALLEL_SECTIONS_CLAUSE(lastprivate)
> +
> #undef OPENMP_SCHEDULE_KIND
> #undef OPENMP_PROC_BIND_KIND
> #undef OPENMP_DEFAULT_KIND
> @@ -163,6 +179,7 @@ OPENMP_PARALLEL_FOR_CLAUSE(ordered)
> #undef OPENMP_SECTIONS_CLAUSE
> #undef OPENMP_PARALLEL_CLAUSE
> #undef OPENMP_PARALLEL_FOR_CLAUSE
> +#undef OPENMP_PARALLEL_SECTIONS_CLAUSE
> #undef OPENMP_SIMD_CLAUSE
> #undef OPENMP_FOR_CLAUSE
>
>
> Modified: cfe/trunk/include/clang/Basic/StmtNodes.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/StmtNodes.td (original)
> +++ cfe/trunk/include/clang/Basic/StmtNodes.td Tue Jul 8 03:12:03
> 2014
> @@ -185,3 +185,4 @@ def OMPSectionsDirective : DStmt<OMPExec
> def OMPSectionDirective : DStmt<OMPExecutableDirective>;
> def OMPSingleDirective : DStmt<OMPExecutableDirective>;
> def OMPParallelForDirective : DStmt<OMPExecutableDirective>;
> +def OMPParallelSectionsDirective : DStmt<OMPExecutableDirective>;
>
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Tue Jul 8 03:12:03 2014
> @@ -7342,6 +7342,12 @@ public:
> ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation
> StartLoc,
> SourceLocation EndLoc,
> llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
> + /// \brief Called on well-formed '\#pragma omp parallel
> sections' after
> + /// parsing of the associated statement.
> + StmtResult
> ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
> + Stmt *AStmt,
> + SourceLocation StartLoc,
> + SourceLocation EndLoc);
>
> OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
> Expr *Expr,
>
> Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
> +++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Tue Jul 8
> 03:12:03 2014
> @@ -1347,6 +1347,7 @@ namespace clang {
> STMT_OMP_SECTION_DIRECTIVE,
> STMT_OMP_SINGLE_DIRECTIVE,
> STMT_OMP_PARALLEL_FOR_DIRECTIVE,
> + STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
>
> // ARC
> EXPR_OBJC_BRIDGED_CAST, // ObjCBridgedCastExpr
>
> Modified: cfe/trunk/lib/AST/Stmt.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/Stmt.cpp (original)
> +++ cfe/trunk/lib/AST/Stmt.cpp Tue Jul 8 03:12:03 2014
> @@ -1504,3 +1504,27 @@ OMPParallelForDirective::CreateEmpty(con
> return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
> }
>
> +OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
> + const ASTContext &C, SourceLocation StartLoc, SourceLocation
> EndLoc,
> + ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
> + unsigned Size =
> llvm::RoundUpToAlignment(sizeof(OMPParallelSectionsDirective),
> + llvm::alignOf<OMPClause *>());
> + void *Mem =
> + C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
> sizeof(Stmt *));
> + OMPParallelSectionsDirective *Dir =
> + new (Mem) OMPParallelSectionsDirective(StartLoc, EndLoc,
> Clauses.size());
> + Dir->setClauses(Clauses);
> + Dir->setAssociatedStmt(AssociatedStmt);
> + return Dir;
> +}
> +
> +OMPParallelSectionsDirective *
> +OMPParallelSectionsDirective::CreateEmpty(const ASTContext &C,
> + unsigned NumClauses,
> EmptyShell) {
> + unsigned Size =
> llvm::RoundUpToAlignment(sizeof(OMPParallelSectionsDirective),
> + llvm::alignOf<OMPClause *>());
> + void *Mem =
> + C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
> sizeof(Stmt *));
> + return new (Mem) OMPParallelSectionsDirective(NumClauses);
> +}
> +
>
> Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
> +++ cfe/trunk/lib/AST/StmtPrinter.cpp Tue Jul 8 03:12:03 2014
> @@ -820,6 +820,12 @@ void StmtPrinter::VisitOMPParallelForDir
> PrintOMPExecutableDirective(Node);
> }
>
> +void StmtPrinter::VisitOMPParallelSectionsDirective(
> + OMPParallelSectionsDirective *Node) {
> + Indent() << "#pragma omp parallel sections ";
> + PrintOMPExecutableDirective(Node);
> +}
> +
> //===----------------------------------------------------------------------===//
> // Expr printing methods.
> //===----------------------------------------------------------------------===//
>
> Modified: cfe/trunk/lib/AST/StmtProfile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/StmtProfile.cpp (original)
> +++ cfe/trunk/lib/AST/StmtProfile.cpp Tue Jul 8 03:12:03 2014
> @@ -385,6 +385,11 @@ StmtProfiler::VisitOMPParallelForDirecti
> VisitOMPExecutableDirective(S);
> }
>
> +void StmtProfiler::VisitOMPParallelSectionsDirective(
> + const OMPParallelSectionsDirective *S) {
> + VisitOMPExecutableDirective(S);
> +}
> +
> void StmtProfiler::VisitExpr(const Expr *S) {
> VisitStmt(S);
> }
>
> Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)
> +++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Tue Jul 8 03:12:03 2014
> @@ -227,6 +227,16 @@ bool clang::isAllowedClauseForDirective(
> break;
> }
> break;
> + case OMPD_parallel_sections:
> + switch (CKind) {
> +#define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name) \
> + case OMPC_##Name: \
> + return true;
> +#include "clang/Basic/OpenMPKinds.def"
> + default:
> + break;
> + }
> + break;
> case OMPD_unknown:
> case OMPD_threadprivate:
> case OMPD_task:
> @@ -243,13 +253,13 @@ bool clang::isOpenMPLoopDirective(OpenMP
>
> bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
> return DKind == OMPD_for || DKind == OMPD_sections || DKind ==
> OMPD_section ||
> - DKind == OMPD_single ||
> - DKind == OMPD_parallel_for; // TODO add next directives.
> + DKind == OMPD_single || DKind == OMPD_parallel_for ||
> + DKind == OMPD_parallel_sections; // TODO add next
> directives.
> }
>
> bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
> - return DKind == OMPD_parallel ||
> - DKind == OMPD_parallel_for; // TODO add next directives.
> + return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
> + DKind == OMPD_parallel_sections; // TODO add next
> directives.
> }
>
> bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
>
> Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Jul 8 03:12:03 2014
> @@ -197,6 +197,9 @@ void CodeGenFunction::EmitStmt(const Stm
> case Stmt::OMPParallelForDirectiveClass:
> EmitOMPParallelForDirective(cast<OMPParallelForDirective>(*S));
> break;
> + case Stmt::OMPParallelSectionsDirectiveClass:
> +
> EmitOMPParallelSectionsDirective(cast<OMPParallelSectionsDirective>(*S));
> + break;
> }
> }
>
>
> Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Jul 8 03:12:03 2014
> @@ -95,3 +95,8 @@ CodeGenFunction::EmitOMPParallelForDirec
> llvm_unreachable("CodeGen for 'omp parallel for' is not
> supported yet.");
> }
>
> +void CodeGenFunction::EmitOMPParallelSectionsDirective(
> + const OMPParallelSectionsDirective &) {
> + llvm_unreachable("CodeGen for 'omp parallel sections' is not
> supported yet.");
> +}
> +
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Jul 8 03:12:03 2014
> @@ -1904,6 +1904,7 @@ public:
> void EmitOMPSectionDirective(const OMPSectionDirective &S);
> void EmitOMPSingleDirective(const OMPSingleDirective &S);
> void EmitOMPParallelForDirective(const OMPParallelForDirective &S);
> + void EmitOMPParallelSectionsDirective(const
> OMPParallelSectionsDirective &S);
>
> //===--------------------------------------------------------------------===//
> // LValue Expression Emission
>
> Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Tue Jul 8 03:12:03 2014
> @@ -40,6 +40,9 @@ static OpenMPDirectiveKind ParseOpenMPDi
> if (SDKind == OMPD_for) {
> P.ConsumeToken();
> DKind = OMPD_parallel_for;
> + } else if (SDKind == OMPD_sections) {
> + P.ConsumeToken();
> + DKind = OMPD_parallel_sections;
> }
> }
> return DKind;
> @@ -85,6 +88,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
> case OMPD_section:
> case OMPD_single:
> case OMPD_parallel_for:
> + case OMPD_parallel_sections:
> Diag(Tok, diag::err_omp_unexpected_directive)
> << getOpenMPDirectiveName(DKind);
> break;
> @@ -101,7 +105,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
> ///
> /// executable-directive:
> /// annot_pragma_openmp 'parallel' | 'simd' | 'for' |
> 'sections' |
> -/// 'section' | 'single' | 'parallel for' {clause}
> annot_pragma_openmp_end
> +/// 'section' | 'single' | 'parallel for' | 'parallel
> sections' {clause}
> +/// annot_pragma_openmp_end
> ///
> StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective() {
> assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP
> directive!");
> @@ -141,7 +146,8 @@ StmtResult Parser::ParseOpenMPDeclarativ
> case OMPD_sections:
> case OMPD_single:
> case OMPD_section:
> - case OMPD_parallel_for: {
> + case OMPD_parallel_for:
> + case OMPD_parallel_sections: {
> ConsumeToken();
>
> if (isOpenMPLoopDirective(DKind))
>
> Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Jul 8 03:12:03 2014
> @@ -976,6 +976,14 @@ void Sema::ActOnOpenMPRegionStart(OpenMP
> Params);
> break;
> }
> + case OMPD_parallel_sections: {
> + Sema::CapturedParamNameType Params[] = {
> + std::make_pair(StringRef(), QualType()) // __context with
> shared vars
> + };
> + ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope,
> CR_OpenMP,
> + Params);
> + break;
> + }
> case OMPD_threadprivate:
> case OMPD_task:
> llvm_unreachable("OpenMP Directive is not allowed");
> @@ -998,6 +1006,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | parallel | section | + |
> // | parallel | single | * |
> // | parallel | parallel for | * |
> + // | parallel |parallel sections| * |
> //
> +------------------+-----------------+------------------------------------+
> // | for | parallel | * |
> // | for | for | + |
> @@ -1006,6 +1015,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | for | section | + |
> // | for | single | + |
> // | for | parallel for | * |
> + // | for |parallel sections| * |
> //
> +------------------+-----------------+------------------------------------+
> // | simd | parallel | |
> // | simd | for | |
> @@ -1014,6 +1024,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | simd | section | |
> // | simd | single | |
> // | simd | parallel for | |
> + // | simd |parallel sections| |
> //
> +------------------+-----------------+------------------------------------+
> // | sections | parallel | * |
> // | sections | for | + |
> @@ -1022,6 +1033,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | sections | section | * |
> // | sections | single | + |
> // | sections | parallel for | * |
> + // | sections |parallel sections| * |
> //
> +------------------+-----------------+------------------------------------+
> // | section | parallel | * |
> // | section | for | + |
> @@ -1030,6 +1042,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | section | section | + |
> // | section | single | + |
> // | section | parallel for | * |
> + // | section |parallel sections| * |
> //
> +------------------+-----------------+------------------------------------+
> // | single | parallel | * |
> // | single | for | + |
> @@ -1038,6 +1051,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | single | section | + |
> // | single | single | + |
> // | single | parallel for | * |
> + // | single |parallel sections| * |
> //
> +------------------+-----------------+------------------------------------+
> // | parallel for | parallel | * |
> // | parallel for | for | + |
> @@ -1046,6 +1060,16 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // | parallel for | section | + |
> // | parallel for | single | + |
> // | parallel for | parallel for | * |
> + // | parallel for |parallel sections| * |
> + //
> +------------------+-----------------+------------------------------------+
> + // | parallel sections| parallel | * |
> + // | parallel sections| for | + |
> + // | parallel sections| simd | * |
> + // | parallel sections| sections | + |
> + // | parallel sections| section | * |
> + // | parallel sections| single | + |
> + // | parallel sections| parallel for | * |
> + // | parallel sections|parallel sections| * |
> //
> +------------------+-----------------+------------------------------------+
> if (Stack->getCurScope()) {
> auto ParentRegion = Stack->getParentDirective();
> @@ -1063,7 +1087,8 @@ bool CheckNestingOfRegions(Sema &SemaRef
> // Orphaned section directives are prohibited. That is, the
> section
> // directives must appear within the sections construct and
> must not be
> // encountered elsewhere in the sections region.
> - if (ParentRegion != OMPD_sections) {
> + if (ParentRegion != OMPD_sections &&
> + ParentRegion != OMPD_parallel_sections) {
> SemaRef.Diag(StartLoc,
> diag::err_omp_orphaned_section_directive)
> << (ParentRegion != OMPD_unknown)
> << getOpenMPDirectiveName(ParentRegion);
> @@ -1155,6 +1180,10 @@ StmtResult Sema::ActOnOpenMPExecutableDi
> Res = ActOnOpenMPParallelForDirective(ClausesWithImplicit,
> AStmt, StartLoc,
> EndLoc,
> VarsWithInheritedDSA);
> break;
> + case OMPD_parallel_sections:
> + Res =
> ActOnOpenMPParallelSectionsDirective(ClausesWithImplicit, AStmt,
> + StartLoc, EndLoc);
> + break;
> case OMPD_threadprivate:
> case OMPD_task:
> llvm_unreachable("OpenMP Directive is not allowed");
> @@ -1834,6 +1863,41 @@ StmtResult Sema::ActOnOpenMPParallelForD
> NestedLoopCount,
> Clauses, AStmt);
> }
>
> +StmtResult
> +Sema::ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *>
> Clauses,
> + Stmt *AStmt,
> SourceLocation StartLoc,
> + SourceLocation EndLoc) {
> + assert(AStmt && isa<CapturedStmt>(AStmt) && "Captured statement
> expected");
> + auto BaseStmt = AStmt;
> + while (CapturedStmt *CS = dyn_cast_or_null<CapturedStmt>(BaseStmt))
> + BaseStmt = CS->getCapturedStmt();
> + if (auto C = dyn_cast_or_null<CompoundStmt>(BaseStmt)) {
> + auto S = C->children();
> + if (!S)
> + return StmtError();
> + // All associated statements must be '#pragma omp section'
> except for
> + // the first one.
> + for (++S; S; ++S) {
> + auto SectionStmt = *S;
> + if (!SectionStmt || !isa<OMPSectionDirective>(SectionStmt)) {
> + if (SectionStmt)
> + Diag(SectionStmt->getLocStart(),
> + diag::err_omp_parallel_sections_substmt_not_section);
> + return StmtError();
> + }
> + }
> + } else {
> + Diag(AStmt->getLocStart(),
> + diag::err_omp_parallel_sections_not_compound_stmt);
> + return StmtError();
> + }
> +
> + getCurFunction()->setHasBranchProtectedScope();
> +
> + return OMPParallelSectionsDirective::Create(Context, StartLoc,
> EndLoc,
> + Clauses, AStmt);
> +}
> +
> OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind
> Kind, Expr *Expr,
> SourceLocation StartLoc,
> SourceLocation
> LParenLoc,
>
> Modified: cfe/trunk/lib/Sema/TreeTransform.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/TreeTransform.h (original)
> +++ cfe/trunk/lib/Sema/TreeTransform.h Tue Jul 8 03:12:03 2014
> @@ -6494,6 +6494,17 @@ StmtResult TreeTransform<Derived>::Trans
> return Res;
> }
>
> +template <typename Derived>
> +StmtResult
> TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
> + OMPParallelSectionsDirective *D) {
> + DeclarationNameInfo DirName;
> +
> getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_sections, DirName,
> + nullptr,
> D->getLocStart());
> + StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
> + getDerived().getSema().EndOpenMPDSABlock(Res.get());
> + return Res;
> +}
> +
> //===----------------------------------------------------------------------===//
> // OpenMP clause transformation
> //===----------------------------------------------------------------------===//
>
> Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Tue Jul 8
> 03:12:03 2014
> @@ -1950,6 +1950,14 @@ void ASTStmtReader::VisitOMPParallelForD
> VisitOMPExecutableDirective(D);
> }
>
> +void ASTStmtReader::VisitOMPParallelSectionsDirective(
> + OMPParallelSectionsDirective *D) {
> + VisitStmt(D);
> + // The NumClauses field was read in ReadStmtFromStream.
> + ++Idx;
> + VisitOMPExecutableDirective(D);
> +}
> +
> //===----------------------------------------------------------------------===//
> // ASTReader Implementation
> //===----------------------------------------------------------------------===//
> @@ -2470,6 +2478,11 @@ Stmt *ASTReader::ReadStmtFromStream(Modu
> break;
> }
>
> + case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
> + S = OMPParallelSectionsDirective::CreateEmpty(
> + Context, Record[ASTStmtReader::NumStmtFields], Empty);
> + break;
> +
> case EXPR_CXX_OPERATOR_CALL:
> S = new (Context) CXXOperatorCallExpr(Context, Empty);
> break;
>
> Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Tue Jul 8
> 03:12:03 2014
> @@ -1859,6 +1859,14 @@ void ASTStmtWriter::VisitOMPParallelForD
> Code = serialization::STMT_OMP_PARALLEL_FOR_DIRECTIVE;
> }
>
> +void ASTStmtWriter::VisitOMPParallelSectionsDirective(
> + OMPParallelSectionsDirective *D) {
> + VisitStmt(D);
> + Record.push_back(D->getNumClauses());
> + VisitOMPExecutableDirective(D);
> + Code = serialization::STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE;
> +}
> +
> //===----------------------------------------------------------------------===//
> // ASTWriter Implementation
> //===----------------------------------------------------------------------===//
>
> Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
> +++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Tue Jul 8
> 03:12:03 2014
> @@ -738,6 +738,7 @@ void ExprEngine::Visit(const Stmt *S, Ex
> case Stmt::OMPSectionDirectiveClass:
> case Stmt::OMPSingleDirectiveClass:
> case Stmt::OMPParallelForDirectiveClass:
> + case Stmt::OMPParallelSectionsDirectiveClass:
> llvm_unreachable("Stmt should not be in analyzer evaluation
> loop");
>
> case Stmt::ObjCSubscriptRefExprClass:
>
> Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original)
> +++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Tue Jul 8
> 03:12:03 2014
> @@ -30,6 +30,11 @@ void foo() {
> #pragma omp parallel for
> for (int i = 0; i < 10; ++i)
> ;
> +#pragma omp parallel
> +#pragma omp parallel sections
> + {
> + bar();
> + }
>
> // SIMD DIRECTIVE
> #pragma omp simd
> @@ -77,6 +82,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp simd
> + for (int i = 0; i < 10; ++i) {
> +#pragma omp parallel sections // expected-error {{OpenMP
> constructs may not be nested inside a simd region}}
> + {
> + bar();
> + }
> + }
>
> // FOR DIRECTIVE
> #pragma omp for
> @@ -141,6 +153,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp for
> + for (int i = 0; i < 10; ++i) {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
>
> // SECTIONS DIRECTIVE
> #pragma omp sections
> @@ -206,6 +225,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp sections
> + {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
>
> // SECTION DIRECTIVE
> #pragma omp section // expected-error {{orphaned 'omp section'
> directives are prohibited, it must be closely nested to a sections
> region}}
> @@ -269,6 +295,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp single
> + {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
>
> // PARALLEL FOR DIRECTIVE
> #pragma omp parallel for
> @@ -333,6 +366,85 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp parallel for
> + for (int i = 0; i < 10; ++i) {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
> +
> +// PARALLEL SECTIONS DIRECTIVE
> +#pragma omp parallel sections
> + {
> +#pragma omp for // expected-error {{region cannot be closely
> nested inside 'parallel sections' region; perhaps you forget to
> enclose 'omp for' directive into a parallel region?}}
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp simd
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp parallel
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp sections // expected-error {{region cannot be closely
> nested inside 'parallel sections' region; perhaps you forget to
> enclose 'omp sections' directive into a parallel region?}}
> + {
> + bar();
> + }
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp section
> + {
> + bar();
> + }
> + }
> +#pragma omp parallel 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 parallel sections
> + {
> +#pragma omp parallel
> + {
> +#pragma omp single // OK
> + {
> + bar();
> + }
> +#pragma omp for // OK
> + for (int i = 0; i < 10; ++i)
> + ;
> +#pragma omp sections // OK
> + {
> + bar();
> + }
> + }
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp parallel for
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
> }
>
> void foo() {
> @@ -367,6 +479,11 @@ void foo() {
> #pragma omp parallel for
> for (int i = 0; i < 10; ++i)
> ;
> +#pragma omp parallel
> +#pragma omp parallel sections
> + {
> + bar();
> + }
>
> // SIMD DIRECTIVE
> #pragma omp simd
> @@ -412,6 +529,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp simd
> + for (int i = 0; i < 10; ++i) {
> +#pragma omp parallel sections // expected-error {{OpenMP
> constructs may not be nested inside a simd region}}
> + {
> + bar();
> + }
> + }
>
> // FOR DIRECTIVE
> #pragma omp for
> @@ -474,6 +598,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp for
> + for (int i = 0; i < 10; ++i) {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
>
> // SECTIONS DIRECTIVE
> #pragma omp sections
> @@ -536,6 +667,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp sections
> + {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
>
> // SECTION DIRECTIVE
> #pragma omp section // expected-error {{orphaned 'omp section'
> directives are prohibited, it must be closely nested to a sections
> region}}
> @@ -599,6 +737,13 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp single
> + {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
>
> // PARALLEL FOR DIRECTIVE
> #pragma omp parallel for
> @@ -663,6 +808,85 @@ void foo() {
> for (int i = 0; i < 10; ++i)
> ;
> }
> +#pragma omp parallel for
> + for (int i = 0; i < 10; ++i) {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
> +
> +// PARALLEL SECTIONS DIRECTIVE
> +#pragma omp parallel sections
> + {
> +#pragma omp for // expected-error {{region cannot be closely
> nested inside 'parallel sections' region; perhaps you forget to
> enclose 'omp for' directive into a parallel region?}}
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp simd
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp parallel
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp sections // expected-error {{region cannot be closely
> nested inside 'parallel sections' region; perhaps you forget to
> enclose 'omp sections' directive into a parallel region?}}
> + {
> + bar();
> + }
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp section
> + {
> + bar();
> + }
> + }
> +#pragma omp parallel 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 parallel sections
> + {
> +#pragma omp parallel
> + {
> +#pragma omp single // OK
> + {
> + bar();
> + }
> +#pragma omp for // OK
> + for (int i = 0; i < 10; ++i)
> + ;
> +#pragma omp sections // OK
> + {
> + bar();
> + }
> + }
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp parallel for
> + for (int i = 0; i < 10; ++i)
> + ;
> + }
> +#pragma omp parallel sections
> + {
> +#pragma omp parallel sections
> + {
> + bar();
> + }
> + }
> return foo<int>();
> }
>
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp Tue Jul
> 8 03:12:03 2014
> @@ -0,0 +1,144 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ast-print %s |
> FileCheck %s
> +// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -emit-pch
> -o %t %s
> +// RUN: %clang_cc1 -fopenmp=libiomp5 -std=c++11 -include-pch %t
> -fsyntax-only -verify %s -ast-print | FileCheck %s
> +// expected-no-diagnostics
> +
> +#ifndef HEADER
> +#define HEADER
> +
> +void foo() {}
> +
> +template <class T>
> +struct S {
> + operator T() { return T(); }
> + static T TS;
> +#pragma omp threadprivate(TS)
> +};
> +
> +// CHECK: template <class T = int> struct S {
> +// CHECK: static int TS;
> +// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
> +// CHECK-NEXT: }
> +// CHECK: template <class T = long> struct S {
> +// CHECK: static long TS;
> +// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
> +// CHECK-NEXT: }
> +// CHECK: template <class T> struct S {
> +// CHECK: static T TS;
> +// CHECK-NEXT: #pragma omp threadprivate(S::TS)
> +// CHECK: };
> +
> +template <typename T, int C>
> +T tmain(T argc, T *argv) {
> + T b = argc, c, d, e, f, g;
> + static T a;
> + S<T> s;
> +#pragma omp parallel sections
> + {
> + a = 2;
> + }
> +#pragma omp parallel sections default(none), private(argc, b)
> firstprivate(argv) shared(d) if (argc > 0) num_threads(C) copyin(S
> < T > ::TS) proc_bind(master) reduction(+ : c) reduction(max : e)
> + {
> + foo();
> + }
> +#pragma omp parallel sections if (C) num_threads(s)
> proc_bind(close) reduction(^ : e, f) reduction(&& : g)
> lastprivate(b, c)
> + {
> + foo();
> +#pragma omp section
> + foo();
> + }
> + return 0;
> +}
> +
> +// CHECK: template <typename T = int, int C = 5> int tmain(int
> argc, int *argv) {
> +// CHECK-NEXT: int b = argc, c, d, e, f, g;
> +// CHECK-NEXT: static int a;
> +// CHECK-NEXT: S<int> s;
> +// CHECK-NEXT: #pragma omp parallel sections
> +// CHECK-NEXT: {
> +// CHECK-NEXT: a = 2;
> +// CHECK-NEXT: }
> +// CHECK-NEXT: #pragma omp parallel sections default(none)
> private(argc,b) firstprivate(argv) shared(d) if(argc > 0)
> num_threads(5) copyin(S<int>::TS) proc_bind(master) reduction(+:
> c) reduction(max: e)
> +// CHECK-NEXT: {
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: }
> +// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s)
> proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
> +// CHECK-NEXT: {
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: #pragma omp section
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: }
> +// CHECK: template <typename T = long, int C = 1> long tmain(long
> argc, long *argv) {
> +// CHECK-NEXT: long b = argc, c, d, e, f, g;
> +// CHECK-NEXT: static long a;
> +// CHECK-NEXT: S<long> s;
> +// CHECK-NEXT: #pragma omp parallel sections
> +// CHECK-NEXT: {
> +// CHECK-NEXT: a = 2;
> +// CHECK-NEXT: }
> +// CHECK-NEXT: #pragma omp parallel sections default(none)
> private(argc,b) firstprivate(argv) shared(d) if(argc > 0)
> num_threads(1) copyin(S<long>::TS) proc_bind(master) reduction(+:
> c) reduction(max: e)
> +// CHECK-NEXT: {
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: }
> +// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s)
> proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
> +// CHECK-NEXT: {
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: #pragma omp section
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: }
> +// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
> +// CHECK-NEXT: T b = argc, c, d, e, f, g;
> +// CHECK-NEXT: static T a;
> +// CHECK-NEXT: S<T> s;
> +// CHECK-NEXT: #pragma omp parallel sections
> +// CHECK-NEXT: {
> +// CHECK-NEXT: a = 2;
> +// CHECK-NEXT: }
> +// CHECK-NEXT: #pragma omp parallel sections default(none)
> private(argc,b) firstprivate(argv) shared(d) if(argc > 0)
> num_threads(C) copyin(S<T>::TS) proc_bind(master) reduction(+: c)
> reduction(max: e)
> +// CHECK-NEXT: {
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: }
> +// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s)
> proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c)
> +// CHECK-NEXT: {
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: #pragma omp section
> +// CHECK-NEXT: foo();
> +// CHECK-NEXT: }
> +
> +enum Enum {};
> +
> +int main(int argc, char **argv) {
> + long x;
> + int b = argc, c, d, e, f, g;
> + static int a;
> +#pragma omp threadprivate(a)
> + Enum ee;
> +// CHECK: Enum ee;
> +#pragma omp parallel sections
> + // CHECK-NEXT: #pragma omp parallel sections
> + {
> + a = 2;
> + }
> +// CHECK-NEXT: {
> +// CHECK-NEXT: a = 2;
> +// CHECK-NEXT: }
> +#pragma omp parallel sections default(none), private(argc, b)
> firstprivate(argv) if (argc > 0) num_threads(ee) copyin(a)
> proc_bind(spread) reduction(| : c, d) reduction(* : e)
> lastprivate(argv)
> + // CHECK-NEXT: #pragma omp parallel sections default(none)
> private(argc,b) firstprivate(argv) if(argc > 0) num_threads(ee)
> copyin(a) proc_bind(spread) reduction(|: c,d) reduction(*: e)
> lastprivate(argv)
> + {
> + foo();
> +#pragma omp section
> + foo();
> +#pragma omp section
> + foo();
> + }
> + // CHECK-NEXT: {
> + // CHECK-NEXT: foo();
> + // CHECK-NEXT: #pragma omp section
> + // CHECK-NEXT: foo();
> + // CHECK-NEXT: #pragma omp section
> + // CHECK-NEXT: foo();
> + // CHECK-NEXT: }
> + return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x);
> +}
> +
> +#endif
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_ast_print.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,105 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o
> - %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note {{declared here}}
> +class S2 {
> + mutable int a;
> +
> +public:
> + S2() : a(0) {}
> + S2 &operator=(S2 &s2) { return *this; }
> +};
> +class S3 {
> + int a;
> +
> +public:
> + S3() : a(0) {}
> + S3 &operator=(S3 &s3) { return *this; }
> +};
> +class S4 { // expected-note {{'S4' declared here}}
> + int a;
> + S4();
> + S4 &operator=(const S4 &s4);
> +
> +public:
> + S4(int v) : a(v) {}
> +};
> +class S5 { // expected-note {{'S5' declared here}}
> + int a;
> + S5() : a(0) {}
> + S5 &operator=(const S5 &s5) { return *this; }
> +
> +public:
> + S5(int v) : a(v) {}
> +};
> +template <class T>
> +class ST {
> +public:
> + static T s;
> +};
> +
> +S2 k;
> +S3 h;
> +S4 l(3); // expected-note {{'l' defined here}}
> +S5 m(4); // expected-note {{'m' defined here}}
> +#pragma omp threadprivate(h, k, l, m)
> +
> +int main(int argc, char **argv) {
> + int i;
> +#pragma omp parallel sections copyin // expected-error {{expected
> '(' after 'copyin'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(k // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(h, // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(l) // expected-error
> {{copyin variable must have an accessible, unambiguous copy
> assignment operator}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(S1) // expected-error {{'S1'
> does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(argv[1]) // expected-error
> {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(i) // expected-error
> {{copyin variable must be threadprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(m) // expected-error
> {{copyin variable must have an accessible, unambiguous copy
> assignment operator}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyin(ST < int > ::s) //
> expected-error {{copyin variable must be threadprivate}}
> + {
> + foo();
> + }
> +
> + return 0;
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_copyin_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,39 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o
> - %s
> +
> +void foo();
> +
> +int main(int argc, char **argv) {
> +#pragma omp parallel sections default // expected-error
> {{expected '(' after 'default'}}
> + {
> +#pragma omp parallel sections default( // expected-error
> {{expected 'none' or 'shared' in OpenMP clause 'default'}}
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> + {
> +#pragma omp parallel sections default() // expected-error
> {{expected 'none' or 'shared' in OpenMP clause 'default'}}
> + {
> +#pragma omp parallel sections default(none // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> +#pragma omp parallel sections default(shared), default(shared) //
> expected-error {{directive '#pragma omp parallel sections' cannot
> contain more than one 'default' clause}}
> + {
> +#pragma omp parallel sections default(x) // expected-error
> {{expected 'none' or 'shared' in OpenMP clause 'default'}}
> + {
> + foo();
> + }
> + }
> + }
> + }
> + }
> + }
> +
> +#pragma omp parallel sections default(none)
> + {
> + ++argc; // expected-error {{variable 'argc' must have
> explicitly specified data sharing attributes}}
> + }
> +
> +#pragma omp parallel sections default(none)
> + {
> +#pragma omp parallel sections default(shared)
> + {
> + ++argc;
> + }
> + }
> + return 0;
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_default_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added:
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp?rev=212516&view=auto
> ==============================================================================
> ---
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> (added)
> +++
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,295 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note 2 {{declared here}} expected-note 2
> {{forward declaration of 'S1'}}
> +extern S1 a;
> +class S2 {
> + mutable int a;
> +
> +public:
> + S2() : a(0) {}
> + S2(S2 &s2) : a(s2.a) {}
> + static float S2s;
> + static const float S2sc;
> +};
> +const float S2::S2sc = 0;
> +const S2 b;
> +const S2 ba[5];
> +class S3 {
> + int a;
> + S3 &operator=(const S3 &s3);
> +
> +public:
> + S3() : a(0) {}
> + S3(S3 &s3) : a(s3.a) {}
> +};
> +const S3 c;
> +const S3 ca[5];
> +extern const int f;
> +class S4 { // expected-note 2 {{'S4' declared here}}
> + int a;
> + S4();
> + S4(const S4 &s4);
> +
> +public:
> + S4(int v) : a(v) {}
> +};
> +class S5 { // expected-note 4 {{'S5' declared here}}
> + int a;
> + S5(const S5 &s5) : a(s5.a) {}
> +
> +public:
> + S5() : a(0) {}
> + S5(int v) : a(v) {}
> +};
> +class S6 {
> + int a;
> + S6() : a(0) {}
> +
> +public:
> + S6(const S6 &s6) : a(s6.a) {}
> + S6(int v) : a(v) {}
> +};
> +
> +S3 h;
> +#pragma omp threadprivate(h) // expected-note 2 {{defined as
> threadprivate or thread local}}
> +
> +template <class I, class C>
> +int foomain(int argc, char **argv) {
> + I e(4); // expected-note {{'e' defined here}}
> + C g(5); // expected-note 2 {{'g' defined here}}
> + int i;
> + int &j = i; // expected-note {{'j'
> defined here}}
> +#pragma omp parallel sections firstprivate // expected-error
> {{expected '(' after 'firstprivate'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc, //
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(a, b) //
> expected-error {{firstprivate variable with incomplete type 'S1'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argv[1]) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(e, g) //
> expected-error 2 {{firstprivate variable must have an accessible,
> unambiguous copy constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(h) // expected-error
> {{threadprivate or thread local variable cannot be firstprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections linear(i) // expected-error
> {{unexpected OpenMP clause 'linear' in directive '#pragma omp
> parallel sections'}}
> + {
> + foo();
> + }
> +#pragma omp parallel
> + {
> + int v = 0;
> + int i;
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> + v += i;
> + }
> +#pragma omp parallel shared(i)
> +#pragma omp parallel private(i)
> +#pragma omp parallel sections firstprivate(j) // expected-error
> {{arguments of OpenMP clause 'firstprivate' cannot be of reference
> type}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(g) firstprivate(g) //
> expected-error {{firstprivate variable must have an accessible,
> unambiguous copy constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel private(i)
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> +#pragma omp parallel reduction(+ : i)
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> + return 0;
> +}
> +
> +int main(int argc, char **argv) {
> + const int d = 5;
> + const int da[5] = {0};
> + S4 e(4); // expected-note {{'e' defined here}}
> + S5 g(5); // expected-note 2 {{'g' defined here}}
> + S3 m;
> + S6 n(2);
> + int i;
> + int &j = i; // expected-note {{'j'
> defined here}}
> +#pragma omp parallel sections firstprivate // expected-error
> {{expected '(' after 'firstprivate'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc, //
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(a, b, c, d, f) //
> expected-error {{firstprivate variable with incomplete type 'S1'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(argv[1]) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(2 * 2) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(ba) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(ca) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(da) // OK
> + {
> + foo();
> + }
> + int xa;
> +#pragma omp parallel sections firstprivate(xa) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(S2::S2s) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(S2::S2sc) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections safelen(5) // expected-error
> {{unexpected OpenMP clause 'safelen' in directive '#pragma omp
> parallel sections'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(e, g) //
> expected-error 2 {{firstprivate variable must have an accessible,
> unambiguous copy constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(m) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(h) // expected-error
> {{threadprivate or thread local variable cannot be firstprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(xa), firstprivate(xa) //
> expected-error {{private variable cannot be firstprivate}}
> expected-note {{defined as private}}
> + {
> + foo();
> + }
> +#pragma omp parallel shared(xa)
> +#pragma omp parallel sections firstprivate(xa) // OK: may be
> firstprivate
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(j) // expected-error
> {{arguments of OpenMP clause 'firstprivate' cannot be of reference
> type}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(g) firstprivate(g) //
> expected-error {{firstprivate variable must have an accessible,
> unambiguous copy constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(n) firstprivate(n) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel
> + {
> + int v = 0;
> + int i;
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> + v += i;
> + }
> +#pragma omp parallel private(i)
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> +#pragma omp parallel reduction(+ : i)
> +#pragma omp parallel sections firstprivate(i)
> + {
> + foo();
> + }
> +
> + return foomain<S4, S5>(argc, argv); // expected-note {{in
> instantiation of function template specialization 'foomain<S4,
> S5>' requested here}}
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_firstprivate_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp Tue
> Jul 8 03:12:03 2014
> @@ -0,0 +1,113 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note {{declared here}}
> +
> +template <class T, class S> // expected-note {{declared here}}
> +int tmain(T argc, S **argv) {
> + #pragma omp parallel sections if // expected-error {{expected
> '(' after 'if'}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to
> match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if () // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc)) // expected-warning
> {{extra tokens at the end of '#pragma omp parallel sections' are
> ignored}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc > 0 ? argv[1] : argv[2])
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (foobool(argc)), if (true) //
> expected-error {{directive '#pragma omp parallel sections' cannot
> contain more than one 'if' clause}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (S) // expected-error {{'S'
> does not refer to a value}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argv[1]=2) // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc argc) // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if(argc)
> + {
> + foo();
> + }
> +
> + return 0;
> +}
> +
> +int main(int argc, char **argv) {
> + #pragma omp parallel sections if // expected-error {{expected
> '(' after 'if'}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if ( // expected-error {{expected
> expression}} expected-error {{expected ')'}} expected-note {{to
> match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if () // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc)) // expected-warning
> {{extra tokens at the end of '#pragma omp parallel sections' are
> ignored}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc > 0 ? argv[1] : argv[2])
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (foobool(argc)), if (true) //
> expected-error {{directive '#pragma omp parallel sections' cannot
> contain more than one 'if' clause}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (S1) // expected-error {{'S1'
> does not refer to a value}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argv[1]=2) // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (argc argc) // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if (1 0) // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> + #pragma omp parallel sections if(if(tmain(argc, argv) //
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +
> + return tmain(argc, argv);
> +}
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_if_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added:
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp?rev=212516&view=auto
> ==============================================================================
> ---
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> (added)
> +++
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,269 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note 2 {{declared here}} expected-note 2
> {{forward declaration of 'S1'}}
> +extern S1 a;
> +class S2 {
> + mutable int a;
> +
> +public:
> + S2() : a(0) {}
> + S2(S2 &s2) : a(s2.a) {}
> + static float S2s; // expected-note {{static data member is
> predetermined as shared}}
> + static const float S2sc;
> +};
> +const float S2::S2sc = 0; // expected-note {{static data member
> is predetermined as shared}}
> +const S2 b;
> +const S2 ba[5];
> +class S3 { // expected-note 2 {{'S3' declared here}}
> + int a;
> + S3 &operator=(const S3 &s3);
> +
> +public:
> + S3() : a(0) {}
> + S3(S3 &s3) : a(s3.a) {}
> +};
> +const S3 c; // expected-note {{global variable is
> predetermined as shared}}
> +const S3 ca[5]; // expected-note {{global variable is
> predetermined as shared}}
> +extern const int f; // expected-note {{global variable is
> predetermined as shared}}
> +class S4 { // expected-note 3 {{'S4' declared here}}
> + int a;
> + S4();
> + S4(const S4 &s4);
> +
> +public:
> + S4(int v) : a(v) {}
> +};
> +class S5 { // expected-note {{'S5' declared here}}
> + int a;
> + S5() : a(0) {}
> +
> +public:
> + S5(const S5 &s5) : a(s5.a) {}
> + S5(int v) : a(v) {}
> +};
> +class S6 {
> + int a;
> + S6() : a(0) {}
> +
> +public:
> + S6(const S6 &s6) : a(s6.a) {}
> + S6(int v) : a(v) {}
> +};
> +
> +S3 h;
> +#pragma omp threadprivate(h) // expected-note 2 {{defined as
> threadprivate or thread local}}
> +
> +template <class I, class C>
> +int foomain(int argc, char **argv) {
> + I e(4); // expected-note {{'e' defined here}}
> + I g(5); // expected-note {{'g' defined here}}
> + int i;
> + int &j = i; // expected-note {{'j'
> defined here}}
> +#pragma omp parallel sections lastprivate // expected-error
> {{expected '(' after 'lastprivate'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc, // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(a, b) // expected-error
> {{lastprivate variable with incomplete type 'S1'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argv[1]) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(e, g) // expected-error
> 2 {{lastprivate variable must have an accessible, unambiguous
> default constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(h) // expected-error
> {{threadprivate or thread local variable cannot be lastprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections linear(i) // expected-error
> {{unexpected OpenMP clause 'linear' in directive '#pragma omp
> parallel sections'}}
> + {
> + foo();
> + }
> +#pragma omp parallel
> + {
> + int v = 0;
> + int i;
> +#pragma omp parallel sections lastprivate(i)
> + {
> + foo();
> + }
> + v += i;
> + }
> +#pragma omp parallel shared(i)
> +#pragma omp parallel private(i)
> +#pragma omp parallel sections lastprivate(j) // expected-error
> {{arguments of OpenMP clause 'lastprivate' cannot be of reference
> type}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(i)
> + {
> + foo();
> + }
> + return 0;
> +}
> +
> +int main(int argc, char **argv) {
> + const int d = 5; // expected-note {{constant variable is
> predetermined as shared}}
> + const int da[5] = {0}; // expected-note {{constant variable is
> predetermined as shared}}
> + S4 e(4); // expected-note {{'e' defined here}}
> + S5 g(5); // expected-note {{'g' defined here}}
> + S3 m; // expected-note 2 {{'m' defined here}}
> + S6 n(2);
> + int i;
> + int &j = i; // expected-note {{'j'
> defined here}}
> +#pragma omp parallel sections lastprivate // expected-error
> {{expected '(' after 'lastprivate'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc, // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(a, b, c, d, f) //
> expected-error {{lastprivate variable with incomplete type 'S1'}}
> expected-error 3 {{shared variable cannot be lastprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(argv[1]) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(2 * 2) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(ba)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(ca) // expected-error
> {{shared variable cannot be lastprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(da) // expected-error
> {{shared variable cannot be lastprivate}}
> + {
> + foo();
> + }
> + int xa;
> +#pragma omp parallel sections lastprivate(xa) // OK
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(S2::S2s) //
> expected-error {{shared variable cannot be lastprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(S2::S2sc) //
> expected-error {{shared variable cannot be lastprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections safelen(5) // expected-error
> {{unexpected OpenMP clause 'safelen' in directive '#pragma omp
> parallel sections'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(e, g) // expected-error
> 2 {{lastprivate variable must have an accessible, unambiguous
> default constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(m) // expected-error
> {{lastprivate variable must have an accessible, unambiguous copy
> assignment operator}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(h) // expected-error
> {{threadprivate or thread local variable cannot be lastprivate}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(xa), lastprivate(xa) //
> expected-error {{private variable cannot be lastprivate}}
> expected-note {{defined as private}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(i)
> + {
> + foo();
> + }
> +#pragma omp parallel private(xa)
> +#pragma omp parallel sections lastprivate(xa)
> + {
> + foo();
> + }
> +#pragma omp parallel reduction(+ : xa)
> +#pragma omp parallel sections lastprivate(xa)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(j) // expected-error
> {{arguments of OpenMP clause 'lastprivate' cannot be of reference
> type}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections firstprivate(m) lastprivate(m) //
> expected-error {{lastprivate variable must have an accessible,
> unambiguous copy assignment operator}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(n) firstprivate(n) // OK
> + {
> + foo();
> + }
> + return foomain<S4, S5>(argc, argv); // expected-note {{in
> instantiation of function template specialization 'foomain<S4,
> S5>' requested here}}
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_messages.cpp (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_messages.cpp Tue Jul
> 8 03:12:03 2014
> @@ -0,0 +1,86 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100
> -std=c++11 -o - %s
> +
> +void foo() {
> +}
> +
> +#pragma omp parallel sections // expected-error {{unexpected
> OpenMP directive '#pragma omp parallel sections'}}
> +
> +int main(int argc, char **argv) {
> +#pragma omp parallel sections {// expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections( // expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections[ // expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections] // expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections) // expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections } // expected-warning {{extra
> tokens at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +// expected-warning at +1 {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> +#pragma omp parallel sections unknown()
> + {
> + foo();
> +#pragma omp section
> + L1:
> + foo();
> + }
> +#pragma omp parallel sections
> + {
> + ;
> + }
> +#pragma omp parallel sections
> + {
> + goto L1; // expected-error {{use of undeclared label 'L1'}}
> + }
> +
> + for (int i = 0; i < 10; ++i) {
> + switch (argc) {
> + case (0):
> +#pragma omp parallel sections
> + {
> + foo();
> + break; // expected-error {{'break' statement not in loop
> or switch statement}}
> + continue; // expected-error {{'continue' statement not in
> loop statement}}
> + }
> + default:
> + break;
> + }
> + }
> +#pragma omp parallel sections default(none)
> + {
> + ++argc; // expected-error {{variable 'argc' must have
> explicitly specified data sharing attributes}}
> + }
> +
> + goto L2; // expected-error {{use of undeclared label 'L2'}}
> +#pragma omp parallel sections
> + {
> + L2:
> + foo();
> + }
> +#pragma omp parallel sections
> + {
> + return 1; // expected-error {{cannot return from OpenMP region}}
> + }
> +
> + [[]] // expected-error {{an attribute list cannot appear here}}
> +#pragma omp parallel sections
> + {
> + }
> +
> + return 0;
> +}
> +
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c Tue
> Jul 8 03:12:03 2014
> @@ -0,0 +1,260 @@
> +// RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s
> +
> +void foo();
> +
> +// expected-error at +1 {{unexpected OpenMP directive '#pragma omp
> parallel sections'}}
> +#pragma omp parallel sections
> +
> +// expected-error at +1 {{unexpected OpenMP directive '#pragma omp
> parallel sections'}}
> +#pragma omp parallel sections foo
> +
> +void test_no_clause() {
> + int i;
> +#pragma omp parallel sections
> + {
> + foo();
> + }
> +
> +// expected-error at +2 {{the statement for '#pragma omp parallel
> sections' must be a compound statement}}
> +#pragma omp parallel sections
> + ++i;
> +
> +#pragma omp parallel sections
> + {
> + foo();
> + foo(); // expected-error {{statement in 'omp parallel
> sections' directive must be enclosed into a section region}}
> + }
> +
> +}
> +
> +void test_branch_protected_scope() {
> + int i = 0;
> +L1:
> + ++i;
> +
> + int x[24];
> +
> +#pragma omp parallel sections
> + {
> + if (i == 5)
> + goto L1; // expected-error {{use of undeclared label 'L1'}}
> + else if (i == 6)
> + return; // expected-error {{cannot return from OpenMP region}}
> + else if (i == 7)
> + goto L2;
> + else if (i == 8) {
> + L2:
> + x[i]++;
> + }
> +#pragma omp section
> + if (i == 5)
> + goto L1; // expected-error {{use of undeclared label 'L1'}}
> + else if (i == 6)
> + return; // expected-error {{cannot return from OpenMP region}}
> + else if (i == 7)
> + goto L3;
> + else if (i == 8) {
> + L3:
> + x[i]++;
> + }
> + }
> +
> + if (x[0] == 0)
> + goto L2; // expected-error {{use of undeclared label 'L2'}}
> + else if (x[1] == 1)
> + goto L1;
> + goto L3; // expected-error {{use of undeclared label 'L3'}}
> +}
> +
> +void test_invalid_clause() {
> + int i;
> +// expected-warning at +1 {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> +#pragma omp parallel sections foo bar
> + {
> + foo();
> +// expected-error at +1 {{unexpected OpenMP clause 'nowait' in
> directive '#pragma omp section'}}
> +#pragma omp section nowait
> + ;
> + }
> +}
> +
> +void test_non_identifiers() {
> + int i, x;
> +
> +// expected-warning at +1 {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> +#pragma omp parallel sections;
> + {
> + foo();
> + }
> +// expected-error at +2 {{unexpected OpenMP clause 'linear' in
> directive '#pragma omp parallel sections'}}
> +// expected-warning at +1 {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> +#pragma omp parallel sections linear(x);
> + {
> + foo();
> + }
> +
> +// expected-warning at +1 {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> +#pragma omp parallel sections private(x);
> + {
> + foo();
> + }
> +
> +// expected-warning at +1 {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> +#pragma omp parallel sections, private(x);
> + {
> + foo();
> + }
> +}
> +
> +void test_private() {
> + int i;
> +// expected-error at +2 {{expected expression}}
> +// expected-error at +1 {{expected ')'}} expected-note at +1 {{to match
> this '('}}
> +#pragma omp parallel sections private(
> + {
> + foo();
> + }
> +// expected-error at +2 {{expected ')'}} expected-note at +2 {{to match
> this '('}}
> +// expected-error at +1 2 {{expected expression}}
> +#pragma omp parallel sections private(,
> + {
> + foo();
> + }
> +// expected-error at +1 2 {{expected expression}}
> +#pragma omp parallel sections private(, )
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections private()
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections private(int)
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected variable name}}
> +#pragma omp parallel sections private(0)
> + {
> + foo();
> + }
> +
> + int x, y, z;
> +#pragma omp parallel sections private(x)
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(x, y)
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(x, y, z)
> + {
> + foo();
> + }
> +}
> +
> +void test_lastprivate() {
> + int i;
> +// expected-error at +2 {{expected ')'}} expected-note at +2 {{to match
> this '('}}
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections lastprivate(
> + {
> + foo();
> + }
> +
> +// expected-error at +2 {{expected ')'}} expected-note at +2 {{to match
> this '('}}
> +// expected-error at +1 2 {{expected expression}}
> +#pragma omp parallel sections lastprivate(,
> + {
> + foo();
> + }
> +// expected-error at +1 2 {{expected expression}}
> +#pragma omp parallel sections lastprivate(, )
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections lastprivate()
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections lastprivate(int)
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected variable name}}
> +#pragma omp parallel sections lastprivate(0)
> + {
> + foo();
> + }
> +
> + int x, y, z;
> +#pragma omp parallel sections lastprivate(x)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(x, y)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(x, y, z)
> + {
> + foo();
> + }
> +}
> +
> +void test_firstprivate() {
> + int i;
> +// expected-error at +2 {{expected ')'}} expected-note at +2 {{to match
> this '('}}
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections firstprivate(
> + {
> + foo();
> + }
> +
> +// expected-error at +2 {{expected ')'}} expected-note at +2 {{to match
> this '('}}
> +// expected-error at +1 2 {{expected expression}}
> +#pragma omp parallel sections firstprivate(,
> + {
> + foo();
> + }
> +// expected-error at +1 2 {{expected expression}}
> +#pragma omp parallel sections firstprivate(, )
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections firstprivate()
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected expression}}
> +#pragma omp parallel sections firstprivate(int)
> + {
> + foo();
> + }
> +// expected-error at +1 {{expected variable name}}
> +#pragma omp parallel sections firstprivate(0)
> + {
> + foo();
> + }
> +
> + int x, y, z;
> +#pragma omp parallel sections lastprivate(x) firstprivate(x)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(x, y) firstprivate(x, y)
> + {
> + foo();
> + }
> +#pragma omp parallel sections lastprivate(x, y, z)
> firstprivate(x, y, z)
> + {
> + foo();
> + }
> +}
> +
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange: cfe/trunk/test/OpenMP/parallel_sections_misc_messages.c
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added:
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp?rev=212516&view=auto
> ==============================================================================
> ---
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> (added)
> +++
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,63 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note {{declared here}}
> +
> +template <class T, typename S, int N> // expected-note {{declared
> here}}
> +T tmain(T argc, S **argv) {
> + #pragma omp parallel sections num_threads // expected-error
> {{expected '(' after 'num_threads'}}
> + {foo();}
> + #pragma omp parallel sections num_threads ( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {foo();}
> + #pragma omp parallel sections num_threads () // expected-error
> {{expected expression}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argc //
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argc)) //
> expected-warning {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> + {foo();}
> + #pragma omp parallel sections num_threads ((argc > 0) ? argv[1]
> : argv[2]) // expected-error 2 {{expression must have integral or
> unscoped enumeration type, not 'char *'}}
> + {foo();}
> + #pragma omp parallel sections num_threads (foobool(argc)),
> num_threads (true), num_threads (-5) // expected-error 2
> {{directive '#pragma omp parallel sections' cannot contain more
> than one 'num_threads' clause}} expected-error {{argument to
> 'num_threads' clause must be a positive integer value}}
> + {foo();}
> + #pragma omp parallel sections num_threads (S) // expected-error
> {{'S' does not refer to a value}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argv[1]=2) //
> expected-error {{expected ')'}} expected-note {{to match this
> '('}} expected-error 2 {{expression must have integral or unscoped
> enumeration type, not 'char *'}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argc)
> + {foo();}
> + #pragma omp parallel sections num_threads (N) // expected-error
> {{argument to 'num_threads' clause must be a positive integer value}}
> + {foo();}
> +
> + return argc;
> +}
> +
> +int main(int argc, char **argv) {
> + #pragma omp parallel sections num_threads // expected-error
> {{expected '(' after 'num_threads'}}
> + {foo();}
> + #pragma omp parallel sections num_threads ( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {foo();}
> + #pragma omp parallel sections num_threads () // expected-error
> {{expected expression}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argc //
> expected-error {{expected ')'}} expected-note {{to match this '('}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argc)) //
> expected-warning {{extra tokens at the end of '#pragma omp
> parallel sections' are ignored}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argc > 0 ? argv[1] :
> argv[2]) // expected-error {{integral }}
> + {foo();}
> + #pragma omp parallel sections num_threads (foobool(argc)),
> num_threads (true), num_threads (-5) // expected-error 2
> {{directive '#pragma omp parallel sections' cannot contain more
> than one 'num_threads' clause}} expected-error {{argument to
> 'num_threads' clause must be a positive integer value}}
> + {foo();}
> + #pragma omp parallel sections num_threads (S1) //
> expected-error {{'S1' does not refer to a value}}
> + {foo();}
> + #pragma omp parallel sections num_threads (argv[1]=2) //
> expected-error {{expected ')'}} expected-note {{to match this
> '('}} expected-error {{expression must have integral or unscoped
> enumeration type, not 'char *'}}
> + {foo();}
> + #pragma omp parallel sections num_threads
> (num_threads(tmain<int, char, -1>(argc, argv) // expected-error 2
> {{expected ')'}} expected-note 2 {{to match this '('}}
> expected-note {{in instantiation of function template
> specialization 'tmain<int, char, -1>' requested here}}
> + {foo();}
> +
> + return tmain<int, char, 3>(argc, argv); // expected-note {{in
> instantiation of function template specialization 'tmain<int,
> char, 3>' requested here}}
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_num_threads_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,204 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note 2 {{declared here}} expected-note 2
> {{forward declaration of 'S1'}}
> +extern S1 a;
> +class S2 {
> + mutable int a;
> +
> +public:
> + S2() : a(0) {}
> +};
> +const S2 b;
> +const S2 ba[5];
> +class S3 {
> + int a;
> +
> +public:
> + S3() : a(0) {}
> +};
> +const S3 ca[5];
> +class S4 { // expected-note {{'S4' declared here}}
> + int a;
> + S4();
> +
> +public:
> + S4(int v) : a(v) {}
> +};
> +class S5 { // expected-note {{'S5' declared here}}
> + int a;
> + S5() : a(0) {}
> +
> +public:
> + S5(int v) : a(v) {}
> +};
> +
> +S3 h;
> +#pragma omp threadprivate(h) // expected-note 2 {{defined as
> threadprivate or thread local}}
> +
> +template <class I, class C>
> +int foomain(I argc, C **argv) {
> + I e(4);
> + I g(5);
> + int i;
> + int &j = i; // expected-note {{'j'
> defined here}}
> +#pragma omp parallel sections private // expected-error
> {{expected '(' after 'private'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc, // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(a, b) // expected-error
> {{private variable with incomplete type 'S1'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argv[1]) // expected-error
> {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(e, g)
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(h) // expected-error
> {{threadprivate or thread local variable cannot be private}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyprivate(i) // expected-error
> {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp
> parallel sections'}}
> + {
> + foo();
> + }
> +#pragma omp parallel
> + {
> + int v = 0;
> + int i;
> +#pragma omp parallel sections private(i)
> + {
> + foo();
> + }
> + v += i;
> + }
> +#pragma omp parallel shared(i)
> +#pragma omp parallel private(i)
> +#pragma omp parallel sections private(j) // expected-error
> {{arguments of OpenMP clause 'private' cannot be of reference type}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(i)
> + {
> + foo();
> + }
> + return 0;
> +}
> +
> +int main(int argc, char **argv) {
> + S4 e(4); // expected-note {{'e' defined here}}
> + S5 g(5); // expected-note {{'g' defined here}}
> + int i;
> + int &j = i; // expected-note {{'j'
> defined here}}
> +#pragma omp parallel sections private // expected-error
> {{expected '(' after 'private'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private() // expected-error
> {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc, // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(a, b) // expected-error
> {{private variable with incomplete type 'S1'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(argv[1]) // expected-error
> {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(e, g) // expected-error 2
> {{private variable must have an accessible, unambiguous default
> constructor}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(h) // expected-error
> {{threadprivate or thread local variable cannot be private}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections copyprivate(i) // expected-error
> {{unexpected OpenMP clause 'copyprivate' in directive '#pragma omp
> parallel sections'}}
> + {
> + foo();
> + }
> +#pragma omp parallel
> + {
> + int i;
> +#pragma omp parallel sections private(i)
> + {
> + foo();
> + }
> + }
> +#pragma omp parallel shared(i)
> +#pragma omp parallel private(i)
> +#pragma omp parallel sections private(j) // expected-error
> {{arguments of OpenMP clause 'private' cannot be of reference type}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(i)
> + {
> + foo();
> + }
> +
> + return 0;
> +}
> +
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_private_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,28 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o
> - %s
> +
> +void foo();
> +
> +int main(int argc, char **argv) {
> +#pragma omp parallel sections proc_bind // expected-error
> {{expected '(' after 'proc_bind'}}
> + { foo(); }
> +#pragma omp parallel sections proc_bind( // expected-error
> {{expected 'master', 'close' or 'spread' in OpenMP clause
> 'proc_bind'}} expected-error {{expected ')'}} expected-note {{to
> match this '('}}
> + { foo(); }
> +#pragma omp parallel sections proc_bind() // expected-error
> {{expected 'master', 'close' or 'spread' in OpenMP clause
> 'proc_bind'}}
> + { foo(); }
> +#pragma omp parallel sections proc_bind(master // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + { foo(); }
> +#pragma omp parallel sections proc_bind(close), proc_bind(spread)
> // expected-error {{directive '#pragma omp parallel sections'
> cannot contain more than one 'proc_bind' clause}}
> + { foo(); }
> +#pragma omp parallel sections proc_bind(x) // expected-error
> {{expected 'master', 'close' or 'spread' in OpenMP clause
> 'proc_bind'}}
> + { foo(); }
> +
> +#pragma omp parallel sections proc_bind(master)
> + { ++argc; }
> +
> +#pragma omp parallel sections proc_bind(close)
> + {
> +#pragma omp parallel sections proc_bind(spread)
> + { ++argc; }
> + }
> + return 0;
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_proc_bind_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,358 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 -o
> - %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note {{declared here}} expected-note 4
> {{forward declaration of 'S1'}}
> +extern S1 a;
> +class S2 {
> + mutable int a;
> + S2 &operator+=(const S2 &arg) { return (*this); }
> +
> +public:
> + S2() : a(0) {}
> + S2(S2 &s2) : a(s2.a) {}
> + static float S2s; // expected-note 2 {{static data member is
> predetermined as shared}}
> + static const float S2sc;
> +};
> +const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
> +S2 b; // expected-note 2 {{'b' defined here}}
> +const S2 ba[5]; // expected-note 2 {{'ba' defined here}}
> +class S3 {
> + int a;
> +
> +public:
> + S3() : a(0) {}
> + S3(const S3 &s3) : a(s3.a) {}
> + S3 operator+=(const S3 &arg1) { return arg1; }
> +};
> +int operator+=(const S3 &arg1, const S3 &arg2) { return 5; }
> +S3 c; // expected-note 2 {{'c' defined here}}
> +const S3 ca[5]; // expected-note 2 {{'ca' defined here}}
> +extern const int f; // expected-note 4 {{'f' declared here}}
> +class S4 { // expected-note {{'S4' declared here}}
> + int a;
> + S4();
> + S4(const S4 &s4);
> + S4 &operator+=(const S4 &arg) { return (*this); }
> +
> +public:
> + S4(int v) : a(v) {}
> +};
> +S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
> +class S5 {
> + int a;
> + S5() : a(0) {}
> + S5(const S5 &s5) : a(s5.a) {}
> + S5 &operator+=(const S5 &arg);
> +
> +public:
> + S5(int v) : a(v) {}
> +};
> +class S6 {
> + int a;
> +
> +public:
> + S6() : a(6) {}
> + operator int() { return 6; }
> +} o; // expected-note 2 {{'o' defined here}}
> +
> +S3 h, k;
> +#pragma omp threadprivate(h) // expected-note 2 {{defined as
> threadprivate or thread local}}
> +
> +template <class T> // expected-note {{declared here}}
> +T tmain(T argc) { // expected-note 2 {{'argc' defined here}}
> + const T d = T(); // expected-note 4 {{'d' defined here}}
> + const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
> + T qa[5] = {T()};
> + T i;
> + T &j = i; // expected-note 4 {{'j'
> defined here}}
> + S3 &p = k; // expected-note 2 {{'p'
> defined here}}
> + const T &r = da[(int)i]; // expected-note 2 {{'r'
> defined here}}
> + T &q = qa[(int)i]; // expected-note 2 {{'q'
> defined here}}
> + T fl; // expected-note {{'fl'
> defined here}}
> +#pragma omp parallel sections reduction // expected-error
> {{expected '(' after 'reduction'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction + // expected-error
> {{expected '(' after 'reduction'}} expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction( // expected-error
> {{expected unqualified-id}} expected-warning {{missing ':' after
> reduction identifier - ignoring}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(- // expected-warning
> {{missing ':' after reduction identifier - ignoring}}
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction() // expected-error
> {{expected unqualified-id}} expected-warning {{missing ':' after
> reduction identifier - ignoring}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(*) // expected-warning
> {{missing ':' after reduction identifier - ignoring}}
> expected-error {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(\) // expected-error
> {{expected unqualified-id}} expected-warning {{missing ':' after
> reduction identifier - ignoring}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(& : argc //
> expected-error {{expected ')'}} expected-note {{to match this
> '('}} expected-error {{variable of type 'float' is not valid for
> specified reduction operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(| : argc, //
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}} expected-error
> {{variable of type 'float' is not valid for specified reduction
> operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(|| : argc ? i : argc) //
> expected-error 2 {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(foo : argc)
> //expected-error {{incorrect reduction identifier, expected one of
> '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(&& : argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(^ : T) // expected-error
> {{'T' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : a, b, c, d, f) //
> expected-error {{reduction variable with incomplete type 'S1'}}
> expected-error 3 {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(min : a, b, c, d, f) //
> expected-error {{reduction variable with incomplete type 'S1'}}
> expected-error 2 {{arguments of OpenMP clause 'reduction' for
> 'min' or 'max' must be of arithmetic type}} expected-error 3
> {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(max : qa[1]) //
> expected-error 2 {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : ba) // expected-error
> {{a reduction variable with array type 'const S2 [5]'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(* : ca) // expected-error
> {{a reduction variable with array type 'const S3 [5]'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(- : da) // expected-error
> {{a reduction variable with array type 'const int [5]'}}
> expected-error {{a reduction variable with array type 'const float
> [5]'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(^ : fl) // expected-error
> {{variable of type 'float' is not valid for specified reduction
> operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(&& : S2::S2s) //
> expected-error {{shared variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(&& : S2::S2sc) //
> expected-error {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : h, k) //
> expected-error {{threadprivate or thread local variable cannot be
> reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : o) // expected-error
> {{variable of type 'class S6' is not valid for specified reduction
> operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(i), reduction(+ : j),
> reduction(+ : q) // expected-error 4 {{argument of OpenMP clause
> 'reduction' must reference the same object in all threads}}
> + {
> + foo();
> + }
> +#pragma omp parallel private(k)
> +#pragma omp parallel sections reduction(+ : p), reduction(+ : p)
> // expected-error 2 {{argument of OpenMP clause 'reduction' must
> reference the same object in all threads}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : p), reduction(+ : p)
> // expected-error 3 {{variable can appear only once in OpenMP
> 'reduction' clause}} expected-note 3 {{previously referenced here}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : r) // expected-error
> 2 {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel shared(i)
> +#pragma omp parallel reduction(min : i)
> +#pragma omp parallel sections reduction(max : j) //
> expected-error 2 {{argument of OpenMP clause 'reduction' must
> reference the same object in all threads}}
> + {
> + foo();
> + }
> +#pragma omp parallel private(fl)
> +#pragma omp parallel sections reduction(+ : fl)
> + {
> + foo();
> + }
> +#pragma omp parallel reduction(* : fl)
> +#pragma omp parallel sections reduction(+ : fl)
> + {
> + foo();
> + }
> +
> + return T();
> +}
> +
> +int main(int argc, char **argv) {
> + const int d = 5; // expected-note 2 {{'d' defined here}}
> + const int da[5] = {0}; // expected-note {{'da' defined here}}
> + int qa[5] = {0};
> + S4 e(4); // expected-note {{'e' defined here}}
> + S5 g(5); // expected-note {{'g' defined here}}
> + int i;
> + int &j = i; // expected-note 2 {{'j'
> defined here}}
> + S3 &p = k; // expected-note 2 {{'p'
> defined here}}
> + const int &r = da[i]; // expected-note {{'r'
> defined here}}
> + int &q = qa[i]; // expected-note {{'q'
> defined here}}
> + float fl; // expected-note {{'fl'
> defined here}}
> +#pragma omp parallel sections reduction // expected-error
> {{expected '(' after 'reduction'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction + // expected-error
> {{expected '(' after 'reduction'}} expected-warning {{extra tokens
> at the end of '#pragma omp parallel sections' are ignored}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction( // expected-error
> {{expected unqualified-id}} expected-warning {{missing ':' after
> reduction identifier - ignoring}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(- // expected-warning
> {{missing ':' after reduction identifier - ignoring}}
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction() // expected-error
> {{expected unqualified-id}} expected-warning {{missing ':' after
> reduction identifier - ignoring}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(*) // expected-warning
> {{missing ':' after reduction identifier - ignoring}}
> expected-error {{expected expression}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(\) // expected-error
> {{expected unqualified-id}} expected-warning {{missing ':' after
> reduction identifier - ignoring}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(foo : argc //
> expected-error {{expected ')'}} expected-note {{to match this
> '('}} expected-error {{incorrect reduction identifier, expected
> one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(| : argc, //
> expected-error {{expected expression}} expected-error {{expected
> ')'}} expected-note {{to match this '('}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(|| : argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(~ : argc) //
> expected-error {{expected unqualified-id}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(&& : argc)
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(^ : S1) // expected-error
> {{'S1' does not refer to a value}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : a, b, c, d, f) //
> expected-error {{reduction variable with incomplete type 'S1'}}
> expected-error 2 {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(min : a, b, c, d, f) //
> expected-error {{reduction variable with incomplete type 'S1'}}
> expected-error 2 {{arguments of OpenMP clause 'reduction' for
> 'min' or 'max' must be of arithmetic type}} expected-error 2
> {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(max : argv[1]) //
> expected-error {{expected variable name}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : ba) // expected-error
> {{a reduction variable with array type 'const S2 [5]'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(* : ca) // expected-error
> {{a reduction variable with array type 'const S3 [5]'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(- : da) // expected-error
> {{a reduction variable with array type 'const int [5]'}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(^ : fl) // expected-error
> {{variable of type 'float' is not valid for specified reduction
> operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(&& : S2::S2s) //
> expected-error {{shared variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(&& : S2::S2sc) //
> expected-error {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(& : e, g) //
> expected-error {{reduction variable must have an accessible,
> unambiguous default constructor}} expected-error {{variable of
> type 'S5' is not valid for specified reduction operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : h, k) //
> expected-error {{threadprivate or thread local variable cannot be
> reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : o) // expected-error
> {{variable of type 'class S6' is not valid for specified reduction
> operation}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections private(i), reduction(+ : j),
> reduction(+ : q) // expected-error 2 {{argument of OpenMP clause
> 'reduction' must reference the same object in all threads}}
> + {
> + foo();
> + }
> +#pragma omp parallel private(k)
> +#pragma omp parallel sections reduction(+ : p), reduction(+ : p)
> // expected-error 2 {{argument of OpenMP clause 'reduction' must
> reference the same object in all threads}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : p), reduction(+ : p)
> // expected-error {{variable can appear only once in OpenMP
> 'reduction' clause}} expected-note {{previously referenced here}}
> + {
> + foo();
> + }
> +#pragma omp parallel sections reduction(+ : r) // expected-error
> {{const-qualified variable cannot be reduction}}
> + {
> + foo();
> + }
> +#pragma omp parallel shared(i)
> +#pragma omp parallel reduction(min : i)
> +#pragma omp parallel sections reduction(max : j) //
> expected-error {{argument of OpenMP clause 'reduction' must
> reference the same object in all threads}}
> + {
> + foo();
> + }
> +#pragma omp parallel private(fl)
> +#pragma omp parallel sections reduction(+ : fl)
> + {
> + foo();
> + }
> +#pragma omp parallel reduction(* : fl)
> +#pragma omp parallel sections reduction(+ : fl)
> + {
> + foo();
> + }
> +
> + return tmain(argc) + tmain(fl); // expected-note {{in
> instantiation of function template specialization 'tmain<int>'
> requested here}} expected-note {{in instantiation of function
> template specialization 'tmain<float>' requested here}}
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Added: cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp?rev=212516&view=auto
> ==============================================================================
> --- cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> (added)
> +++ cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> Tue Jul 8 03:12:03 2014
> @@ -0,0 +1,110 @@
> +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
> +
> +void foo() {
> +}
> +
> +bool foobool(int argc) {
> + return argc;
> +}
> +
> +struct S1; // expected-note {{declared here}}
> +extern S1 a;
> +class S2 {
> + mutable int a;
> +
> +public:
> + S2() : a(0) {}
> + S2(S2 &s2) : a(s2.a) {}
> +};
> +const S2 b;
> +const S2 ba[5];
> +class S3 {
> + int a;
> +
> +public:
> + S3() : a(0) {}
> + S3(S3 &s3) : a(s3.a) {}
> +};
> +const S3 c;
> +const S3 ca[5];
> +extern const int f;
> +class S4 {
> + int a;
> + S4();
> + S4(const S4 &s4);
> +
> +public:
> + S4(int v) : a(v) {}
> +};
> +class S5 {
> + int a;
> + S5() : a(0) {}
> + S5(const S5 &s5) : a(s5.a) {}
> +
> +public:
> + S5(int v) : a(v) {}
> +};
> +
> +S3 h;
> +#pragma omp threadprivate(h) // expected-note {{defined as
> threadprivate or thread local}}
> +
> +int main(int argc, char **argv) {
> + const int d = 5;
> + const int da[5] = {0};
> + S4 e(4);
> + S5 g(5);
> + int i;
> + int &j = i;
> +#pragma omp parallel sections shared // expected-error {{expected
> '(' after 'shared'}}
> + { foo(); }
> +#pragma omp parallel sections shared( // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + { foo(); }
> +#pragma omp parallel sections shared() // expected-error
> {{expected expression}}
> + { foo(); }
> +#pragma omp parallel sections shared(argc // expected-error
> {{expected ')'}} expected-note {{to match this '('}}
> + { foo(); }
> +#pragma omp parallel sections shared(argc, // expected-error
> {{expected expression}} expected-error {{expected ')'}}
> expected-note {{to match this '('}}
> + { foo(); }
> +#pragma omp parallel sections shared(argc > 0 ? argv[1] :
> argv[2]) // expected-error {{expected variable name}}
> + { foo(); }
> +#pragma omp parallel sections shared(argc)
> + { foo(); }
> +#pragma omp parallel sections shared(S1) // expected-error {{'S1'
> does not refer to a value}}
> + { foo(); }
> +#pragma omp parallel sections shared(a, b, c, d, f)
> + { foo(); }
> +#pragma omp parallel sections shared(argv[1]) // expected-error
> {{expected variable name}}
> + { foo(); }
> +#pragma omp parallel sections shared(ba)
> + { foo(); }
> +#pragma omp parallel sections shared(ca)
> + { foo(); }
> +#pragma omp parallel sections shared(da)
> + { foo(); }
> +#pragma omp parallel sections shared(e, g)
> + { foo(); }
> +#pragma omp parallel sections shared(h) // expected-error
> {{threadprivate or thread local variable cannot be shared}}
> + { foo(); }
> +#pragma omp parallel sections private(i), shared(i) //
> expected-error {{private variable cannot be shared}} expected-note
> {{defined as private}}
> + { foo(); }
> +#pragma omp parallel sections firstprivate(i), shared(i) //
> expected-error {{firstprivate variable cannot be shared}}
> expected-note {{defined as firstprivate}}
> + { foo(); }
> +#pragma omp parallel sections private(i)
> + {
> +#pragma omp parallel sections shared(i)
> + {
> +#pragma omp parallel sections shared(j)
> + { foo(); }
> + }
> + }
> +#pragma omp parallel sections firstprivate(i)
> + {
> +#pragma omp parallel sections shared(i)
> + {
> +#pragma omp parallel sections shared(j)
> + { foo(); }
> + }
> + }
> +
> + return 0;
> +}
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> ------------------------------------------------------------------------------
> svn:keywords = Author Date Id Rev URL
>
> Propchange:
> cfe/trunk/test/OpenMP/parallel_sections_shared_messages.cpp
> ------------------------------------------------------------------------------
> svn:mime-type = text/plain
>
> Modified: cfe/trunk/tools/libclang/CIndex.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/tools/libclang/CIndex.cpp (original)
> +++ cfe/trunk/tools/libclang/CIndex.cpp Tue Jul 8 03:12:03 2014
> @@ -1861,6 +1861,7 @@ public:
> void VisitOMPSectionDirective(const OMPSectionDirective *D);
> void VisitOMPSingleDirective(const OMPSingleDirective *D);
> void VisitOMPParallelForDirective(const OMPParallelForDirective
> *D);
> + void VisitOMPParallelSectionsDirective(const
> OMPParallelSectionsDirective *D);
>
> private:
> void AddDeclarationNameInfo(const Stmt *S);
> @@ -2317,6 +2318,11 @@ EnqueueVisitor::VisitOMPParallelForDirec
> VisitOMPExecutableDirective(D);
> }
>
> +void EnqueueVisitor::VisitOMPParallelSectionsDirective(
> + const OMPParallelSectionsDirective *D) {
> + VisitOMPExecutableDirective(D);
> +}
> +
> void CursorVisitor::EnqueueWorkList(VisitorWorkList &WL, const
> Stmt *S) {
> EnqueueVisitor(WL, MakeCXCursor(S, StmtParent,
> TU,RegionOfInterest)).Visit(S);
> }
> @@ -4003,6 +4009,8 @@ CXString clang_getCursorKindSpelling(enu
> return cxstring::createRef("OMPSingleDirective");
> case CXCursor_OMPParallelForDirective:
> return cxstring::createRef("OMPParallelForDirective");
> + case CXCursor_OMPParallelSectionsDirective:
> + return cxstring::createRef("OMPParallelSectionsDirective");
> }
>
> llvm_unreachable("Unhandled CXCursorKind");
>
> Modified: cfe/trunk/tools/libclang/CXCursor.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=212516&r1=212515&r2=212516&view=diff
> ==============================================================================
> --- cfe/trunk/tools/libclang/CXCursor.cpp (original)
> +++ cfe/trunk/tools/libclang/CXCursor.cpp Tue Jul 8 03:12:03 2014
> @@ -538,6 +538,9 @@ CXCursor cxcursor::MakeCXCursor(const St
> case Stmt::OMPParallelForDirectiveClass:
> K = CXCursor_OMPParallelForDirective;
> break;
> + case Stmt::OMPParallelSectionsDirectiveClass:
> + K = CXCursor_OMPParallelSectionsDirective;
> + break;
> }
>
> CXCursor C = { K, 0, { Parent, S, TU } };
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu <mailto:cfe-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140722/1a9e2e72/attachment.html>
More information about the cfe-commits
mailing list