;;; semantic/analyze/fcn.el --- Analyzer support functions.
-;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2015 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <zappo@gnu.org>
;;
;; These queries allow a major mode to help the analyzer make decisions.
;;
-(define-overloadable-function semantic-analyze-tag-prototype-p (tag)
- "Non-nil if TAG is a prototype."
- )
-
-(defun semantic-analyze-tag-prototype-p-default (tag)
- "Non-nil if TAG is a prototype."
- (let ((p (semantic-tag-get-attribute tag :prototype-flag)))
- (cond
- ;; Trust the parser author.
- (p p)
- ;; Empty types might be a prototype.
- ((eq (semantic-tag-class tag) 'type)
- (not (semantic-tag-type-members tag)))
- ;; No other heuristics.
- (t nil))
- ))
-
-;;------------------------------------------------------------
(define-overloadable-function semantic-analyze-split-name (name)
"Split a tag NAME into a sequence.
;;
(define-overloadable-function semantic-analyze-dereference-metatype (type scope &optional type-declaration)
- ;; todo - move into typecahe!!
+ ;; todo - move into typecache!!
"Return a concrete type tag based on input TYPE tag.
A concrete type is an actual declaration of a memory description,
such as a structure, or class. A meta type is an alias,
The TYPE field in a tag can be nil (return nil)
or a string, or a non-positional tag."
(cond ((semantic-tag-p type)
- (semantic-tag-name type))
+ (if (semantic-tag-named-parent type)
+ (semantic-analyze-unsplit-name `(,(semantic-tag-named-parent type)
+ ,(semantic-tag-name type)))
+ (semantic-tag-name type)))
((stringp type)
type)
((listp type)
(if (and type-declaration
(semantic-tag-p type-declaration)
(semantic-tag-of-class-p type-declaration 'type)
- (not (semantic-analyze-tag-prototype-p type-declaration))
+ (not (semantic-tag-prototype-p type-declaration))
)
;; We have an anonymous type for TAG with children.
;; Use this type directly.
(semantic-scope-set-typecache scope nil)
)))))
+(autoload 'semantic-tag-similar-p "semantic/tag-ls")
+
(defun semantic-analyze-dereference-metatype-stack (type scope &optional type-declaration)
"Dereference metatypes repeatedly until we hit a real TYPE.
Uses `semantic-analyze-dereference-metatype'.
(nexttype (semantic-analyze-dereference-metatype type scope type-declaration))
(idx 0))
(catch 'metatype-recursion
- (while (and nexttype (not (eq (car nexttype) lasttype)))
+ (while (and nexttype (not (semantic-tag-similar-p (car nexttype) lasttype)))
(setq lasttype (car nexttype)
lasttypedeclaration (cadr nexttype))
(setq nexttype (semantic-analyze-dereference-metatype lasttype scope lasttypedeclaration))
(when (and (semantic-tag-p ans)
(eq (semantic-tag-class ans) 'type))
;; We have a tag.
- (if (semantic-analyze-tag-prototype-p ans)
+ (if (semantic-tag-prototype-p ans)
;; It is a prototype.. find the real one.
(or (and scope
(car-safe
(provide 'semantic/analyze/fcn)
-;; arch-tag: 32525305-515e-4b96-ad11-216d3a99f829
;;; semantic/analyze/fcn.el ends here