[gnome-builder] clang: ignore translation units on temporary files



commit 6bde4b86916005f4bfb89eacce3fd575fb5ac341
Author: Christian Hergert <christian hergert me>
Date:   Sat Sep 12 19:43:56 2015 -0700

    clang: ignore translation units on temporary files

 plugins/clang/ide-clang-service.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/plugins/clang/ide-clang-service.c b/plugins/clang/ide-clang-service.c
index 65e7287..b425896 100644
--- a/plugins/clang/ide-clang-service.c
+++ b/plugins/clang/ide-clang-service.c
@@ -482,6 +482,18 @@ ide_clang_service_get_translation_unit_async (IdeClangService     *self,
 
   task = g_task_new (self, cancellable, callback, user_data);
 
+  /*
+   * Clang likes to crash on our temporary files.
+   */
+  if (ide_file_get_is_temporary (file))
+    {
+      g_task_return_new_error (task,
+                               G_IO_ERROR,
+                               G_IO_ERROR_NOT_FOUND,
+                               "File does not yet exist, ignoring translation unit request.");
+      return;
+    }
+
   if (min_serial == 0)
     {
       IdeContext *context;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]