danix800 created this revision. danix800 added a project: clang. Herald added a project: All. danix800 requested review of this revision. Herald added a subscriber: cfe-commits.
Fixes https://github.com/llvm/llvm-project/issues/64065 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D156277 Files: clang/lib/Parse/ParseObjc.cpp clang/test/Parser/gh64065-nocrash.m Index: clang/test/Parser/gh64065-nocrash.m =================================================================== --- /dev/null +++ clang/test/Parser/gh64065-nocrash.m @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// expected-error@+4 {{missing '@end'}} +// expected-note@+3 {{class started here}} +// expected-error@+2 {{missing '@end'}} +// expected-note@+1 {{class started here}} +@interface Roo@interface Index: clang/lib/Parse/ParseObjc.cpp =================================================================== --- clang/lib/Parse/ParseObjc.cpp +++ clang/lib/Parse/ParseObjc.cpp @@ -745,7 +745,8 @@ << FixItHint::CreateInsertion(AtLoc, "@end\n"); Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) << (int)Actions.getObjCContainerKind(); - ConsumeToken(); + if (!Tok.is(tok::eof)) + ConsumeToken(); break; case tok::objc_required:
Index: clang/test/Parser/gh64065-nocrash.m =================================================================== --- /dev/null +++ clang/test/Parser/gh64065-nocrash.m @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// expected-error@+4 {{missing '@end'}} +// expected-note@+3 {{class started here}} +// expected-error@+2 {{missing '@end'}} +// expected-note@+1 {{class started here}} +@interface Roo@interface Index: clang/lib/Parse/ParseObjc.cpp =================================================================== --- clang/lib/Parse/ParseObjc.cpp +++ clang/lib/Parse/ParseObjc.cpp @@ -745,7 +745,8 @@ << FixItHint::CreateInsertion(AtLoc, "@end\n"); Diag(CDecl->getBeginLoc(), diag::note_objc_container_start) << (int)Actions.getObjCContainerKind(); - ConsumeToken(); + if (!Tok.is(tok::eof)) + ConsumeToken(); break; case tok::objc_required:
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits