diff options
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 22f5b906e4e..59dc96af030 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -6089,14 +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 | 6093 | (make-hash-table :test #'equal :weakness nil))) | |
| 6094 | (defun c-copy-found-types () | ||
| 6095 | (let ((copy (make-vector 53 0))) | ||
| 6096 | (mapatoms (lambda (sym) | ||
| 6097 | (intern (symbol-name sym) copy)) | ||
| 6098 | c-found-types) | ||
| 6099 | copy)) | ||
| 6100 | 6094 | ||
| 6101 | (defun c-add-type (from to) | 6095 | (defun c-add-type (from to) |
| 6102 | ;; 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 |
| @@ -6110,29 +6104,27 @@ comment at the start of cc-engine.el for more info." | |||
| 6110 | ;; | 6104 | ;; |
| 6111 | ;; This function might do hidden buffer changes. | 6105 | ;; This function might do hidden buffer changes. |
| 6112 | (let ((type (c-syntactic-content from to c-recognize-<>-arglists))) | 6106 | (let ((type (c-syntactic-content from to c-recognize-<>-arglists))) |
| 6113 | (unless (intern-soft type c-found-types) | 6107 | (unless (gethash type c-found-types) |
| 6114 | (unintern (substring type 0 -1) c-found-types) | 6108 | (remhash (substring type 0 -1) c-found-types) |
| 6115 | (intern type c-found-types)))) | 6109 | (puthash type t c-found-types)))) |
| 6116 | 6110 | ||
| 6117 | (defun c-unfind-type (name) | 6111 | (defun c-unfind-type (name) |
| 6118 | ;; Remove the "NAME" from c-found-types, if present. | 6112 | ;; Remove the "NAME" from c-found-types, if present. |
| 6119 | (unintern name c-found-types)) | 6113 | (remhash name c-found-types)) |
| 6120 | 6114 | ||
| 6121 | (defsubst c-check-type (from to) | 6115 | (defsubst c-check-type (from to) |
| 6122 | ;; Return non-nil if the given region contains a type in | 6116 | ;; Return non-nil if the given region contains a type in |
| 6123 | ;; `c-found-types'. | 6117 | ;; `c-found-types'. |
| 6124 | ;; | 6118 | ;; |
| 6125 | ;; This function might do hidden buffer changes. | 6119 | ;; This function might do hidden buffer changes. |
| 6126 | (intern-soft (c-syntactic-content from to c-recognize-<>-arglists) | 6120 | (gethash (c-syntactic-content from to c-recognize-<>-arglists) c-found-types)) |
| 6127 | c-found-types)) | ||
| 6128 | 6121 | ||
| 6129 | (defun c-list-found-types () | 6122 | (defun c-list-found-types () |
| 6130 | ;; 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 |
| 6131 | ;; strings. | 6124 | ;; strings. |
| 6132 | (let (type-list) | 6125 | (let (type-list) |
| 6133 | (mapatoms (lambda (type) | 6126 | (maphash (lambda (type _) |
| 6134 | (setq type-list (cons (symbol-name type) | 6127 | (setq type-list (cons type type-list))) |
| 6135 | type-list))) | ||
| 6136 | c-found-types) | 6128 | c-found-types) |
| 6137 | (sort type-list 'string-lessp))) | 6129 | (sort type-list 'string-lessp))) |
| 6138 | 6130 | ||
| @@ -7066,7 +7058,7 @@ comment at the start of cc-engine.el for more info." | |||
| 7066 | ;; This function might do hidden buffer changes. | 7058 | ;; This function might do hidden buffer changes. |
| 7067 | 7059 | ||
| 7068 | (let ((start (point)) | 7060 | (let ((start (point)) |
| 7069 | (old-found-types (c-copy-found-types)) | 7061 | (old-found-types (copy-hash-table c-found-types)) |
| 7070 | ;; If `c-record-type-identifiers' is set then activate | 7062 | ;; If `c-record-type-identifiers' is set then activate |
| 7071 | ;; recording of any found types that constitute an argument in | 7063 | ;; recording of any found types that constitute an argument in |
| 7072 | ;; the arglist. | 7064 | ;; the arglist. |