diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-02-16 11:18:12 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-02-16 11:18:12 +0000 |
commit | 3392d760816d869c9589c81275c7c98ecefc226d (patch) | |
tree | 24f9d08060c382bdd33d45b1fb34d2ac56c0ef7c /clang/lib/AST/StmtProfile.cpp | |
parent | 6b4c0b5b663841f3c6702e5c1999b599bf1687ca (diff) | |
download | bcm5719-llvm-3392d760816d869c9589c81275c7c98ecefc226d.tar.gz bcm5719-llvm-3392d760816d869c9589c81275c7c98ecefc226d.zip |
[OPENMP] Improved handling of pseudo-captured expressions in OpenMP.
Expressions inside 'schedule'|'dist_schedule' clause must be captured in
combined directives to avoid possible crash during codegen. Patch
improves handling of such constructs
llvm-svn: 260954
Diffstat (limited to 'clang/lib/AST/StmtProfile.cpp')
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index d2f241c312a..02b59756e3d 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -268,8 +268,15 @@ public: #define OPENMP_CLAUSE(Name, Class) \ void Visit##Class(const Class *C); #include "clang/Basic/OpenMPKinds.def" + void VistOMPClauseWithPreInit(const OMPClauseWithPreInit *C); }; +void OMPClauseProfiler::VistOMPClauseWithPreInit( + const OMPClauseWithPreInit *C) { + if (auto *S = C->getPreInitStmt()) + Profiler->VisitStmt(S); +} + void OMPClauseProfiler::VisitOMPIfClause(const OMPIfClause *C) { if (C->getCondition()) Profiler->VisitStmt(C->getCondition()); @@ -305,12 +312,9 @@ void OMPClauseProfiler::VisitOMPDefaultClause(const OMPDefaultClause *C) { } void OMPClauseProfiler::VisitOMPProcBindClause(const OMPProcBindClause *C) { } void OMPClauseProfiler::VisitOMPScheduleClause(const OMPScheduleClause *C) { - if (C->getChunkSize()) { - Profiler->VisitStmt(C->getChunkSize()); - if (C->getHelperChunkSize()) { - Profiler->VisitStmt(C->getChunkSize()); - } - } + VistOMPClauseWithPreInit(C); + if (auto *S = C->getChunkSize()) + Profiler->VisitStmt(S); } void OMPClauseProfiler::VisitOMPOrderedClause(const OMPOrderedClause *C) { @@ -633,12 +637,9 @@ void StmtProfiler::VisitOMPDistributeDirective( void OMPClauseProfiler::VisitOMPDistScheduleClause( const OMPDistScheduleClause *C) { - if (C->getChunkSize()) { - Profiler->VisitStmt(C->getChunkSize()); - if (C->getHelperChunkSize()) { - Profiler->VisitStmt(C->getChunkSize()); - } - } + VistOMPClauseWithPreInit(C); + if (auto *S = C->getChunkSize()) + Profiler->VisitStmt(S); } void OMPClauseProfiler::VisitOMPDefaultmapClause(const OMPDefaultmapClause *) {} |