r213363 - [OPENMP] Initial parsing and sema analysis for 'taskwait' directive.
Alexey Bataev
a.bataev at hotmail.com
Fri Jul 18 03:17:15 PDT 2014
Author: abataev
Date: Fri Jul 18 05:17:07 2014
New Revision: 213363
URL: http://llvm.org/viewvc/llvm-project?rev=213363&view=rev
Log:
[OPENMP] Initial parsing and sema analysis for 'taskwait' directive.
Added:
cfe/trunk/test/OpenMP/taskwait_ast_print.cpp (with props)
cfe/trunk/test/OpenMP/taskwait_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/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/Parse/ParseStmt.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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Jul 18 05:17:07 2014
@@ -2179,9 +2179,13 @@ enum CXCursorKind {
*/
CXCursor_OMPBarrierDirective = 243,
+ /** \brief OpenMP taskwait directive.
+ */
+ CXCursor_OMPTaskwaitDirective = 244,
+
/** \brief Windows Structured Exception Handling's leave statement.
*/
- CXCursor_SEHLeaveStmt = 244,
+ CXCursor_SEHLeaveStmt = 245,
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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Fri Jul 18 05:17:07 2014
@@ -2315,6 +2315,9 @@ DEF_TRAVERSE_STMT(OMPTaskyieldDirective,
DEF_TRAVERSE_STMT(OMPBarrierDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
+DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
+ { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
// 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Fri Jul 18 05:17:07 2014
@@ -2337,6 +2337,9 @@ DEF_TRAVERSE_STMT(OMPTaskyieldDirective,
DEF_TRAVERSE_STMT(OMPBarrierDirective,
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
+DEF_TRAVERSE_STMT(OMPTaskwaitDirective,
+ { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
// 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/StmtOpenMP.h Fri Jul 18 05:17:07 2014
@@ -862,6 +862,50 @@ public:
}
};
+/// \brief This represents '#pragma omp taskwait' directive.
+///
+/// \code
+/// #pragma omp taskwait
+/// \endcode
+///
+class OMPTaskwaitDirective : 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.
+ ///
+ OMPTaskwaitDirective(SourceLocation StartLoc, SourceLocation EndLoc)
+ : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
+ StartLoc, EndLoc, 0, 0) {}
+
+ /// \brief Build an empty directive.
+ ///
+ explicit OMPTaskwaitDirective()
+ : OMPExecutableDirective(this, OMPTaskwaitDirectiveClass, OMPD_taskwait,
+ SourceLocation(), SourceLocation(), 0, 0) {}
+
+public:
+ /// \brief Creates directive.
+ ///
+ /// \param C AST context.
+ /// \param StartLoc Starting location of the directive kind.
+ /// \param EndLoc Ending Location of the directive.
+ ///
+ static OMPTaskwaitDirective *
+ Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc);
+
+ /// \brief Creates an empty directive.
+ ///
+ /// \param C AST context.
+ ///
+ static OMPTaskwaitDirective *CreateEmpty(const ASTContext &C, EmptyShell);
+
+ static bool classof(const Stmt *T) {
+ return T->getStmtClass() == OMPTaskwaitDirectiveClass;
+ }
+};
+
} // end namespace clang
#endif
Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Fri Jul 18 05:17:07 2014
@@ -67,6 +67,7 @@ OPENMP_DIRECTIVE(single)
OPENMP_DIRECTIVE(master)
OPENMP_DIRECTIVE(taskyield)
OPENMP_DIRECTIVE(barrier)
+OPENMP_DIRECTIVE(taskwait)
OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for")
OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
Modified: cfe/trunk/include/clang/Basic/StmtNodes.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/StmtNodes.td (original)
+++ cfe/trunk/include/clang/Basic/StmtNodes.td Fri Jul 18 05:17:07 2014
@@ -190,3 +190,4 @@ def OMPParallelSectionsDirective : DStmt
def OMPTaskDirective : DStmt<OMPExecutableDirective>;
def OMPTaskyieldDirective : DStmt<OMPExecutableDirective>;
def OMPBarrierDirective : DStmt<OMPExecutableDirective>;
+def OMPTaskwaitDirective : 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Jul 18 05:17:07 2014
@@ -7374,6 +7374,9 @@ public:
/// \brief Called on well-formed '\#pragma omp barrier'.
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc,
SourceLocation EndLoc);
+ /// \brief Called on well-formed '\#pragma omp taskwait'.
+ StmtResult ActOnOpenMPTaskwaitDirective(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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Fri Jul 18 05:17:07 2014
@@ -1352,6 +1352,7 @@ namespace clang {
STMT_OMP_TASK_DIRECTIVE,
STMT_OMP_TASKYIELD_DIRECTIVE,
STMT_OMP_BARRIER_DIRECTIVE,
+ STMT_OMP_TASKWAIT_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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Fri Jul 18 05:17:07 2014
@@ -1603,3 +1603,17 @@ OMPBarrierDirective *OMPBarrierDirective
return new (Mem) OMPBarrierDirective();
}
+OMPTaskwaitDirective *OMPTaskwaitDirective::Create(const ASTContext &C,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc) {
+ void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
+ OMPTaskwaitDirective *Dir = new (Mem) OMPTaskwaitDirective(StartLoc, EndLoc);
+ return Dir;
+}
+
+OMPTaskwaitDirective *OMPTaskwaitDirective::CreateEmpty(const ASTContext &C,
+ EmptyShell) {
+ void *Mem = C.Allocate(sizeof(OMPTaskwaitDirective));
+ return new (Mem) OMPTaskwaitDirective();
+}
+
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Fri Jul 18 05:17:07 2014
@@ -860,6 +860,11 @@ void StmtPrinter::VisitOMPBarrierDirecti
PrintOMPExecutableDirective(Node);
}
+void StmtPrinter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *Node) {
+ Indent() << "#pragma omp taskwait";
+ 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Jul 18 05:17:07 2014
@@ -415,6 +415,10 @@ void StmtProfiler::VisitOMPBarrierDirect
VisitOMPExecutableDirective(S);
}
+void StmtProfiler::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)
+++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Fri Jul 18 05:17:07 2014
@@ -259,6 +259,7 @@ bool clang::isAllowedClauseForDirective(
case OMPD_master:
case OMPD_taskyield:
case OMPD_barrier:
+ case OMPD_taskwait:
break;
}
return false;
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri Jul 18 05:17:07 2014
@@ -212,6 +212,9 @@ void CodeGenFunction::EmitStmt(const Stm
case Stmt::OMPBarrierDirectiveClass:
EmitOMPBarrierDirective(cast<OMPBarrierDirective>(*S));
break;
+ case Stmt::OMPTaskwaitDirectiveClass:
+ EmitOMPTaskwaitDirective(cast<OMPTaskwaitDirective>(*S));
+ break;
}
}
Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Fri Jul 18 05:17:07 2014
@@ -116,3 +116,7 @@ void CodeGenFunction::EmitOMPBarrierDire
llvm_unreachable("CodeGen for 'omp barrier' is not supported yet.");
}
+void CodeGenFunction::EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &) {
+ llvm_unreachable("CodeGen for 'omp taskwait' 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Fri Jul 18 05:17:07 2014
@@ -1933,6 +1933,7 @@ public:
void EmitOMPTaskDirective(const OMPTaskDirective &S);
void EmitOMPTaskyieldDirective(const OMPTaskyieldDirective &S);
void EmitOMPBarrierDirective(const OMPBarrierDirective &S);
+ void EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)
+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Fri Jul 18 05:17:07 2014
@@ -85,6 +85,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
case OMPD_task:
case OMPD_taskyield:
case OMPD_barrier:
+ case OMPD_taskwait:
case OMPD_for:
case OMPD_sections:
case OMPD_section:
@@ -109,8 +110,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpen
/// executable-directive:
/// annot_pragma_openmp 'parallel' | 'simd' | 'for' | 'sections' |
/// 'section' | 'single' | 'master' | 'parallel for' |
-/// 'parallel sections' | 'task' | 'taskyield' | 'barrier' {clause}
-/// annot_pragma_openmp_end
+/// 'parallel sections' | 'task' | 'taskyield' | 'barrier' | 'taskwait'
+/// {clause} annot_pragma_openmp_end
///
StmtResult
Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
@@ -148,6 +149,7 @@ Parser::ParseOpenMPDeclarativeOrExecutab
break;
case OMPD_taskyield:
case OMPD_barrier:
+ case OMPD_taskwait:
if (!StandAloneAllowed) {
Diag(Tok, diag::err_omp_immediate_directive)
<< getOpenMPDirectiveName(DKind);
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Fri Jul 18 05:17:07 2014
@@ -804,7 +804,6 @@ StmtResult Parser::ParseCompoundStatemen
/// declaration
/// [GNU] '__extension__' declaration
/// statement
-/// [OMP] openmp-directive [TODO]
///
/// [GNU] label-declarations:
/// [GNU] label-declaration
@@ -813,10 +812,6 @@ StmtResult Parser::ParseCompoundStatemen
/// [GNU] label-declaration:
/// [GNU] '__label__' identifier-list ';'
///
-/// [OMP] openmp-directive: [TODO]
-/// [OMP] barrier-directive
-/// [OMP] flush-directive
-///
StmtResult Parser::ParseCompoundStatement(bool isStmtExpr,
unsigned ScopeFlags) {
assert(Tok.is(tok::l_brace) && "Not a compount stmt!");
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Jul 18 05:17:07 2014
@@ -1052,6 +1052,14 @@ void Sema::ActOnOpenMPRegionStart(OpenMP
Params);
break;
}
+ case OMPD_taskwait: {
+ Sema::CapturedParamNameType Params[] = {
+ std::make_pair(StringRef(), QualType()) // __context with shared vars
+ };
+ ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP,
+ Params);
+ break;
+ }
case OMPD_threadprivate:
llvm_unreachable("OpenMP Directive is not allowed");
case OMPD_unknown:
@@ -1078,6 +1086,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | parallel | task | * |
// | parallel | taskyield | * |
// | parallel | barrier | * |
+ // | parallel | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | for | parallel | * |
// | for | for | + |
@@ -1091,6 +1100,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | for | task | * |
// | for | taskyield | * |
// | for | barrier | + |
+ // | for | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | master | parallel | * |
// | master | for | + |
@@ -1104,6 +1114,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | master | task | * |
// | master | taskyield | * |
// | master | barrier | + |
+ // | master | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | simd | parallel | |
// | simd | for | |
@@ -1117,6 +1128,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | simd | task | |
// | simd | taskyield | |
// | simd | barrier | |
+ // | simd | taskwait | |
// +------------------+-----------------+------------------------------------+
// | sections | parallel | * |
// | sections | for | + |
@@ -1130,6 +1142,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | sections | task | * |
// | sections | taskyield | * |
// | sections | barrier | + |
+ // | sections | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | section | parallel | * |
// | section | for | + |
@@ -1143,6 +1156,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | section | task | * |
// | section | taskyield | * |
// | section | barrier | + |
+ // | section | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | single | parallel | * |
// | single | for | + |
@@ -1156,6 +1170,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | single | task | * |
// | single | taskyield | * |
// | single | barrier | + |
+ // | single | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | parallel for | parallel | * |
// | parallel for | for | + |
@@ -1169,6 +1184,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | parallel for | task | * |
// | parallel for | taskyield | * |
// | parallel for | barrier | + |
+ // | parallel for | taskwait | * |
// +------------------+-----------------+------------------------------------+
// | parallel sections| parallel | * |
// | parallel sections| for | + |
@@ -1182,6 +1198,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | parallel sections| task | * |
// | parallel sections| taskyield | * |
// | parallel sections| barrier | + |
+ // | parallel sections| taskwait | * |
// +------------------+-----------------+------------------------------------+
// | task | parallel | * |
// | task | for | + |
@@ -1195,6 +1212,7 @@ bool CheckNestingOfRegions(Sema &SemaRef
// | task | task | * |
// | task | taskyield | * |
// | task | barrier | + |
+ // | task | taskwait | * |
// +------------------+-----------------+------------------------------------+
if (Stack->getCurScope()) {
auto ParentRegion = Stack->getParentDirective();
@@ -1351,6 +1369,13 @@ StmtResult Sema::ActOnOpenMPExecutableDi
"No associated statement allowed for 'omp barrier' directive");
Res = ActOnOpenMPBarrierDirective(StartLoc, EndLoc);
break;
+ case OMPD_taskwait:
+ assert(ClausesWithImplicit.empty() &&
+ "No clauses are allowed for 'omp taskwait' directive");
+ assert(AStmt == nullptr &&
+ "No associated statement allowed for 'omp taskwait' directive");
+ Res = ActOnOpenMPTaskwaitDirective(StartLoc, EndLoc);
+ break;
case OMPD_threadprivate:
llvm_unreachable("OpenMP Directive is not allowed");
case OMPD_unknown:
@@ -2104,6 +2129,11 @@ StmtResult Sema::ActOnOpenMPBarrierDirec
return OMPBarrierDirective::Create(Context, StartLoc, EndLoc);
}
+StmtResult Sema::ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc,
+ SourceLocation EndLoc) {
+ return OMPTaskwaitDirective::Create(Context, StartLoc, EndLoc);
+}
+
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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Jul 18 05:17:07 2014
@@ -6579,6 +6579,17 @@ TreeTransform<Derived>::TransformOMPBarr
return Res;
}
+template <typename Derived>
+StmtResult
+TreeTransform<Derived>::TransformOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
+ DeclarationNameInfo DirName;
+ getDerived().getSema().StartOpenMPDSABlock(OMPD_taskwait, 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Fri Jul 18 05:17:07 2014
@@ -2000,6 +2000,11 @@ void ASTStmtReader::VisitOMPBarrierDirec
VisitOMPExecutableDirective(D);
}
+void ASTStmtReader::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
+ VisitStmt(D);
+ VisitOMPExecutableDirective(D);
+}
+
//===----------------------------------------------------------------------===//
// ASTReader Implementation
//===----------------------------------------------------------------------===//
@@ -2542,6 +2547,10 @@ Stmt *ASTReader::ReadStmtFromStream(Modu
S = OMPBarrierDirective::CreateEmpty(Context, Empty);
break;
+ case STMT_OMP_TASKWAIT_DIRECTIVE:
+ S = OMPTaskwaitDirective::CreateEmpty(Context, 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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Fri Jul 18 05:17:07 2014
@@ -1903,6 +1903,12 @@ void ASTStmtWriter::VisitOMPBarrierDirec
Code = serialization::STMT_OMP_BARRIER_DIRECTIVE;
}
+void ASTStmtWriter::VisitOMPTaskwaitDirective(OMPTaskwaitDirective *D) {
+ VisitStmt(D);
+ VisitOMPExecutableDirective(D);
+ Code = serialization::STMT_OMP_TASKWAIT_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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Fri Jul 18 05:17:07 2014
@@ -743,6 +743,7 @@ void ExprEngine::Visit(const Stmt *S, Ex
case Stmt::OMPTaskDirectiveClass:
case Stmt::OMPTaskyieldDirectiveClass:
case Stmt::OMPBarrierDirectiveClass:
+ case Stmt::OMPTaskwaitDirectiveClass:
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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original)
+++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Fri Jul 18 05:17:07 2014
@@ -56,6 +56,11 @@ void foo() {
#pragma omp barrier
bar();
}
+#pragma omp parallel
+ {
+#pragma omp taskwait
+ bar();
+ }
// SIMD DIRECTIVE
#pragma omp simd
@@ -134,6 +139,11 @@ void foo() {
#pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
bar();
}
+#pragma omp simd
+ for (int i = 0; i < 10; ++i) {
+#pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
+ bar();
+ }
// FOR DIRECTIVE
#pragma omp for
@@ -231,6 +241,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
bar();
}
+#pragma omp for
+ for (int i = 0; i < 10; ++i) {
+#pragma omp taskwait
+ bar();
+ }
// SECTIONS DIRECTIVE
#pragma omp sections
@@ -329,6 +344,10 @@ void foo() {
{
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
}
+#pragma omp sections
+ {
+#pragma omp taskwait
+ }
// SECTION DIRECTIVE
#pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
@@ -457,6 +476,14 @@ void foo() {
bar();
}
}
+#pragma omp sections
+ {
+#pragma omp section
+ {
+#pragma omp taskwait
+ bar();
+ }
+ }
// SINGLE DIRECTIVE
#pragma omp single
@@ -545,6 +572,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
bar();
}
+#pragma omp single
+ {
+#pragma omp taskwait
+ bar();
+ }
// MASTER DIRECTIVE
#pragma omp master
@@ -633,6 +665,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
bar();
}
+#pragma omp master
+ {
+#pragma omp taskwait
+ bar();
+ }
// PARALLEL FOR DIRECTIVE
#pragma omp parallel for
@@ -730,6 +767,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
bar();
}
+#pragma omp parallel for
+ for (int i = 0; i < 10; ++i) {
+#pragma omp taskwait
+ bar();
+ }
// PARALLEL SECTIONS DIRECTIVE
#pragma omp parallel sections
@@ -825,6 +867,10 @@ void foo() {
{
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
}
+#pragma omp parallel sections
+ {
+#pragma omp taskwait
+ }
// TASK DIRECTIVE
#pragma omp task
@@ -875,6 +921,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
bar();
}
+#pragma omp task
+ {
+#pragma omp taskwait
+ bar();
+ }
}
void foo() {
@@ -932,6 +983,11 @@ void foo() {
#pragma omp barrier
bar();
}
+#pragma omp parallel
+ {
+#pragma omp taskwait
+ bar();
+ }
// SIMD DIRECTIVE
#pragma omp simd
@@ -1003,6 +1059,11 @@ void foo() {
#pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
bar();
}
+#pragma omp simd
+ for (int i = 0; i < 10; ++i) {
+#pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
+ bar();
+ }
// FOR DIRECTIVE
#pragma omp for
@@ -1091,6 +1152,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'for' region}}
bar();
}
+#pragma omp for
+ for (int i = 0; i < 10; ++i) {
+#pragma omp taskwait
+ bar();
+ }
// SECTIONS DIRECTIVE
#pragma omp sections
@@ -1178,6 +1244,10 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'sections' region}}
bar();
}
+#pragma omp sections
+ {
+#pragma omp taskwait
+ }
// SECTION DIRECTIVE
#pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
@@ -1306,6 +1376,14 @@ void foo() {
bar();
}
}
+#pragma omp sections
+ {
+#pragma omp section
+ {
+#pragma omp taskwait
+ bar();
+ }
+ }
// SINGLE DIRECTIVE
#pragma omp single
@@ -1389,6 +1467,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'single' region}}
bar();
}
+#pragma omp single
+ {
+#pragma omp taskwait
+ bar();
+ }
// MASTER DIRECTIVE
#pragma omp master
@@ -1477,6 +1560,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'master' region}}
bar();
}
+#pragma omp master
+ {
+#pragma omp taskwait
+ bar();
+ }
// PARALLEL FOR DIRECTIVE
#pragma omp parallel for
@@ -1573,6 +1661,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel for' region}}
bar();
}
+#pragma omp parallel for
+ for (int i = 0; i < 10; ++i) {
+#pragma omp taskwait
+ bar();
+ }
// PARALLEL SECTIONS DIRECTIVE
#pragma omp parallel sections
@@ -1666,6 +1759,10 @@ void foo() {
{
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'parallel sections' region}}
}
+#pragma omp parallel sections
+ {
+#pragma omp taskwait
+ }
// TASK DIRECTIVE
#pragma omp task
@@ -1716,6 +1813,11 @@ void foo() {
#pragma omp barrier // expected-error {{region cannot be closely nested inside 'task' region}}
bar();
}
+#pragma omp task
+ {
+#pragma omp taskwait
+ bar();
+ }
return foo<int>();
}
Added: cfe/trunk/test/OpenMP/taskwait_ast_print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskwait_ast_print.cpp?rev=213363&view=auto
==============================================================================
--- cfe/trunk/test/OpenMP/taskwait_ast_print.cpp (added)
+++ cfe/trunk/test/OpenMP/taskwait_ast_print.cpp Fri Jul 18 05:17:07 2014
@@ -0,0 +1,32 @@
+// 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>
+T tmain(T argc) {
+ static T a;
+#pragma omp taskwait
+ return a + argc;
+}
+// CHECK: static int a;
+// CHECK-NEXT: #pragma omp taskwait
+// CHECK: static char a;
+// CHECK-NEXT: #pragma omp taskwait
+// CHECK: static T a;
+// CHECK-NEXT: #pragma omp taskwait
+
+int main(int argc, char **argv) {
+ static int a;
+// CHECK: static int a;
+#pragma omp taskwait
+ // CHECK-NEXT: #pragma omp taskwait
+ return tmain(argc) + tmain(argv[0][0]) + a;
+}
+
+#endif
Propchange: cfe/trunk/test/OpenMP/taskwait_ast_print.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/OpenMP/taskwait_ast_print.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Rev URL
Propchange: cfe/trunk/test/OpenMP/taskwait_ast_print.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cfe/trunk/test/OpenMP/taskwait_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskwait_messages.cpp?rev=213363&view=auto
==============================================================================
--- cfe/trunk/test/OpenMP/taskwait_messages.cpp (added)
+++ cfe/trunk/test/OpenMP/taskwait_messages.cpp Fri Jul 18 05:17:07 2014
@@ -0,0 +1,110 @@
+// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
+
+template <class T>
+T tmain(T argc) {
+#pragma omp taskwait
+ ;
+#pragma omp taskwait untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskwait'}}
+#pragma omp taskwait unknown // expected-warning {{extra tokens at the end of '#pragma omp taskwait' are ignored}}
+ if (argc)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ if (argc) {
+#pragma omp taskwait
+ }
+ while (argc)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ while (argc) {
+#pragma omp taskwait
+ }
+ do
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ while (argc)
+ ;
+ do {
+#pragma omp taskwait
+ } while (argc);
+ switch (argc)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ switch (argc)
+ case 1:
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ switch (argc)
+ case 1: {
+#pragma omp taskwait
+ }
+ switch (argc) {
+#pragma omp taskwait
+ case 1:
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ break;
+ default: {
+#pragma omp taskwait
+ } break;
+ }
+ for (;;)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ for (;;) {
+#pragma omp taskwait
+ }
+label:
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+label1 : {
+#pragma omp taskwait
+}
+
+ return T();
+}
+
+int main(int argc, char **argv) {
+#pragma omp taskwait
+ ;
+#pragma omp taskwait untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskwait'}}
+#pragma omp taskwait unknown // expected-warning {{extra tokens at the end of '#pragma omp taskwait' are ignored}}
+ if (argc)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ if (argc) {
+#pragma omp taskwait
+ }
+ while (argc)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ while (argc) {
+#pragma omp taskwait
+ }
+ do
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ while (argc)
+ ;
+ do {
+#pragma omp taskwait
+ } while (argc);
+ switch (argc)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ switch (argc)
+ case 1:
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ switch (argc)
+ case 1: {
+#pragma omp taskwait
+ }
+ switch (argc) {
+#pragma omp taskwait
+ case 1:
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ break;
+ default: {
+#pragma omp taskwait
+ } break;
+ }
+ for (;;)
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+ for (;;) {
+#pragma omp taskwait
+ }
+label:
+#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}}
+label1 : {
+#pragma omp taskwait
+}
+
+ return tmain(argc);
+}
Propchange: cfe/trunk/test/OpenMP/taskwait_messages.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/OpenMP/taskwait_messages.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Rev URL
Propchange: cfe/trunk/test/OpenMP/taskwait_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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Jul 18 05:17:07 2014
@@ -1866,6 +1866,7 @@ public:
void VisitOMPTaskDirective(const OMPTaskDirective *D);
void VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *D);
void VisitOMPBarrierDirective(const OMPBarrierDirective *D);
+ void VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *D);
private:
void AddDeclarationNameInfo(const Stmt *S);
@@ -2352,6 +2353,10 @@ void EnqueueVisitor::VisitOMPBarrierDire
VisitOMPExecutableDirective(D);
}
+void EnqueueVisitor::VisitOMPTaskwaitDirective(const OMPTaskwaitDirective *D) {
+ VisitOMPExecutableDirective(D);
+}
+
void CursorVisitor::EnqueueWorkList(VisitorWorkList &WL, const Stmt *S) {
EnqueueVisitor(WL, MakeCXCursor(S, StmtParent, TU,RegionOfInterest)).Visit(S);
}
@@ -4048,6 +4053,8 @@ CXString clang_getCursorKindSpelling(enu
return cxstring::createRef("OMPTaskyieldDirective");
case CXCursor_OMPBarrierDirective:
return cxstring::createRef("OMPBarrierDirective");
+ case CXCursor_OMPTaskwaitDirective:
+ return cxstring::createRef("OMPTaskwaitDirective");
}
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=213363&r1=213362&r2=213363&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)
+++ cfe/trunk/tools/libclang/CXCursor.cpp Fri Jul 18 05:17:07 2014
@@ -553,6 +553,9 @@ CXCursor cxcursor::MakeCXCursor(const St
case Stmt::OMPBarrierDirectiveClass:
K = CXCursor_OMPBarrierDirective;
break;
+ case Stmt::OMPTaskwaitDirectiveClass:
+ K = CXCursor_OMPTaskwaitDirective;
+ break;
}
CXCursor C = { K, 0, { Parent, S, TU } };
More information about the cfe-commits
mailing list