[llvm] [FileCheck] improve prefix validation (PR #92248)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 14:24:00 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_-]*$");
----------------
MaskRay wrote:
I hope that check prefixes like `# 64: ` can be kept working.
There are quite a few occurrences: `rg '^(;|#|//) \d+:' llvm/test/ -l`
https://github.com/llvm/llvm-project/pull/92248
More information about the llvm-commits
mailing list