(defun autogc-inheritance--get-superclass-list ()
(beginning-of-line)
(let (answer)
(if (re-search-forward ":"
(point-at-eol)
t)
(progn
(skip-chars-forward " ")
(cond
((looking-at "public")
(autogc-cycler--skip-literal "public")
(skip-chars-forward " "))
((looking-at "private")
(autogc-cycler--skip-literal "private"))
((looking-at "protected")
(autogc-cycler--skip-literal "protected"))
)
(setq answer (autogc-cycler--gulp-identifier))
(beginning-of-line)
(forward-line 1)
answer)
(beginning-of-line)
(forward-line 1)
nil)))
(defun autogc-inheritance--get-class-superclasses (file-list)
(let ((ptr file-list)
(answer nil)
(class-name nil)
(superclass-list nil))
(while ptr
(let ((auto-mode-alist (cons '("" . c++-no-fonts-mode) auto-mode-alist)))
(find-file-read-only (car ptr)))
(goto-char (point-min))
(while (re-search-forward "^class " nil t)
(setq class-name (autogc-cycler--gulp-identifier))
(setq superclass-list (autogc-inheritance--get-superclass-list))
(if superclass-list
(setq answer (cons (list class-name superclass-list) answer))))
(kill-buffer nil)
(setq ptr (cdr ptr)))
(reverse answer)))
(defun autogc-inheritance--get-subclasses (superclasses-list)
(let ((ptr superclasses-list)
(answer nil))
(while ptr
(let ((ptr2 (cdar ptr))
(a nil))
(while ptr2
(setq a (assoc (car ptr2) answer))
(if a
(progn
(setcdr (last a) (cons (caar ptr) nil)))
(setq answer (cons (list (car ptr2) (caar ptr)) answer)))
(setq ptr2 (cdr ptr2))))
(setq ptr (cdr ptr)))
(reverse answer)))
(defun autogc-inheritance--get-all-subclasses (fixed-subclass-list)
(let* ((answer-list (copy-tree fixed-subclass-list))
(ptr answer-list))
(while ptr
(let ((ptr-2 (cdar ptr))
(superclass (caar ptr)))
(while ptr-2
(let* ((cur (car ptr-2))
(a (assoc cur answer-list)))
(when a
(let ((ptr-3 (cdr a)))
(while ptr-3
(when (not (eq 0 (count
(car ptr-3)
(cdr (assoc superclass answer-list))
:test 'equal)))
(debug)
(autogc--error "*** Error: inheritance cycle detected")
)
(setcdr (last (assoc superclass answer-list)) (cons (car ptr-3) nil))
(setq ptr-3 (cdr ptr-3))))))
(setq ptr-2 (cdr ptr-2))))
(setq ptr (cdr ptr)))
answer-list))
(defun autogc-inheritance--do-all (file-list)
(let (sup-list-1 sup-list-2 subs-list)
(setq sup-list-1 (autogc-inheritance--get-class-superclasses file-list))
(setq sub-list-2 (autogc-inheritance--get-subclasses sup-list-1))
(setq subs-list (autogc-inheritance--get-all-subclasses sub-list-2))
subs-list))
(provide 'autogc-inheritance)