]> git.eshelyaron.com Git - emacs.git/commit
CC Mode: On removal of "typedef", remove pertinent types from c-found-types
authorAlan Mackenzie <acm@muc.de>
Tue, 17 Jan 2023 18:15:45 +0000 (18:15 +0000)
committerAlan Mackenzie <acm@muc.de>
Tue, 17 Jan 2023 18:15:45 +0000 (18:15 +0000)
commitdbac923b9df97706d3944c21edfc9117b408d80c
tree3d9d2651c6df46374078d96613b051febad4871f
parent56d69c2fc4782dc23bd79ddcbccfbae9b263ecac
CC Mode: On removal of "typedef", remove pertinent types from c-found-types

For this purpose, record the type names declared by typedef in a text
property, c-typedef, on the typedef.  On any change to that "typedef" or a
type, remove the old identifier(s) from c-found-types.

This should fix bug #59671.

* lisp/progmodes/cc-defs.el (c-search-forward-non-nil-char-property): New
macro.

* lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): Move the scope of
identifier-start from the "inner" let form to the outer one.  Amend the
return value such that the middle element of the second element is now the
position of the "typedef", not merely non-nil.

* lisp/progmodes/cc-fonts.el (c-font-lock-declarators): Disregard the LIMIT
parameter when fontifying the declarators of a typedef construct.  Also in
this case, set the c-typedef text property on the "typedef" to the list of
declared types.  Amend this list when these declared types change.
(c-font-lock-single-decl): Massage the `types' argument given to
c-font-lock-declarators.
(c-font-lock-cut-off-declarators): Amend to work when the starting point of
the fontification is inside a brace block.

* lisp/progmodes/cc-mode.el (c-before-change-de-typedef)
(c-after-change-de-typedef): New functions.
(c-update-new-id): Replace the erroneous c-end-of-current-token with a clause
containing c-forward-token-2.
(c-before-change): Call c-before-change-de-typedef.
(c-after-change): Call c-after-change-de-typedef.
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-mode.el