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 Jun 12, 2022
1 parent 0b3ef3f commit da5b6ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,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 clang/lib/Parse/ParsePragma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3518,6 +3518,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 da5b6ea

Please sign in to comment.