[geany/geany] 5b4c6f: Don't use anon_struct_* and similar members unless we are sure it's the right one

Jiří Techet git-noreply at xxxxx
Thu Feb 11 14:35:58 UTC 2016


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Mon, 18 Jan 2016 21:56:10 UTC
Commit:      5b4c6f96b20cd309026e42c02133b28d1e0e64df
             https://github.com/geany/geany/commit/5b4c6f96b20cd309026e42c02133b28d1e0e64df

Log Message:
-----------
Don't use anon_struct_* and similar members unless we are sure it's the right one

We can only be sure it's the right one if we previously resolved a
typedef to it and the typedef was in the same file.


Modified Paths:
--------------
    tagmanager/src/tm_workspace.c

Modified: tagmanager/src/tm_workspace.c
7 lines changed, 6 insertions(+), 1 deletions(-)
===================================================================
@@ -805,6 +805,7 @@ find_scope_members (const GPtrArray *tags_array, const char *name, langType lang
 					gboolean namespace)
 {
 	gboolean has_members = FALSE;
+	gboolean typedef_struct = FALSE;
 	GPtrArray *tags = NULL;
 	TMTag *tag = NULL;
 	const gchar *type_name;
@@ -839,6 +840,7 @@ find_scope_members (const GPtrArray *tags_array, const char *name, langType lang
 			 * too many (wrong) results. */
 			fill_find_tags_array(type_tags, tag->file->tags_array, type_name,
 								 NULL, types, FALSE, lang);
+			typedef_struct = type_tags->len > 0;
 		}
 		if (type_tags->len == 0)
 			fill_find_tags_array(type_tags, tags_array, type_name, NULL, types, FALSE, lang);
@@ -870,7 +872,10 @@ find_scope_members (const GPtrArray *tags_array, const char *name, langType lang
 		}
 	}
 
-	if (has_members)
+	/* ignore anon_struct_* and similar unless we resolved a typedef to it within
+	 * a single file so we can be sure we don't pick a wrong anon_struct_* from
+	 * a different file */
+	if (has_members && (typedef_struct || !tm_tag_is_anon(tag)))
 		/* use the same file as the composite type if file information available */
 		tags = find_scope_members_tags(tag->file ? tag->file->tags_array : tags_array, tag, namespace);
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list