Function: semantic-expand-c-complex-type
semantic-expand-c-complex-type is a byte-compiled function defined in
c.el.gz.
Signature
(semantic-expand-c-complex-type TAG)
Documentation
Check if TAG has a full :type with a name on its own.
If so, extract it, and replace it with a reference to that type.
Thus, struct A { int a; } B; will create 2 toplevel tags, one
is type A, and the other variable B where the :type of B is just
a type tag A that is a prototype, and the actual struct info of A
is its own toplevel tag. This function will return (cons A B).
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/bovine/c.el.gz
(defun semantic-expand-c-complex-type (tag)
"Check if TAG has a full :type with a name on its own.
If so, extract it, and replace it with a reference to that type.
Thus, `struct A { int a; } B;' will create 2 toplevel tags, one
is type A, and the other variable B where the :type of B is just
a type tag A that is a prototype, and the actual struct info of A
is its own toplevel tag. This function will return (cons A B)."
(let* ((basetype (semantic-tag-type tag))
(typeref nil)
(ret nil)
(tname (when (consp basetype)
(semantic-tag-name basetype))))
;; Make tname be a string.
(when (consp tname) (setq tname (car (car tname))))
;; Is the basetype a full type with a name of its own?
(when (and basetype (semantic-tag-p basetype)
(not (semantic-tag-prototype-p basetype))
tname
(not (string= tname "")))
;; a type tag referencing the type we are extracting.
(setq typeref (semantic-tag-new-type
(semantic-tag-name basetype)
(semantic-tag-type basetype)
nil nil
:prototype t))
;; Convert original tag to only have a reference.
(setq tag (semantic-tag-copy tag))
(semantic-tag-put-attribute tag :type typeref)
;; Convert basetype to have the location information.
(semantic--tag-copy-properties tag basetype)
(semantic--tag-set-overlay basetype
(semantic-tag-overlay tag))
;; Store the base tag as part of the return list.
(setq ret (cons basetype ret)))
(cons ret tag)))