Author: Yi Kong Date: 2022-03-16T01:17:17+08:00 New Revision: ba59476515cf4598dd25bcfacfbca11b4f4da3d4
URL: https://github.com/llvm/llvm-project/commit/ba59476515cf4598dd25bcfacfbca11b4f4da3d4 DIFF: https://github.com/llvm/llvm-project/commit/ba59476515cf4598dd25bcfacfbca11b4f4da3d4.diff LOG: Revert "[clang][driver] Emit a warning if -xc/-xc++ is after the last input file" This reverts commit 1c1a4b9556db8579f7428605ac2c351bddde9ad5. Some builders failed. Added: Modified: clang/include/clang/Basic/DiagnosticDriverKinds.td clang/lib/Driver/Driver.cpp Removed: clang/test/Driver/x-args.c ################################################################################ diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 3394eefd738c4..afedb37797e32 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -365,9 +365,6 @@ def warn_drv_preprocessed_input_file_unused : Warning< def warn_drv_unused_argument : Warning< "argument unused during compilation: '%0'">, InGroup<UnusedCommandLineArgument>; -def warn_drv_unused_x : Warning< - "‘-x %0’ after last input file has no effect">, - InGroup<UnusedCommandLineArgument>; def warn_drv_empty_joined_argument : Warning< "joined argument expects additional value: '%0'">, InGroup<UnusedCommandLineArgument>; diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index d7a5ca4f21988..70822490e63b8 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -2308,15 +2308,6 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args, assert(!Args.hasArg(options::OPT_x) && "-x and /TC or /TP is not allowed"); } - // Warn -x after last input file has no effect - { - Arg *LastXArg = Args.getLastArgNoClaim(options::OPT_x); - Arg *LastInputArg = Args.getLastArgNoClaim(options::OPT_INPUT); - if (LastInputArg->getIndex() < LastXArg->getIndex()) { - Diag(clang::diag::warn_drv_unused_x) << LastXArg->getValue(); - } - } - for (Arg *A : Args) { if (A->getOption().getKind() == Option::InputClass) { const char *Value = A->getValue(); diff --git a/clang/test/Driver/x-args.c b/clang/test/Driver/x-args.c deleted file mode 100644 index 9b095fcd6c7f9..0000000000000 --- a/clang/test/Driver/x-args.c +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: %clang -fsyntax-only -Werror -xc %s -// RUN: %clang -fsyntax-only -Werror %s -xc %s - -// RUN: %clang -fsyntax-only %s -xc++ -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -fsyntax-only -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s -// RUN: %clang -fsyntax-only %s -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s -// CHECK: ‘-x c++’ after last input file has no effect \ No newline at end of file _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits