[PATCH] D64589: [UpdateTestChecks] Emit warning when invalid value for -check-prefix(es) option

Greg Bedwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 04:59:22 PDT 2019


gbedwell added a comment.

I've tried the latest update and it seems to work well for me.   The only suggestion I'd make at this stage is optionally adding a message like `(did you mean --check-prefixes?)` if a comma is spotted in the prefix string.

  --check-prefix=FOO,BAR

gives a fairly generic warning message now:

  WARNING: Supplied prefix 'FOO,BAR' is invalid. Prefix must start with a letter and contain only alphanumeric characters, hyphens and underscores.

which I can believe that if I was new to filecheck would probably cause me to spend more time debugging the issue than I'd like.



================
Comment at: utils/UpdateTestChecks/common.py:287
+        if prefixes.count(prefix) > 1:
+          print('WARNING: Supplied prefix \'%s\' is not unique in prefix list.' %
+                (prefix,), file=sys.stderr)
----------------
A very nitpicky and minor style nit, but you can contain single quotes in double quoted strings and double quotes in single quotes strings, so it may be more readable like this as you don't have to escape anything.


```
print('WARNING: Supplied prefix "%s" is not unique in prefix list.'
```

or:

```
print("WARNING: Supplied prefix '%s' is not unique in prefix list."
```



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

https://reviews.llvm.org/D64589





More information about the llvm-commits mailing list