mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-15 23:40:54 +00:00
[OPENMP] Fix for http://llvm.org/PR24430: clang hangs on invalid input with openmp directive
Add parsing of openmp directives inside structs/unions in C mode. llvm-svn: 244719
This commit is contained in:
parent
9b6a90a0fc
commit
4652e4baaf
@ -3615,6 +3615,14 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Tok.is(tok::annot_pragma_openmp)) {
|
||||
// Result can be ignored, because it must be always empty.
|
||||
auto Res = ParseOpenMPDeclarativeDirective();
|
||||
assert(!Res);
|
||||
// Silence possible warnings.
|
||||
(void)Res;
|
||||
continue;
|
||||
}
|
||||
if (!Tok.is(tok::at)) {
|
||||
auto CFieldCallback = [&](ParsingFieldDeclarator &FD) {
|
||||
// Install the declarator into the current TagDecl.
|
||||
|
@ -7,3 +7,8 @@ void foo() {
|
||||
#pragma omp // expected-error {{expected an OpenMP directive}}
|
||||
#pragma omp unknown_directive // expected-error {{expected an OpenMP directive}}
|
||||
}
|
||||
|
||||
typedef struct S {
|
||||
#pragma omp parallel for private(j) schedule(static) if (tree1->totleaf > 1024) // expected-error {{unexpected OpenMP directive '#pragma omp parallel for'}}
|
||||
} St;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user