[llvm] [FileCheck] improve prefix validation (PR #92248)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 05:55:51 PDT 2024
================
@@ -2468,13 +2468,16 @@ FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
static bool ValidatePrefixes(StringRef Kind, StringSet<> &UniquePrefixes,
ArrayRef<StringRef> SuppliedPrefixes) {
+ static const char *Directives[] = {"-NEXT", "-SAME", "-EMPTY", "-NOT",
+ "-COUNT", "-DAG", "-LABEL"};
+
for (StringRef Prefix : SuppliedPrefixes) {
if (Prefix.empty()) {
errs() << "error: supplied " << Kind << " prefix must not be the empty "
<< "string\n";
return false;
}
- static const Regex Validator("^[a-zA-Z0-9_-]*$");
+ static const Regex Validator("^[a-zA-Z][a-zA-Z0-9_-]*$");
----------------
RKSimon wrote:
This change was also picking up prefixes that were just numbers (e.g. 32 and 64 for 32 vs 64 bit tests)- should we allow those?
https://github.com/llvm/llvm-project/pull/92248
More information about the llvm-commits
mailing list