[llvm] [FileCheck] improve prefix validation (PR #92248)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon May 20 00:35:36 PDT 2024
================
@@ -2468,24 +2468,36 @@ FileCheckString::CheckDag(const SourceMgr &SM, StringRef Buffer,
static bool ValidatePrefixes(StringRef Kind, StringSet<> &UniquePrefixes,
ArrayRef<StringRef> SuppliedPrefixes) {
+ static const char *Suffixes[] = {"-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_-]*$");
+ // TODO: restrict prefixes to start with only letter eventually
+ static const Regex Validator("^[a-zA-Z0-9][a-zA-Z0-9_-]*$");
----------------
jh7370 wrote:
Why do you want to change the behaviour? What's wrong with a leading underscore or dash?
https://github.com/llvm/llvm-project/pull/92248
More information about the llvm-commits
mailing list