[gnome-builder] clang: stub get_symbols_async()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] clang: stub get_symbols_async()
- Date: Sun, 29 Mar 2015 08:02:39 +0000 (UTC)
commit a60084825d7c35fffaec5c75cbde7d5c6b85732f
Author: Christian Hergert <christian hergert me>
Date: Sat Mar 28 18:00:03 2015 -0700
clang: stub get_symbols_async()
libide/clang/ide-clang-symbol-resolver.c | 85 ++++++++++++++++++++++++++++++
1 files changed, 85 insertions(+), 0 deletions(-)
---
diff --git a/libide/clang/ide-clang-symbol-resolver.c b/libide/clang/ide-clang-symbol-resolver.c
index 34b2876..ab38c45 100644
--- a/libide/clang/ide-clang-symbol-resolver.c
+++ b/libide/clang/ide-clang-symbol-resolver.c
@@ -22,6 +22,7 @@
#include "ide-clang-service.h"
#include "ide-clang-symbol-resolver.h"
#include "ide-debug.h"
+#include "ide-file.h"
#include "ide-source-location.h"
#include "ide-symbol.h"
@@ -123,12 +124,96 @@ ide_clang_symbol_resolver_lookup_symbol_finish (IdeSymbolResolver *resolver,
}
static void
+ide_clang_symbol_resolver_get_symbols_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ IdeClangService *service = (IdeClangService *)object;
+ g_autoptr(IdeClangTranslationUnit) unit = NULL;
+ g_autoptr(GTask) task = user_data;
+ g_autoptr(GPtrArray) ret = NULL;
+ GError *error = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_CLANG_SERVICE (service));
+ g_assert (G_IS_TASK (task));
+
+ unit = ide_clang_service_get_translation_unit_finish (service, result, &error);
+
+ if (unit == NULL)
+ {
+ g_task_return_error (task, error);
+ IDE_EXIT;
+ }
+
+ ret = g_ptr_array_new ();
+
+ g_task_return_pointer (task, g_ptr_array_ref (ret), (GDestroyNotify)g_ptr_array_unref);
+
+ IDE_EXIT;
+}
+
+static void
+ide_clang_symbol_resolver_get_symbols_async (IdeSymbolResolver *resolver,
+ IdeFile *file,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ IdeClangSymbolResolver *self = (IdeClangSymbolResolver *)resolver;
+ IdeClangService *service = NULL;
+ IdeContext *context;
+ g_autoptr(GTask) task = NULL;
+
+ IDE_ENTRY;
+
+ g_assert (IDE_IS_CLANG_SYMBOL_RESOLVER (self));
+ g_assert (IDE_IS_FILE (file));
+ g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
+
+ context = ide_object_get_context (IDE_OBJECT (self));
+ service = ide_context_get_service_typed (context, IDE_TYPE_CLANG_SERVICE);
+
+ task = g_task_new (self, cancellable, callback, user_data);
+
+ ide_clang_service_get_translation_unit_async (service,
+ file,
+ 0,
+ cancellable,
+ ide_clang_symbol_resolver_get_symbols_cb,
+ g_object_ref (task));
+
+ IDE_EXIT;
+}
+
+static GPtrArray *
+ide_clang_symbol_resolver_get_symbols_finish (IdeSymbolResolver *resolver,
+ GAsyncResult *result,
+ GError **error)
+{
+ GPtrArray *ret;
+ GTask *task = (GTask *)result;
+
+ IDE_ENTRY;
+
+ g_return_val_if_fail (IDE_IS_CLANG_SYMBOL_RESOLVER (resolver), NULL);
+ g_return_val_if_fail (G_IS_TASK (task), NULL);
+
+ ret = g_task_propagate_pointer (task, error);
+
+ IDE_RETURN (ret);
+}
+
+static void
ide_clang_symbol_resolver_class_init (IdeClangSymbolResolverClass *klass)
{
IdeSymbolResolverClass *symbol_resolver_class = IDE_SYMBOL_RESOLVER_CLASS (klass);
symbol_resolver_class->lookup_symbol_async = ide_clang_symbol_resolver_lookup_symbol_async;
symbol_resolver_class->lookup_symbol_finish = ide_clang_symbol_resolver_lookup_symbol_finish;
+ symbol_resolver_class->get_symbols_async = ide_clang_symbol_resolver_get_symbols_async;
+ symbol_resolver_class->get_symbols_finish = ide_clang_symbol_resolver_get_symbols_finish;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]