summary refs log tree commit diff
path: root/pkgs/development/tools/analysis/clang-analyzer/0001-Fix-scan-build-to-use-NIX_CFLAGS_COMPILE.patch
blob: 16470740877e3c72114bf929c7e6ad750518ffa5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 40239d92957f1969652cdd41d6d2749c41ac4338 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Fri, 31 Jul 2020 09:22:03 +0100
Subject: [PATCH] [PATCH] Fix scan-build to use NIX_CFLAGS_COMPILE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
 tools/scan-build/libexec/ccc-analyzer | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/scan-build/libexec/ccc-analyzer b/tools/scan-build/libexec/ccc-analyzer
index 800f38b5..0fb50fb3 100755
--- a/tools/scan-build/libexec/ccc-analyzer
+++ b/tools/scan-build/libexec/ccc-analyzer
@@ -246,6 +246,14 @@ sub Analyze {
       push @Args, "-target", $AnalyzerTarget;
     }
 
+    # Add Nix flags to analysis
+    if (defined $ENV{'NIX_CFLAGS_COMPILE'}) {
+      my @nixArgs = split(/\s+/, $ENV{'NIX_CFLAGS_COMPILE'});
+      foreach my $nixArg (@nixArgs) {
+        push @Args, $nixArg;
+      }
+    }
+
     my $AnalysisArgs = GetCCArgs($HtmlDir, "--analyze", \@Args);
     @CmdArgs = @$AnalysisArgs;
   }
-- 
2.27.0