Function: semantic-analyze-type
semantic-analyze-type is a byte-compiled function defined in
fcn.el.gz.
Signature
(semantic-analyze-type TYPE-DECLARATION &optional SCOPE NOMETADEREF)
Documentation
Return the semantic tag for TYPE-DECLARATION.
TAG can be a variable, function or other type of tag. The type of tag (such as a class or struct) is a name. Lookup this name in database, and return all slots/fields within that types field. Also handles anonymous types. Optional SCOPE represents a calculated scope in which the types might be found. This can be nil. If NOMETADEREF, then do not dereference metatypes. This is used by the analyzer debugger.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/analyze/fcn.el.gz
(defun semantic-analyze-type (type-declaration &optional scope nometaderef)
"Return the semantic tag for TYPE-DECLARATION.
TAG can be a variable, function or other type of tag.
The type of tag (such as a class or struct) is a name.
Lookup this name in database, and return all slots/fields
within that types field. Also handles anonymous types.
Optional SCOPE represents a calculated scope in which the
types might be found. This can be nil.
If NOMETADEREF, then do not dereference metatypes. This is
used by the analyzer debugger."
(require 'semantic/scope)
(let ((name nil)
(typetag nil)
)
;; Is it an anonymous type?
(if (and type-declaration
(semantic-tag-p type-declaration)
(semantic-tag-of-class-p type-declaration 'type)
(not (semantic-tag-prototype-p type-declaration))
)
;; We have an anonymous type for TAG with children.
;; Use this type directly.
(if nometaderef
type-declaration
(semantic-analyze-dereference-metatype-stack
type-declaration scope type-declaration))
;; Not an anonymous type. Look up the name of this type
;; elsewhere, and report back.
(setq name (semantic-analyze-type-to-name type-declaration))
(if (and name (not (string= name "")))
(progn
;; Find a type of that name in scope.
(setq typetag (and scope (semantic-scope-find name 'type scope)))
;; If no typetag, try the typecache
(when (not typetag)
(setq typetag (semanticdb-typecache-find name))))
;; No name to look stuff up with.
(error "Semantic tag %S has no type information"
(semantic-tag-name type-declaration)))
;; Handle lists of tags.
(when (and (consp typetag) (semantic-tag-p (car typetag)))
(setq typetag (semantic-analyze-select-best-tag typetag 'type))
)
;; We now have a tag associated with the type. We need to deref it.
;;
;; If we were asked not to (ie - debugger) push the typecache anyway.
(if nometaderef
typetag
(unwind-protect
(progn
(semantic-scope-set-typecache
scope (semantic-scope-tag-get-scope typetag))
(semantic-analyze-dereference-metatype-stack typetag scope type-declaration)
)
(semantic-scope-set-typecache scope nil)
)))))