[clang] [Clang][Driver] Warn about `-c/-S` with `-fsyntax-only` (PR #98607)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 14 23:12:44 PDT 2024


================
@@ -0,0 +1,9 @@
+// RUN: %clang -fsyntax-only -S %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM
+// RUN: %clang -fsyntax-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-OBJ
+// RUN: %clang -fsyntax-only -S -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-BOTH
+
+// CHECK-ASM: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
+// CHECK-OBJ: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
+
+// CHECK-BOTH: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument]
+// CHECK-NEXT: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
----------------
MaskRay wrote:

CHECK-NEXT is not used by any FileCheck command

https://github.com/llvm/llvm-project/pull/98607


More information about the cfe-commits mailing list