shafik updated this revision to Diff 556590. shafik added a comment. - Add release note
CHANGES SINCE LAST ACTION https://reviews.llvm.org/D158804/new/ https://reviews.llvm.org/D158804 Files: clang/docs/ReleaseNotes.rst clang/lib/Parse/ParseDecl.cpp clang/test/Parser/gh64836.cpp Index: clang/test/Parser/gh64836.cpp =================================================================== --- /dev/null +++ clang/test/Parser/gh64836.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -xobjective-c++-header %s + +template <typename, typename> +class C {}; + +class B { + p // expected-error {{unknown type name 'p'}} + private: // expected-error {{'private' is a keyword in Objective-C++}} + void f() {} // expected-error {{expected '(' for function-style cast or type construction}} + C<int, decltype(f)> c; // expected-error {{use of undeclared identifier 'f'}} + // expected-error@-1 {{expected member name}} +}; Index: clang/lib/Parse/ParseDecl.cpp =================================================================== --- clang/lib/Parse/ParseDecl.cpp +++ clang/lib/Parse/ParseDecl.cpp @@ -6667,7 +6667,7 @@ // Objective-C++: Detect C++ keywords and try to prevent further errors by // treating these keyword as valid member names. if (getLangOpts().ObjC && getLangOpts().CPlusPlus && - Tok.getIdentifierInfo() && + !Tok.isAnnotation() && Tok.getIdentifierInfo() && Tok.getIdentifierInfo()->isCPlusPlusKeyword(getLangOpts())) { Diag(getMissingDeclaratorIdLoc(D, Tok.getLocation()), diag::err_expected_member_name_or_semi_objcxx_keyword) Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -218,6 +218,8 @@ (`#65156 <https://github.com/llvm/llvm-project/issues/65156>`_) - Clang no longer considers the loss of ``__unaligned`` qualifier from objects as an invalid conversion during method function overload resolution. +- Fix parser crash when dealing with ill-formed objective C++ header code. Fixes + (`#64836 <https://github.com/llvm/llvm-project/issues/64836>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/Parser/gh64836.cpp =================================================================== --- /dev/null +++ clang/test/Parser/gh64836.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -xobjective-c++-header %s + +template <typename, typename> +class C {}; + +class B { + p // expected-error {{unknown type name 'p'}} + private: // expected-error {{'private' is a keyword in Objective-C++}} + void f() {} // expected-error {{expected '(' for function-style cast or type construction}} + C<int, decltype(f)> c; // expected-error {{use of undeclared identifier 'f'}} + // expected-error@-1 {{expected member name}} +}; Index: clang/lib/Parse/ParseDecl.cpp =================================================================== --- clang/lib/Parse/ParseDecl.cpp +++ clang/lib/Parse/ParseDecl.cpp @@ -6667,7 +6667,7 @@ // Objective-C++: Detect C++ keywords and try to prevent further errors by // treating these keyword as valid member names. if (getLangOpts().ObjC && getLangOpts().CPlusPlus && - Tok.getIdentifierInfo() && + !Tok.isAnnotation() && Tok.getIdentifierInfo() && Tok.getIdentifierInfo()->isCPlusPlusKeyword(getLangOpts())) { Diag(getMissingDeclaratorIdLoc(D, Tok.getLocation()), diag::err_expected_member_name_or_semi_objcxx_keyword) Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -218,6 +218,8 @@ (`#65156 <https://github.com/llvm/llvm-project/issues/65156>`_) - Clang no longer considers the loss of ``__unaligned`` qualifier from objects as an invalid conversion during method function overload resolution. +- Fix parser crash when dealing with ill-formed objective C++ header code. Fixes + (`#64836 <https://github.com/llvm/llvm-project/issues/64836>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits