Skip to content

Commit

Permalink
[Pragma] Add backwards compatibility for 'cilk grainsize = ...' synta…
Browse files Browse the repository at this point in the history
…x. Thanks to @skuntz for the essential code for this patch.  This commit partially addresses wsmoses/Tapir-LLVM#90.
  • Loading branch information
neboat committed Oct 22, 2019
1 parent 581ce50 commit 1be7d6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,9 @@ def err_pragma_cilk_grainsize_missing_argument : Error<
def warn_cilk_for_following_grainsize: Warning<
"'#pragma cilk' ignored, because it is not followed by a '_Cilk_for' loop">,
InGroup<SourceUsesCilkPlus>;
def warn_pragma_cilk_grainsize_equals: Warning<
"'#pragma cilk grainsize' no longer requires '='">,
InGroup<SourceUsesCilkPlus>;

// OpenMP support.
def warn_pragma_omp_ignored : Warning<
Expand Down
7 changes: 7 additions & 0 deletions lib/Parse/ParsePragma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2876,6 +2876,13 @@ void PragmaCilkHintHandler::HandlePragma(Preprocessor &PP,
}
PP.Lex(Tok);

// Handle = for backwards compatibility
bool GrainsizeEq = Tok.is(tok::equal);
if (GrainsizeEq) {
PP.Diag(Tok.getLocation(), diag::warn_pragma_cilk_grainsize_equals);
PP.Lex(Tok);
}

// Read '(' if it exists.
bool ValueInParens = Tok.is(tok::l_paren);
if (ValueInParens)
Expand Down

0 comments on commit 1be7d6c

Please sign in to comment.