[gnome-builder/wip/libide: 129/237] libide: iterate diagnostic set
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide: 129/237] libide: iterate diagnostic set
- Date: Tue, 17 Feb 2015 21:40:15 +0000 (UTC)
commit 62b9369ed8d9344ba125ee1e6ec61af812e97697
Author: Christian Hergert <christian hergert me>
Date: Wed Feb 11 22:17:30 2015 -0800
libide: iterate diagnostic set
libide/clang/ide-clang-translation-unit.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/libide/clang/ide-clang-translation-unit.c b/libide/clang/ide-clang-translation-unit.c
index c83251b..9ce5f11 100644
--- a/libide/clang/ide-clang-translation-unit.c
+++ b/libide/clang/ide-clang-translation-unit.c
@@ -21,6 +21,8 @@
#include "ide-context.h"
#include "ide-clang-translation-unit.h"
+#include "ide-diagnostic.h"
+#include "ide-private.h"
typedef struct
{
@@ -82,6 +84,26 @@ ide_clang_translation_unit_get_diagnostics (IdeClangTranslationUnit *self)
if (!priv->diagnostics)
{
+ GPtrArray *ar;
+ guint count;
+ guint i;
+
+ ar = g_ptr_array_new_with_free_func ((GDestroyNotify)ide_diagnostic_unref);
+ count = clang_getNumDiagnostics (priv->tu);
+
+ for (i = 0; i < count; i++)
+ {
+ CXDiagnostic cxdiag;
+ CXString cxstr;
+
+ cxdiag = clang_getDiagnostic (priv->tu, i);
+ cxstr = clang_getDiagnosticSpelling (cxdiag);
+ g_print ("> %s\n", clang_getCString (cxstr));
+ clang_disposeString (cxstr);
+ clang_disposeDiagnostic (cxdiag);
+ }
+
+ priv->diagnostics = _ide_diagnostics_new (ar);
}
return priv->diagnostics;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]