[gnome-builder] symbol-tree: extract a few more symbol types from clang
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] symbol-tree: extract a few more symbol types from clang
- Date: Sat, 20 Jun 2015 09:48:19 +0000 (UTC)
commit 8d2c1711c1f235a19d69bc0a134609243977fd63
Author: Christian Hergert <christian hergert me>
Date: Thu Jun 18 22:55:16 2015 -0700
symbol-tree: extract a few more symbol types from clang
libide/clang/ide-clang-symbol-node.c | 9 ++++++++-
libide/clang/ide-clang-symbol-tree.c | 7 +++++++
libide/ide-symbol.h | 1 +
plugins/symbol-tree/symbol-tree-builder.c | 1 +
4 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libide/clang/ide-clang-symbol-node.c b/libide/clang/ide-clang-symbol-node.c
index 79d831f..aef46ca 100644
--- a/libide/clang/ide-clang-symbol-node.c
+++ b/libide/clang/ide-clang-symbol-node.c
@@ -17,6 +17,7 @@
*/
#include <clang-c/Index.h>
+#include <glib/gi18n.h>
#include <gio/gio.h>
#include "ide-clang-symbol-node.h"
@@ -114,6 +115,10 @@ get_symbol_kind (CXCursor cursor,
kind = IDE_SYMBOL_FIELD;
break;
+ case CXCursor_VarDecl:
+ kind = IDE_SYMBOL_VARIABLE;
+ break;
+
default:
break;
}
@@ -131,15 +136,17 @@ _ide_clang_symbol_node_new (IdeContext *context,
IdeSymbolFlags flags = 0;
IdeSymbolKind kind;
CXString cxname;
+ const gchar *name;
kind = get_symbol_kind (cursor, &flags);
cxname = clang_getCursorSpelling (cursor);
+ name = clang_getCString (cxname);
self = g_object_new (IDE_TYPE_CLANG_SYMBOL_NODE,
"context", context,
"kind", kind,
"flags", flags,
- "name", clang_getCString (cxname),
+ "name", ide_str_empty0 (name) ? _("anonymous") : name,
NULL);
self->cursor = cursor;
diff --git a/libide/clang/ide-clang-symbol-tree.c b/libide/clang/ide-clang-symbol-tree.c
index 8ea22cd..6b7e584 100644
--- a/libide/clang/ide-clang-symbol-tree.c
+++ b/libide/clang/ide-clang-symbol-tree.c
@@ -99,8 +99,15 @@ cursor_is_recognized (TraversalState *state,
* TODO: Support way more CXCursorKind.
*/
+ case CXCursor_ClassDecl:
+ case CXCursor_EnumConstantDecl:
+ case CXCursor_EnumDecl:
+ case CXCursor_FieldDecl:
case CXCursor_FunctionDecl:
+ case CXCursor_StructDecl:
case CXCursor_TypedefDecl:
+ case CXCursor_UnionDecl:
+ case CXCursor_VarDecl:
cxloc = clang_getCursorLocation (cursor);
clang_getFileLocation (cxloc, &file, NULL, NULL, NULL);
filename = clang_getFileName (file);
diff --git a/libide/ide-symbol.h b/libide/ide-symbol.h
index 5316332..de27b16 100644
--- a/libide/ide-symbol.h
+++ b/libide/ide-symbol.h
@@ -37,6 +37,7 @@ typedef enum
IDE_SYMBOL_FIELD,
IDE_SYMBOL_ENUM,
IDE_SYMBOL_ENUM_VALUE,
+ IDE_SYMBOL_VARIABLE,
} IdeSymbolKind;
typedef enum
diff --git a/plugins/symbol-tree/symbol-tree-builder.c b/plugins/symbol-tree/symbol-tree-builder.c
index 4e51f63..a52f40a 100644
--- a/plugins/symbol-tree/symbol-tree-builder.c
+++ b/plugins/symbol-tree/symbol-tree-builder.c
@@ -102,6 +102,7 @@ symbol_tree_builder_build_node (GbTreeBuilder *builder,
case IDE_SYMBOL_SCALAR:
case IDE_SYMBOL_FIELD:
+ case IDE_SYMBOL_VARIABLE:
icon_name = "lang-variable-symbolic";
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]