[PATCH] D140224: [Driver] Revert D139717 and add -Xparser instead

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 22 12:51:37 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG46cd3127fe54: [Driver] Revert D139717 and add -Xparser/-Xcompiler instead (authored by MaskRay).

Changed prior to commit:
  https://reviews.llvm.org/D140224?vs=483565&id=484938#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140224/new/

https://reviews.llvm.org/D140224

Files:
  clang/include/clang/Driver/Options.td
  clang/test/Driver/warn-Xparser.c
  clang/test/Misc/warn-not-error-Xfoo.c


Index: clang/test/Misc/warn-not-error-Xfoo.c
===================================================================
--- clang/test/Misc/warn-not-error-Xfoo.c
+++ /dev/null
@@ -1,14 +0,0 @@
-// RUN: %clang -c %s -o /dev/null -Xfoo < %s 2>&1 | FileCheck --check-prefix=CHECK_STANDALONE_FOO %s
-// RUN: %clang -c %s -o /dev/null -Xfoo=bar 2>&1 | FileCheck --check-prefix=CHECK_JOINED_FOO %s
-
-// This test ensures that we only warn on -X<unknown> and -X<unknown=value>
-// in case it is used downstream. If we error, we can't ignore it and some
-// use of these (ignored) flags are in legacy use.
-// TODO: Deprecate with timebox warning so consumers can respond.
-
-// CHECK_STANDALONE_FOO: warning: argument unused during compilation: '-Xfoo' [-Wunused-command-line-argument]
-// CHECK_JOINED_FOO: warning: argument unused during compilation: '-Xfoo=bar' [-Wunused-command-line-argument]
-
-// CHECK-NOT: clang{.*}: error: unknown argument:
-
-void f(void) {}
Index: clang/test/Driver/warn-Xparser.c
===================================================================
--- /dev/null
+++ clang/test/Driver/warn-Xparser.c
@@ -0,0 +1,6 @@
+/// Some macOS projects use -Xparser.
+// RUN: %clang -c -Xparser %s 2>&1 | FileCheck %s
+
+// CHECK: warning: argument unused during compilation: '-Xparser' [-Wunused-command-line-argument]
+
+void f(void) {}
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -846,7 +846,10 @@
 def Xpreprocessor : Separate<["-"], "Xpreprocessor">, Group<Preprocessor_Group>,
   HelpText<"Pass <arg> to the preprocessor">, MetaVarName<"<arg>">;
 def X_Flag : Flag<["-"], "X">, Group<Link_Group>;
-def X_Joined : Joined<["-"], "X">, IgnoredGCCCompat;
+// Used by some macOS projects. IgnoredGCCCompat is a misnomer since GCC doesn't allow it.
+def : Flag<["-"], "Xparser">, IgnoredGCCCompat;
+// FIXME -Xcompiler is misused by some ChromeOS packages. Remove it after a while.
+def : Flag<["-"], "Xcompiler">, IgnoredGCCCompat;
 def Z_Flag : Flag<["-"], "Z">, Group<Link_Group>;
 def all__load : Flag<["-"], "all_load">;
 def allowable__client : Separate<["-"], "allowable_client">;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140224.484938.patch
Type: text/x-patch
Size: 2248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221222/1238c947/attachment-0001.bin>


More information about the cfe-commits mailing list