diff options
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index e880bd39321..59dc96af030 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6089,7 +6089,8 @@ comment at the start of cc-engine.el for more info." | |||
| 6089 | 6089 | ||
| 6090 | (defsubst c-clear-found-types () | 6090 | (defsubst c-clear-found-types () |
| 6091 | ;; Clears `c-found-types'. | 6091 | ;; Clears `c-found-types'. |
| 6092 | (setq c-found-types (make-vector 53 0))) | 6092 | (setq c-found-types |
| 6093 | (make-hash-table :test #'equal :weakness nil))) | ||
| 6093 | 6094 | ||
| 6094 | (defun c-add-type (from to) | 6095 | (defun c-add-type (from to) |
| 6095 | ;; Add the given region as a type in `c-found-types'. If the region | 6096 | ;; Add the given region as a type in `c-found-types'. If the region |
| @@ -6103,29 +6104,27 @@ comment at the start of cc-engine.el for more info." | |||
| 6103 | ;; | 6104 | ;; |
| 6104 | ;; This function might do hidden buffer changes. | 6105 | ;; This function might do hidden buffer changes. |
| 6105 | (let ((type (c-syntactic-content from to c-recognize-<>-arglists))) | 6106 | (let ((type (c-syntactic-content from to c-recognize-<>-arglists))) |
| 6106 | (unless (intern-soft type c-found-types) | 6107 | (unless (gethash type c-found-types) |
| 6107 | (unintern (substring type 0 -1) c-found-types) | 6108 | (remhash (substring type 0 -1) c-found-types) |
| 6108 | (intern type c-found-types)))) | 6109 | (puthash type t c-found-types)))) |
| 6109 | 6110 | ||
| 6110 | (defun c-unfind-type (name) | 6111 | (defun c-unfind-type (name) |
| 6111 | ;; Remove the "NAME" from c-found-types, if present. | 6112 | ;; Remove the "NAME" from c-found-types, if present. |
| 6112 | (unintern name c-found-types)) | 6113 | (remhash name c-found-types)) |
| 6113 | 6114 | ||
| 6114 | (defsubst c-check-type (from to) | 6115 | (defsubst c-check-type (from to) |
| 6115 | ;; Return non-nil if the given region contains a type in | 6116 | ;; Return non-nil if the given region contains a type in |
| 6116 | ;; `c-found-types'. | 6117 | ;; `c-found-types'. |
| 6117 | ;; | 6118 | ;; |
| 6118 | ;; This function might do hidden buffer changes. | 6119 | ;; This function might do hidden buffer changes. |
| 6119 | (intern-soft (c-syntactic-content from to c-recognize-<>-arglists) | 6120 | (gethash (c-syntactic-content from to c-recognize-<>-arglists) c-found-types)) |
| 6120 | c-found-types)) | ||
| 6121 | 6121 | ||
| 6122 | (defun c-list-found-types () | 6122 | (defun c-list-found-types () |
| 6123 | ;; Return all the types in `c-found-types' as a sorted list of | 6123 | ;; Return all the types in `c-found-types' as a sorted list of |
| 6124 | ;; strings. | 6124 | ;; strings. |
| 6125 | (let (type-list) | 6125 | (let (type-list) |
| 6126 | (mapatoms (lambda (type) | 6126 | (maphash (lambda (type _) |
| 6127 | (setq type-list (cons (symbol-name type) | 6127 | (setq type-list (cons type type-list))) |
| 6128 | type-list))) | ||
| 6129 | c-found-types) | 6128 | c-found-types) |
| 6130 | (sort type-list 'string-lessp))) | 6129 | (sort type-list 'string-lessp))) |
| 6131 | 6130 | ||
| @@ -7059,6 +7058,7 @@ comment at the start of cc-engine.el for more info." | |||
| 7059 | ;; This function might do hidden buffer changes. | 7058 | ;; This function might do hidden buffer changes. |
| 7060 | 7059 | ||
| 7061 | (let ((start (point)) | 7060 | (let ((start (point)) |
| 7061 | (old-found-types (copy-hash-table c-found-types)) | ||
| 7062 | ;; If `c-record-type-identifiers' is set then activate | 7062 | ;; If `c-record-type-identifiers' is set then activate |
| 7063 | ;; recording of any found types that constitute an argument in | 7063 | ;; recording of any found types that constitute an argument in |
| 7064 | ;; the arglist. | 7064 | ;; the arglist. |
| @@ -7074,6 +7074,7 @@ comment at the start of cc-engine.el for more info." | |||
| 7074 | (nconc c-record-found-types c-record-type-identifiers))) | 7074 | (nconc c-record-found-types c-record-type-identifiers))) |
| 7075 | t) | 7075 | t) |
| 7076 | 7076 | ||
| 7077 | (setq c-found-types old-found-types) | ||
| 7077 | (goto-char start) | 7078 | (goto-char start) |
| 7078 | nil))) | 7079 | nil))) |
| 7079 | 7080 | ||