forked from OSchip/llvm-project
[OPENMP] Fix for http://llvm.org/PR25221: Infinite loop while parsing OpenMP directive
Clang skipped annot_pragma_openmp token, while it should be considered as a stop token while skipping tokens. llvm-svn: 250684
This commit is contained in:
parent
d0a7d6e4ee
commit
1d97d2a3d2
|
@ -282,6 +282,7 @@ bool Parser::SkipUntil(ArrayRef<tok::TokenKind> Toks, SkipUntilFlags Flags) {
|
|||
// Ran out of tokens.
|
||||
return false;
|
||||
|
||||
case tok::annot_pragma_openmp:
|
||||
case tok::annot_pragma_openmp_end:
|
||||
// Stop before an OpenMP pragma boundary.
|
||||
case tok::annot_module_begin:
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
|
||||
int nested(int a) {
|
||||
#pragma omp parallel
|
||||
++a;
|
||||
|
||||
auto F = [&]() { // expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}} expected-warning {{'auto' type specifier is a C++11 extension}}
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp target
|
||||
++a;
|
||||
}
|
||||
};
|
||||
F(); // expected-error {{C++ requires a type specifier for all declarations}}
|
||||
return a; // expected-error {{expected unqualified-id}}
|
||||
}// expected-error {{extraneous closing brace ('}')}}
|
Loading…
Reference in New Issue