[PATCH] D142757: [clang][driver] Emit an error for `/clang:-x`

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 1 14:51:11 PST 2023


MaskRay added inline comments.


================
Comment at: clang/test/Driver/x-args.c:12
+// RUN: not %clang_cl /TC /WX /clang:-xc /clang:-E /clang:-dM %s 2>&1 | FileCheck -check-prefix=CL %s
+// CL-NOT: '-x c' after last input file has no effect
+// CL: error: unsupported option '-x c'; did you mean '/TC' or '/TP'?
----------------
Fznamznon wrote:
> Fznamznon wrote:
> > MaskRay wrote:
> > > You can remove this `CL-NOT` negative pattern. Instead, use `--check-prefix=CL --implicit-check-not=error:` to check that there is no other error.
> > I probably don't fully understand the suggestion, but there is a `error:` that is being checked in this test. The one that this revision adds. It is checked on the next line.
> Is that ok if I submit the patch "as is"?
`CL-NOT:` checks one specific error message does not appear before `error: unsupported option ...`. You need another pattern to check that it does not appear after `error: unsupported option ...`. If you use --implicit-check-not, you additionally check that there is no other error diagnostic whatever their message is.


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