]> git.eshelyaron.com Git - emacs.git/commitdiff
semantic: New c-mode override for analyzing tag type members
authorEric Ludlam <eric@siege-engine.com>
Thu, 23 Apr 2015 00:58:47 +0000 (20:58 -0400)
committerDavid Engster <deng@randomsample.de>
Sun, 22 Jan 2017 21:25:15 +0000 (22:25 +0100)
* lisp/cedet/semantic/bovine/c.el (semantic-analyze-tag-type-members):
 New override.

lisp/cedet/semantic/bovine/c.el

index 48521f91f503bbe7a9f5c6c6cb9449c8f215603f..449a7631956f9794b85341aa7e0fb62c22787c96 100644 (file)
@@ -1872,6 +1872,23 @@ These are constants which are of type TYPE."
   "Assemble the list of names NAMELIST into a namespace name."
   (mapconcat 'identity namelist "::"))
 
+(define-mode-local-override semantic-analyze-tag-type-members c-mode (tag)
+  "Return a list of :members of TAG.
+Merges in all members of anonymous unions that are :members of TAG."
+  (let ((raw (semantic-tag-type-members tag))
+       (ans nil))
+    (dolist (T raw)
+      (cond ((and (semantic-tag-of-class-p T 'type)
+                  (semantic-tag-of-type-p T "union")
+                  (string= (semantic-tag-name T) ""))
+            ;; Merge in all the union members.
+            (dolist (Ts (semantic-analyze-tag-type-members T))
+              (setq ans (cons Ts ans))))
+           ;; Be default, just push the tag.
+           (t
+            (setq ans (cons T ans)))))
+    (nreverse ans)))
+
 (define-mode-local-override semantic-ctxt-scoped-types c++-mode (&optional point)
   "Return a list of tags of CLASS type based on POINT.
 DO NOT return the list of tags encompassing point."