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

Greg Bedwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 03:33:34 PDT 2019


gbedwell added inline comments.


================
Comment at: utils/UpdateTestChecks/common.py:272
+    if "check-prefix=" in part:
+      prefix = part.split('=')[1]
+      if ',' in prefix:
----------------
I doubt whether it could ever cause an issue in practice, but it's probably safer to specify maxsplit here.
```
prefix = part.split('=', 1)[1]
```

If we somehow ever ended up with a string like '--check-prefix=foo=bar' then we'd end up with 'foo=bar' in element 1 rather than 'foo' in element 1 and 'bar' in element 2 which would subsequently be silently ignored.  Alternatively you could just check that the number of elements returned from the split is exactly two and raise an error or warning if not.


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

https://reviews.llvm.org/D64589





More information about the llvm-commits mailing list