]> git.eshelyaron.com Git - emacs.git/commitdiff
semantic: Incorporate local scope when finding type
authorEric Ludlam <eric@siege-engine.com>
Sun, 22 Mar 2015 21:36:16 +0000 (17:36 -0400)
committerDavid Engster <deng@randomsample.de>
Sun, 22 Jan 2017 21:25:15 +0000 (22:25 +0100)
* lisp/cedet/semantic/analyze/fcn.el (semantic-analyze-tag-type): When
 first search fails, calc scope from the originating tag, and try
 again.

lisp/cedet/semantic/analyze/fcn.el

index 1abbca5158e3a4226fc4fda3540a1027e67aec4f..24f71bbf84cbe926aea77975cb463661c2ccdf27 100644 (file)
@@ -183,7 +183,16 @@ 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."
-  (semantic-analyze-type (semantic-tag-type tag) scope nometaderef))
+  (or
+   (semantic-analyze-type (semantic-tag-type tag) scope nometaderef)
+   ;; If we didn't find it the 'quick' way with the passed in scope,
+   ;; perhaps the type is using a shorthand only available from the
+   ;; location of TAG, which might be a member of some struct far away
+   ;; from the original source that spawned the search.
+   (let ((tagscope (semantic-calculate-scope-for-tag tag)))
+     (when tagscope
+       (semantic-analyze-type (semantic-tag-type tag)
+                             tagscope nometaderef)))))
 
 (defun semantic-analyze-type (type-declaration &optional scope nometaderef)
   "Return the semantic tag for TYPE-DECLARATION.