[gnome-builder] compile-commands: add fallback for -private.h
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] compile-commands: add fallback for -private.h
- Date: Thu, 25 Jan 2018 12:16:24 +0000 (UTC)
commit ade545b185d9a066260d09556066c37ea10d5aaf
Author: Christian Hergert <chergert redhat com>
Date: Thu Jan 25 04:15:40 2018 -0800
compile-commands: add fallback for -private.h
Another common pattern in GNOME code, so try to get the right
flags for the private headers.
src/libide/buildsystem/ide-compile-commands.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-compile-commands.c b/src/libide/buildsystem/ide-compile-commands.c
index e0be48b44..408e084c9 100644
--- a/src/libide/buildsystem/ide-compile-commands.c
+++ b/src/libide/buildsystem/ide-compile-commands.c
@@ -613,8 +613,20 @@ find_with_alternates (IdeCompileCommands *self,
g_autofree gchar *path = g_file_get_path (file);
gsize len = strlen (path);
- /* Try .c/etc instead of .h */
- if (g_str_has_suffix (path, ".h"))
+ if (g_str_has_suffix (path, "-private.h"))
+ {
+ g_autofree gchar *other_path = NULL;
+ g_autoptr(GFile) other = NULL;
+
+ path[len - strlen ("-private.h")] = 0;
+
+ other_path = g_strconcat (path, ".c", NULL);
+ other = g_file_new_for_path (other_path);
+
+ if (NULL != (info = g_hash_table_lookup (self->info_by_file, other)))
+ return info;
+ }
+ else if (g_str_has_suffix (path, ".h"))
{
static const gchar *tries[] = { "c", "cc", "cpp" };
path[--len] = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]