r202360 - [OPENMP] First changes for Parsing and Sema for 'omp simd' directive support
Alexey Bataev
a.bataev at hotmail.com
Thu Feb 27 21:44:13 PST 2014
Aaron,
yes, it the new patches with clauses for 'omp simd' directive will be
prepared ASAP.
Best regards,
Alexey Bataev
=============
Software Engineer
Intel Compiler Team
Intel Corp.
27.02.2014 18:21, Aaron Ballman пишет:
> On Thu, Feb 27, 2014 at 3:29 AM, Alexey Bataev <a.bataev at hotmail.com> wrote:
>> Author: abataev
>> Date: Thu Feb 27 02:29:12 2014
>> New Revision: 202360
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=202360&view=rev
>> Log:
>> [OPENMP] First changes for Parsing and Sema for 'omp simd' directive support
>>
>> Added:
>> cfe/trunk/test/OpenMP/simd_ast_print.cpp (with props)
>> cfe/trunk/test/OpenMP/simd_misc_messages.c (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/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/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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang-c/Index.h (original)
>> +++ cfe/trunk/include/clang-c/Index.h Thu Feb 27 02:29:12 2014
>> @@ -2135,7 +2135,11 @@ enum CXCursorKind {
>> */
>> CXCursor_OMPParallelDirective = 232,
>>
>> - CXCursor_LastStmt = CXCursor_OMPParallelDirective,
>> + /** \brief OpenMP simd directive.
>> + */
>> + CXCursor_OMPSimdDirective = 233,
>> +
>> + CXCursor_LastStmt = CXCursor_OMPSimdDirective,
>>
>> /**
>> * \brief Cursor that represents the translation unit itself.
>>
>> Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
>> +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Thu Feb 27 02:29:12 2014
>> @@ -424,6 +424,7 @@ private:
>> bool TraverseFunctionHelper(FunctionDecl *D);
>> bool TraverseVarHelper(VarDecl *D);
>> bool TraverseOMPClause(OMPClause *C);
>> + bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
>> #define OPENMP_CLAUSE(Name, Class) \
>> bool Visit##Class(Class *C);
>> #include "clang/Basic/OpenMPKinds.def"
>> @@ -2331,11 +2332,22 @@ DEF_TRAVERSE_STMT(ObjCDictionaryLiteral,
>> DEF_TRAVERSE_STMT(AsTypeExpr, { })
>>
>> // OpenMP directives.
>> -DEF_TRAVERSE_STMT(OMPParallelDirective, {
>> +template<typename Derived>
>> +bool DataRecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
>> + OMPExecutableDirective *S) {
>> ArrayRef<OMPClause *> Clauses = S->clauses();
>> for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
>> I != E; ++I)
>> if (!TraverseOMPClause(*I)) return false;
>> + return true;
>> +}
>> +
>> +DEF_TRAVERSE_STMT(OMPParallelDirective, {
>> + if (!TraverseOMPExecutableDirective(S)) return false;
>> +})
>> +
>> +DEF_TRAVERSE_STMT(OMPSimdDirective, {
>> + if (!TraverseOMPExecutableDirective(S)) return false;
>> })
>>
>> // OpenMP clauses.
>>
>> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
>> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu Feb 27 02:29:12 2014
>> @@ -441,6 +441,7 @@ private:
>> bool TraverseFunctionHelper(FunctionDecl *D);
>> bool TraverseVarHelper(VarDecl *D);
>> bool TraverseOMPClause(OMPClause *C);
>> + bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
>> #define OPENMP_CLAUSE(Name, Class) \
>> bool Visit##Class(Class *C);
>> #include "clang/Basic/OpenMPKinds.def"
>> @@ -2355,11 +2356,22 @@ DEF_TRAVERSE_STMT(ObjCDictionaryLiteral,
>> DEF_TRAVERSE_STMT(AsTypeExpr, { })
>>
>> // OpenMP directives.
>> -DEF_TRAVERSE_STMT(OMPParallelDirective, {
>> +template<typename Derived>
>> +bool RecursiveASTVisitor<Derived>::TraverseOMPExecutableDirective(
>> + OMPExecutableDirective *S) {
>> ArrayRef<OMPClause *> Clauses = S->clauses();
>> for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
>> I != E; ++I)
>> if (!TraverseOMPClause(*I)) return false;
>> + return true;
>> +}
>> +
>> +DEF_TRAVERSE_STMT(OMPParallelDirective, {
>> + if (!TraverseOMPExecutableDirective(S)) return false;
>> +})
>> +
>> +DEF_TRAVERSE_STMT(OMPSimdDirective, {
>> + if (!TraverseOMPExecutableDirective(S)) return false;
>> })
>>
>> // OpenMP clauses.
>>
>> Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
>> +++ cfe/trunk/include/clang/AST/StmtOpenMP.h Thu Feb 27 02:29:12 2014
>> @@ -140,17 +140,18 @@ class OMPParallelDirective : public OMPE
>> /// \param EndLoc Ending Location of the directive.
>> ///
>> OMPParallelDirective(SourceLocation StartLoc, SourceLocation EndLoc,
>> - unsigned N)
>> + unsigned NumClauses)
>> : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
>> - StartLoc, EndLoc, N, 1) {}
>> + StartLoc, EndLoc, NumClauses, 1) {}
>>
>> /// \brief Build an empty directive.
>> ///
>> - /// \param N Number of clauses.
>> + /// \param NumClauses Number of clauses.
>> ///
>> - explicit OMPParallelDirective(unsigned N)
>> + explicit OMPParallelDirective(unsigned NumClauses)
>> : OMPExecutableDirective(this, OMPParallelDirectiveClass, OMPD_parallel,
>> - SourceLocation(), SourceLocation(), N, 1) {}
>> + SourceLocation(), SourceLocation(),
>> + NumClauses, 1) {}
>>
>> public:
>> /// \brief Creates directive with a list of \a Clauses.
>> @@ -168,9 +169,10 @@ public:
>> /// \brief Creates an empty directive with the place for \a N clauses.
>> ///
>> /// \param C AST context.
>> - /// \param N The number of clauses.
>> + /// \param NumClauses Number of clauses.
>> ///
>> - static OMPParallelDirective *CreateEmpty(const ASTContext &C, unsigned N,
>> + static OMPParallelDirective *CreateEmpty(const ASTContext &C,
>> + unsigned NumClauses,
>> EmptyShell);
>>
>> static bool classof(const Stmt *T) {
>> @@ -178,6 +180,76 @@ public:
>> }
>> };
>>
>> +/// \brief This represents '#pragma omp simd' directive.
>> +///
>> +/// \code
>> +/// #pragma omp simd private(a,b) linear(i,j:s) reduction(+:c,d)
>> +/// \endcode
>> +/// In this example directive '#pragma omp simd' has clauses 'private'
>> +/// with the variables 'a' and 'b', 'linear' with variables 'i', 'j' and
>> +/// linear step 's', 'reduction' with operator '+' and variables 'c' and 'd'.
>> +///
>> +class OMPSimdDirective : public OMPExecutableDirective {
>> + friend class ASTStmtReader;
>> + /// \brief Number of collapsed loops as specified by 'collapse' clause.
>> + unsigned CollapsedNum;
>> + /// \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 CollapsedNum Number of collapsed nested loops.
>> + /// \param NumClauses Number of clauses.
>> + ///
>> + OMPSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
>> + unsigned CollapsedNum, unsigned NumClauses)
>> + : OMPExecutableDirective(this, OMPSimdDirectiveClass, OMPD_simd,
>> + StartLoc, EndLoc, NumClauses, 1),
>> + CollapsedNum(CollapsedNum) { }
>> +
>> + /// \brief Build an empty directive.
>> + ///
>> + /// \param CollapsedNum Number of collapsed nested loops.
>> + /// \param NumClauses Number of clauses.
>> + ///
>> + explicit OMPSimdDirective(unsigned CollapsedNum, unsigned NumClauses)
>> + : OMPExecutableDirective(this, OMPSimdDirectiveClass, OMPD_simd,
>> + SourceLocation(), SourceLocation(),
>> + NumClauses, 1),
>> + CollapsedNum(CollapsedNum) { }
>> +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 OMPSimdDirective *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 CollapsedNum Number of collapsed nested loops.
>> + /// \param NumClauses Number of clauses.
>> + ///
>> + static OMPSimdDirective *CreateEmpty(const ASTContext &C,
>> + unsigned NumClauses,
>> + unsigned CollapsedNum,
>> + EmptyShell);
>> +
>> + unsigned getCollapsedNumber() const { return CollapsedNum; }
>> +
>> + static bool classof(const Stmt *T) {
>> + return T->getStmtClass() == OMPSimdDirectiveClass;
>> + }
>> +};
>> +
>> } // 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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Feb 27 02:29:12 2014
>> @@ -6835,24 +6835,26 @@ def err_omp_private_incomplete_type : Er
>> "a private variable with incomplete type %0">;
>> def err_omp_firstprivate_incomplete_type : Error<
>> "a firstprivate variable with incomplete type %0">;
>> -def err_omp_unexpected_clause_value : Error <
>> +def err_omp_unexpected_clause_value : Error<
>> "expected %0 in OpenMP clause '%1'">;
>> -def err_omp_expected_var_name : Error <
>> +def err_omp_expected_var_name : Error<
>> "expected variable name">;
>> -def err_omp_required_method : Error <
>> +def err_omp_required_method : Error<
>> "%0 variable must have an accessible, unambiguous %select{default constructor|copy constructor|copy assignment operator|'%2'|destructor}1">;
>> def err_omp_clause_ref_type_arg : Error<
>> "arguments of OpenMP clause '%0' cannot be of reference type %1">;
>> def err_omp_threadprivate_incomplete_type : Error<
>> "threadprivate variable with incomplete type %0">;
>> -def err_omp_no_dsa_for_variable : Error <
>> +def err_omp_no_dsa_for_variable : Error<
>> "variable %0 must have explicitly specified data sharing attributes">;
>> def err_omp_wrong_dsa : Error<
>> "%0 variable cannot be %1">;
>> -def note_omp_explicit_dsa : Note <
>> +def note_omp_explicit_dsa : Note<
>> "defined as %0">;
>> -def note_omp_predetermined_dsa : Note <
>> +def note_omp_predetermined_dsa : Note<
>> "predetermined as %0">;
>> +def err_omp_not_for : Error<
>> + "statement after '#pragma omp %0' must be a for loop">;
>> } // 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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)
>> +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Thu Feb 27 02:29:12 2014
>> @@ -21,6 +21,9 @@
>> #ifndef OPENMP_PARALLEL_CLAUSE
>> # define OPENMP_PARALLEL_CLAUSE(Name)
>> #endif
>> +#ifndef OPENMP_SIMD_CLAUSE
>> +# define OPENMP_SIMD_CLAUSE(Name)
>> +#endif
>> #ifndef OPENMP_DEFAULT_KIND
>> # define OPENMP_DEFAULT_KIND(Name)
>> #endif
>> @@ -29,6 +32,7 @@
>> OPENMP_DIRECTIVE(threadprivate)
>> OPENMP_DIRECTIVE(parallel)
>> OPENMP_DIRECTIVE(task)
>> +OPENMP_DIRECTIVE(simd)
>>
>> // OpenMP clauses.
>> OPENMP_CLAUSE(if, OMPIfClause)
>> @@ -44,6 +48,8 @@ OPENMP_PARALLEL_CLAUSE(private)
>> OPENMP_PARALLEL_CLAUSE(firstprivate)
>> OPENMP_PARALLEL_CLAUSE(shared)
>>
>> +// FIXME: clauses allowed for directive 'omp simd'.
>> +
>> // Static attributes for 'default' clause.
>> OPENMP_DEFAULT_KIND(none)
>> OPENMP_DEFAULT_KIND(shared)
>> @@ -52,3 +58,5 @@ OPENMP_DEFAULT_KIND(shared)
>> #undef OPENMP_DIRECTIVE
>> #undef OPENMP_CLAUSE
>> #undef OPENMP_PARALLEL_CLAUSE
>> +#undef OPENMP_SIMD_CLAUSE
>> +
>>
>> Modified: cfe/trunk/include/clang/Basic/StmtNodes.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/StmtNodes.td (original)
>> +++ cfe/trunk/include/clang/Basic/StmtNodes.td Thu Feb 27 02:29:12 2014
>> @@ -178,3 +178,4 @@ def AsTypeExpr : DStmt<Expr>;
>> // OpenMP Directives.
>> def OMPExecutableDirective : Stmt<1>;
>> def OMPParallelDirective : DStmt<OMPExecutableDirective>;
>> +def OMPSimdDirective : 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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Sema/Sema.h (original)
>> +++ cfe/trunk/include/clang/Sema/Sema.h Thu Feb 27 02:29:12 2014
>> @@ -7111,6 +7111,12 @@ public:
>> Stmt *AStmt,
>> SourceLocation StartLoc,
>> SourceLocation EndLoc);
>> + /// \brief Called on well-formed '\#pragma omp simd' after parsing
>> + /// of the associated statement.
>> + StmtResult ActOnOpenMPSimdDirective(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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
>> +++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Thu Feb 27 02:29:12 2014
>> @@ -1333,6 +1333,7 @@ namespace clang {
>>
>> // OpenMP drectives
>> STMT_OMP_PARALLEL_DIRECTIVE,
>> + STMT_OMP_SIMD_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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/Stmt.cpp (original)
>> +++ cfe/trunk/lib/AST/Stmt.cpp Thu Feb 27 02:29:12 2014
>> @@ -1217,10 +1217,39 @@ OMPParallelDirective *OMPParallelDirecti
>> }
>>
>> OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
>> - unsigned N,
>> + unsigned NumClauses,
>> EmptyShell) {
>> unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelDirective),
>> llvm::alignOf<OMPClause *>());
>> - void *Mem = C.Allocate(Size + sizeof(OMPClause *) * N + sizeof(Stmt *));
>> - return new (Mem) OMPParallelDirective(N);
>> + void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
>> + sizeof(Stmt *));
>> + return new (Mem) OMPParallelDirective(NumClauses);
>> }
>> +
>> +OMPSimdDirective *OMPSimdDirective::Create(const ASTContext &C,
>> + SourceLocation StartLoc,
>> + SourceLocation EndLoc,
>> + ArrayRef<OMPClause *> Clauses,
>> + Stmt *AssociatedStmt) {
>> + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSimdDirective),
>> + llvm::alignOf<OMPClause *>());
>> + void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
>> + sizeof(Stmt *));
>> + OMPSimdDirective *Dir = new (Mem) OMPSimdDirective(StartLoc, EndLoc,
>> + 1, Clauses.size());
>> + Dir->setClauses(Clauses);
>> + Dir->setAssociatedStmt(AssociatedStmt);
>> + return Dir;
>> +}
>> +
>> +OMPSimdDirective *OMPSimdDirective::CreateEmpty(const ASTContext &C,
>> + unsigned NumClauses,
>> + unsigned CollapsedNum,
>> + EmptyShell) {
>> + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPSimdDirective),
>> + llvm::alignOf<OMPClause *>());
>> + void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
>> + sizeof(Stmt *));
>> + return new (Mem) OMPSimdDirective(CollapsedNum, NumClauses);
>> +}
>> +
>>
>> Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
>> +++ cfe/trunk/lib/AST/StmtPrinter.cpp Thu Feb 27 02:29:12 2014
>> @@ -70,6 +70,7 @@ namespace {
>> void PrintCallArgs(CallExpr *E);
>> void PrintRawSEHExceptHandler(SEHExceptStmt *S);
>> void PrintRawSEHFinallyStmt(SEHFinallyStmt *S);
>> + void PrintOMPExecutableDirective(OMPExecutableDirective *S);
>>
>> void PrintExpr(Expr *E) {
>> if (E)
>> @@ -89,7 +90,7 @@ namespace {
>> return;
>> else StmtVisitor<StmtPrinter>::Visit(S);
>> }
>> -
>> +
>> void VisitStmt(Stmt *Node) LLVM_ATTRIBUTE_UNUSED {
>> Indent() << "<<unknown stmt type>>\n";
>> }
>> @@ -656,11 +657,9 @@ void OMPClausePrinter::VisitOMPSharedCla
>> // OpenMP directives printing methods
>> //===----------------------------------------------------------------------===//
>>
>> -void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
>> - Indent() << "#pragma omp parallel ";
>> -
>> +void StmtPrinter::PrintOMPExecutableDirective(OMPExecutableDirective *S) {
>> OMPClausePrinter Printer(OS, Policy);
>> - ArrayRef<OMPClause *> Clauses = Node->clauses();
>> + ArrayRef<OMPClause *> Clauses = S->clauses();
>> for (ArrayRef<OMPClause *>::iterator I = Clauses.begin(), E = Clauses.end();
>> I != E; ++I)
>> if (*I && !(*I)->isImplicit()) {
>> @@ -668,13 +667,24 @@ void StmtPrinter::VisitOMPParallelDirect
>> OS << ' ';
>> }
>> OS << "\n";
>> - if (Node->getAssociatedStmt()) {
>> - assert(isa<CapturedStmt>(Node->getAssociatedStmt()) &&
>> + if (S->getAssociatedStmt()) {
>> + assert(isa<CapturedStmt>(S->getAssociatedStmt()) &&
>> "Expected captured statement!");
>> - Stmt *CS = cast<CapturedStmt>(Node->getAssociatedStmt())->getCapturedStmt();
>> + Stmt *CS = cast<CapturedStmt>(S->getAssociatedStmt())->getCapturedStmt();
>> PrintStmt(CS);
>> }
>> }
>> +
>> +void StmtPrinter::VisitOMPParallelDirective(OMPParallelDirective *Node) {
>> + Indent() << "#pragma omp parallel ";
>> + PrintOMPExecutableDirective(Node);
>> +}
>> +
>> +void StmtPrinter::VisitOMPSimdDirective(OMPSimdDirective *Node) {
>> + Indent() << "#pragma omp simd ";
>> + 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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/AST/StmtProfile.cpp (original)
>> +++ cfe/trunk/lib/AST/StmtProfile.cpp Thu Feb 27 02:29:12 2014
>> @@ -293,7 +293,7 @@ void OMPClauseProfiler::VisitOMPSharedCl
>> }
>>
>> void
>> -StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
>> +StmtProfiler::VisitOMPExecutableDirective(const OMPExecutableDirective *S) {
>> VisitStmt(S);
>> OMPClauseProfiler P(this);
>> ArrayRef<OMPClause *> Clauses = S->clauses();
>> @@ -303,6 +303,14 @@ StmtProfiler::VisitOMPParallelDirective(
>> P.Visit(*I);
>> }
>>
>> +void StmtProfiler::VisitOMPParallelDirective(const OMPParallelDirective *S) {
>> + VisitOMPExecutableDirective(S);
>> +}
>> +
>> +void StmtProfiler::VisitOMPSimdDirective(const OMPSimdDirective *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=202360&r1=202359&r2=202360&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)
>> +++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Thu Feb 27 02:29:12 2014
>> @@ -125,6 +125,15 @@ bool clang::isAllowedClauseForDirective(
>> break;
>> }
>> break;
>> + case OMPD_simd:
>> + switch (CKind) {
>> +#define OPENMP_SIMD_CLAUSE(Name) \
>> + case OMPC_##Name: return true;
>> +#include "clang/Basic/OpenMPKinds.def"
>> + default:
>> + break;
> This is causing a warning for me in MSVC:
>
> Warning 1 warning C4065: switch statement contains 'default' but no
> 'case' labels E:\llvm\llvm\tools\clang\lib\Basic\OpenMPKinds.cpp 135
>
> Will this switch statement gain content in the near future, or is this
> something we can remove for the time being?
>
> ~Aaron
More information about the cfe-commits
mailing list