diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2015-04-30 04:23:23 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-04-30 04:23:23 +0000 |
| commit | 9c821037434dc106543d6905f5519b1129eb904f (patch) | |
| tree | 606d74503746bf46ee86c1491b27b1cc190dfb05 /clang/lib/Parse | |
| parent | f8a16a952dddaf1d38d6f596b78b1041ce5ea2eb (diff) | |
| download | bcm5719-llvm-9c821037434dc106543d6905f5519b1129eb904f.tar.gz bcm5719-llvm-9c821037434dc106543d6905f5519b1129eb904f.zip | |
[OPENMP] Allow to use global variables as lcv in loop-based directives.
For proper codegen we need to capture variable in the OpenMP region. In loop-based directives loop control variables are private by default and they must be captured in this region. There was a problem with capturing of globals, used as lcv, as they was not marked as private by default.
Differential Revision: http://reviews.llvm.org/D9336
llvm-svn: 236201
Diffstat (limited to 'clang/lib/Parse')
| -rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index c31216d0ae2..055bdeabf62 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -1689,6 +1689,12 @@ StmtResult Parser::ParseForStatement(SourceLocation *TrailingElseLoc) { FirstPart.get(), Collection.get(), T.getCloseLocation()); + } else { + // In OpenMP loop region loop control variable must be captured and be + // private. Perform analysis of first part (if any). + if (getLangOpts().OpenMP && FirstPart.isUsable()) { + Actions.ActOnOpenMPLoopInitialization(ForLoc, FirstPart.get()); + } } // C99 6.8.5p5 - In C99, the body of the for statement is a scope, even if |

