diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-08-12 07:10:54 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-08-12 07:10:54 +0000 |
commit | 4652e4baafb6b544fa5d6820f155700a312ef44f (patch) | |
tree | fe133c52ee3a0ac3b4f6758eabffef97eba64744 /clang/lib/Parse/ParseDecl.cpp | |
parent | 9b6a90a0fc946790f7bde1870cacb7e1cac82d38 (diff) | |
download | bcm5719-llvm-4652e4baafb6b544fa5d6820f155700a312ef44f.tar.gz bcm5719-llvm-4652e4baafb6b544fa5d6820f155700a312ef44f.zip |
[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
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 40687d8f27b..debbd50d668 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -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. |