1 From 99a7e55a60c8d96e160f9104a3dd31b7914d3488 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
3 Date: Fri, 31 Jul 2020 09:22:03 +0100
4 Subject: [PATCH] Fix scan-build to use NIX_CFLAGS_COMPILE
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
11 clang/tools/scan-build/libexec/ccc-analyzer | 8 ++++++++
12 1 file changed, 8 insertions(+)
14 diff --git a/clang/tools/scan-build/libexec/ccc-analyzer
15 b/clang/tools/scan-build/libexec/ccc-analyzer
16 index ed0d4d3d73f3..2d5113435ca5 100755
17 --- a/clang/tools/scan-build/libexec/ccc-analyzer
18 +++ b/clang/tools/scan-build/libexec/ccc-analyzer
19 @@ -249,6 +249,14 @@ sub Analyze {
20 push @Args, "-target", $AnalyzerTarget;
23 + # Add Nix flags to analysis
24 + if (defined $ENV{'NIX_CFLAGS_COMPILE'}) {
25 + my @nixArgs = split(/\s+/, $ENV{'NIX_CFLAGS_COMPILE'});
26 + foreach my $nixArg (@nixArgs) {
27 + push @Args, $nixArg;
31 my $AnalysisArgs = GetCCArgs($HtmlDir, "--analyze", \@Args);
32 @CmdArgs = @$AnalysisArgs;