[PATCH] D142757: [clang][driver] Do not warn about position of `/clang:-xc` in cl mode

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 28 17:21:24 PST 2023


MaskRay added a comment.

See https://github.com/llvm/llvm-project/issues/59307#issuecomment-1407529807 I think we should just report an error for `/clang:-xc`



================
Comment at: clang/lib/Driver/Driver.cpp:2571
     // No driver mode exposes -x and /TC or /TP; we don't support mixing them.
     assert(!Args.hasArg(options::OPT_x) && "-x and /TC or /TP is not allowed");
   }
----------------
```
-    assert(!Args.hasArg(options::OPT_x) && "-x and /TC or /TP is not allowed");
+    if (auto *A = Args.getLastArg(options::OPT_x))
+      Diag(diag::err_drv_unsupported_opt_with_suggestion)
+          << A->getAsString(Args) << "/TC' or '/TP";
```


================
Comment at: clang/test/Driver/x-args.c:8
 // CHECK: '-x c++' after last input file has no effect
+//
+// RUN: %clang_cl /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck -check-prefix=CL %s
----------------
Delete `//`



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142757



More information about the cfe-commits mailing list