From 83ec53ec5fdb58b18abfd4653255698d083d0b3d Mon Sep 17 00:00:00 2001 From: dyung Date: Mon, 22 Jul 2024 19:05:13 -0700 Subject: [PATCH] Revert "[Clang][Driver] Warn about `-c/-S` with `-fsyntax-only` (#98607)" This reverts commit 1efcc532bab505db079bd3becffe32f742287c71. --- clang/lib/Driver/ToolChains/Clang.cpp | 4 ++++ clang/test/Driver/warn-fsyntax-only.c | 7 ------- 2 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 clang/test/Driver/warn-fsyntax-only.c diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index f881fe8c395f8..f240a47504ef6 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -794,6 +794,10 @@ static void addPGOAndCoverageFlags(const ToolChain &TC, Compilation &C, Args.hasArg(options::OPT_coverage)) FProfileDir = Args.getLastArg(options::OPT_fprofile_dir); + // TODO: Don't claim -c/-S to warn about -fsyntax-only -c/-S, -E -c/-S, + // like we warn about -fsyntax-only -E. + (void)(Args.hasArg(options::OPT_c) || Args.hasArg(options::OPT_S)); + // Put the .gcno and .gcda files (if needed) next to the primary output file, // or fall back to a file in the current directory for `clang -c --coverage // d/a.c` in the absence of -o. diff --git a/clang/test/Driver/warn-fsyntax-only.c b/clang/test/Driver/warn-fsyntax-only.c deleted file mode 100644 index b4cf74fc59855..0000000000000 --- a/clang/test/Driver/warn-fsyntax-only.c +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: %clang -fsyntax-only -E %s 2>&1 | FileCheck %s --check-prefix=CHECK-PP -// 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 - -// CHECK-PP: warning: argument unused during compilation: '-fsyntax-only' [-Wunused-command-line-argument] -// CHECK-ASM: warning: argument unused during compilation: '-S' [-Wunused-command-line-argument] -// CHECK-OBJ: warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]