This is an archive of the discontinued LLVM Phabricator instance.

Lit C++11 Compatibility - Parse OpenMP
ClosedPublic

Authored by tigerleapgorge on Feb 8 2017, 11:40 AM.

Details

Summary

I am continuing to make out Lit tests C++11 compatible.
There are two tests in this patch.
Both tests verify parse errors with ill formed OpenMP expressions.

test/OpenMP/declare_reduction_messages.cpp

In C++11, an opening square bracket is the start of a lambda capture.
Therefore, a unmatched opening square bracket will cause the following diagnostics change.
  C++98: error: expected '(' after 'initializer'
         error: expected expression
         warning: extra tokens at the end of '#pragma omp declare reduction' are ignored [-Wextra-tokens]
  C++11: error: expected '(' after 'initializer'
         error: expected variable name or 'this' in lambda capture list
         error: expected ')'
         note: to match this '('

test/OpenMP/openmp_check.cpp

This test is created in response to bug 25221, where C++11 code running under C++98 causes the parser to go into an infinite loop.
Since this is C++11 code, all expected diagnostics will go away when compiling at C++11.
Therefore, guard all of the following diagnostics under C++98.
  C++98: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
         error: expected expression
         error: expected ';' at end of declaration
  C++98: error: C++ requires a type specifier for all declarations
  C++98: error: expected unqualified-id
  C++98: error: extraneous closing brace ('}')

Diff Detail

Repository
rL LLVM

Event Timeline

tigerleapgorge created this revision.Feb 8 2017, 11:40 AM
This revision is now accepted and ready to land.Feb 8 2017, 11:45 AM
This revision was automatically updated to reflect the committed changes.