summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseOpenMP.cpp
diff options
context:
space:
mode:
authorAlexander Musman <alexander.musman@gmail.com>2014-07-21 09:42:05 +0000
committerAlexander Musman <alexander.musman@gmail.com>2014-07-21 09:42:05 +0000
commitd9ed09f7a5f149ea3ed7904f83ed70bf12963842 (patch)
treeb4efe1d3d62612141434996c2c6d7db1fe730d27 /clang/lib/Parse/ParseOpenMP.cpp
parentddf36dea135db24d073acd8dbc1251dc798624bb (diff)
downloadbcm5719-llvm-d9ed09f7a5f149ea3ed7904f83ed70bf12963842.tar.gz
bcm5719-llvm-d9ed09f7a5f149ea3ed7904f83ed70bf12963842.zip
[OPENMP] Parsing/Sema of the OpenMP directive 'critical'.
llvm-svn: 213510
Diffstat (limited to 'clang/lib/Parse/ParseOpenMP.cpp')
-rw-r--r--clang/lib/Parse/ParseOpenMP.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index cf991784306..79cf6af6fd3 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -91,6 +91,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
case OMPD_section:
case OMPD_single:
case OMPD_master:
+ case OMPD_critical:
case OMPD_parallel_for:
case OMPD_parallel_sections:
Diag(Tok, diag::err_omp_unexpected_directive)
@@ -109,9 +110,9 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
///
/// executable-directive:
/// annot_pragma_openmp 'parallel' | 'simd' | 'for' | 'sections' |
-/// 'section' | 'single' | 'master' | 'parallel for' |
-/// 'parallel sections' | 'task' | 'taskyield' | 'barrier' | 'taskwait'
-/// {clause} annot_pragma_openmp_end
+/// 'section' | 'single' | 'master' | 'critical' [ '(' <name> ')' ] |
+/// 'parallel for' | 'parallel sections' | 'task' | 'taskyield' |
+/// 'barrier' | 'taskwait' {clause} annot_pragma_openmp_end
///
StmtResult
Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
@@ -162,10 +163,26 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
case OMPD_single:
case OMPD_section:
case OMPD_master:
+ case OMPD_critical:
case OMPD_parallel_for:
case OMPD_parallel_sections:
case OMPD_task: {
ConsumeToken();
+ // Parse directive name of the 'critical' directive if any.
+ if (DKind == OMPD_critical) {
+ BalancedDelimiterTracker T(*this, tok::l_paren,
+ tok::annot_pragma_openmp_end);
+ if (!T.consumeOpen()) {
+ if (Tok.isAnyIdentifier()) {
+ DirName =
+ DeclarationNameInfo(Tok.getIdentifierInfo(), Tok.getLocation());
+ ConsumeAnyToken();
+ } else {
+ Diag(Tok, diag::err_omp_expected_identifier_for_critical);
+ }
+ T.consumeClose();
+ }
+ }
if (isOpenMPLoopDirective(DKind))
ScopeFlags |= Scope::OpenMPLoopDirectiveScope;
@@ -215,7 +232,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
}
if (CreateDirective)
Directive = Actions.ActOnOpenMPExecutableDirective(
- DKind, Clauses, AssociatedStmt.get(), Loc, EndLoc);
+ DKind, DirName, Clauses, AssociatedStmt.get(), Loc, EndLoc);
// Exit scope.
Actions.EndOpenMPDSABlock(Directive.get());
OpenPOWER on IntegriCloud