[clang] 133a7e6 - [PATCH] Reland [Clang] Un-break scan-build after integrated-cc1 change

Alexandre Ganea via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 14:03:18 PST 2020


Author: Alexandre Ganea
Date: 2020-01-21T17:03:00-05:00
New Revision: 133a7e631cee97965e310f0d110739217427fd3d

URL: https://github.com/llvm/llvm-project/commit/133a7e631cee97965e310f0d110739217427fd3d
DIFF: https://github.com/llvm/llvm-project/commit/133a7e631cee97965e310f0d110739217427fd3d.diff

LOG: [PATCH] Reland [Clang] Un-break scan-build after integrated-cc1 change

The issue was reported by @xazax.hun here: https://reviews.llvm.org/D69825#1827826

"This patch (D69825) breaks scan-build-py which parses the output of "-###" to get -cc1 command. There might be other tools with the same problems. Could we either remove (in-process) from CC1Command::Print or add a line break?

Having the last line as a valid invocation is valuable and there might be tools relying on that."

Differential Revision: https://reviews.llvm.org/D72982

Added: 
    

Modified: 
    clang/lib/Driver/Compilation.cpp
    clang/lib/Driver/Job.cpp
    clang/test/Driver/cc-print-options.c
    clang/test/Driver/cuda-simple.cu
    clang/test/Driver/offloading-interoperability.c
    clang/test/Driver/option-aliases.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp
index ba188f5c4083..25aec3690f21 100644
--- a/clang/lib/Driver/Compilation.cpp
+++ b/clang/lib/Driver/Compilation.cpp
@@ -172,7 +172,7 @@ int Compilation::ExecuteCommand(const Command &C,
     }
 
     if (getDriver().CCPrintOptions)
-      *OS << "[Logging clang options]";
+      *OS << "[Logging clang options]\n";
 
     C.Print(*OS, "\n", /*Quote=*/getDriver().CCPrintOptions);
   }

diff  --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index d57c3a1cdbb8..7dab2a022d92 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -373,7 +373,7 @@ int Command::Execute(ArrayRef<llvm::Optional<StringRef>> Redirects,
 
 void CC1Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
                        CrashReportInfo *CrashInfo) const {
-  OS << " (in-process)";
+  OS << " (in-process)\n";
   Command::Print(OS, Terminator, Quote, CrashInfo);
 }
 

diff  --git a/clang/test/Driver/cc-print-options.c b/clang/test/Driver/cc-print-options.c
index 77dd0fef5f98..dc7f4a3ac35c 100644
--- a/clang/test/Driver/cc-print-options.c
+++ b/clang/test/Driver/cc-print-options.c
@@ -3,5 +3,6 @@
 // RUN: %clang -no-canonical-prefixes -S -o %t.s %s
 // RUN: FileCheck %s < %t.log
 
-// CHECK: [Logging clang options]{{.*}}clang{{.*}}"-S"
+// CHECK: [Logging clang options]
+// CHECK: {{.*}}clang{{.*}}"-S"
 

diff  --git a/clang/test/Driver/cuda-simple.cu b/clang/test/Driver/cuda-simple.cu
index b6840be4e2e5..54e18403108b 100644
--- a/clang/test/Driver/cuda-simple.cu
+++ b/clang/test/Driver/cuda-simple.cu
@@ -5,10 +5,10 @@
 // Verify that we pass -x cuda-cpp-output to compiler after
 // preprocessing a CUDA file
 // RUN: %clang  -Werror -### -save-temps -c %s 2>&1 | FileCheck %s
-// CHECK: "-cc1"
+// CHECK-LABEL: "-cc1"
 // CHECK: "-E"
 // CHECK: "-x" "cuda"
-// CHECK-NEXT: "-cc1"
+// CHECK-LABEL: "-cc1"
 // CHECK: "-x" "cuda-cpp-output"
 //
 // Verify that compiler accepts CUDA syntax with "-x cuda-cpp-output".

diff  --git a/clang/test/Driver/offloading-interoperability.c b/clang/test/Driver/offloading-interoperability.c
index 9c80d91d1d78..c3a72f0dfe2a 100644
--- a/clang/test/Driver/offloading-interoperability.c
+++ b/clang/test/Driver/offloading-interoperability.c
@@ -8,10 +8,10 @@
 // RUN: %clang -no-canonical-prefixes -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
 // RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
 //
-// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
+// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-LABEL:clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
 // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
 // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
 // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary"{{( "--cuda")?}} "-64"
-// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le-unknown-linux-gnu"
+// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-LABEL:clang{{.*}}" "-cc1" "-triple" "powerpc64le-unknown-linux-gnu"
 // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
 // NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: {{ld(.exe)?"}} {{.*}}"-m" "elf64lppc"

diff  --git a/clang/test/Driver/option-aliases.c b/clang/test/Driver/option-aliases.c
index 9cd9252a4832..e50289cc3bdf 100644
--- a/clang/test/Driver/option-aliases.c
+++ b/clang/test/Driver/option-aliases.c
@@ -3,12 +3,12 @@
 // RUN: --param=FOO --output=FOO %s 2>&1 | \
 // RUN: FileCheck %s
 
-// CHECK: "-cc1"
+// CHECK-LABEL: "-cc1"
 // CHECK: "-E"
 // CHECK: "-U" "FOO"
 // CHECK: "-U" "BAR"
 // CHECK: "-o" "option-aliases.i"
 
-// CHECK-NEXT: "-cc1"
+// CHECK-LABEL: "-cc1"
 // CHECK: "-S"
 // CHECK: "-o" "FOO"


        


More information about the cfe-commits mailing list