[PATCH] D125604: [FileCheck] Catch missspelled directives.

Thomas Preud'homme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 16 04:25:54 PDT 2022


thopre added inline comments.


================
Comment at: llvm/lib/FileCheck/FileCheck.cpp:1774-1781
+static std::pair<Check::FileCheckType, StringRef>
+FindCheckType(const FileCheckRequest &Req, StringRef Buffer, StringRef Prefix) {
+  bool Misspelled = false;
+  auto Res = FindCheckType(Req, Buffer, Prefix, Misspelled);
+  if (Res.first != Check::CheckNone && Misspelled)
+    return {Check::CheckMisspelled, Res.second};
+  return Res;
----------------
Instead of introducing a new wrapper, why don't you change all the return to call a constructor method (e.g. `make_check_type()`) that does what this wrapper do? Then there would not be any FindCheckType that take a Misspelled parameter.

I'm also not sure about Misspelled being a check kind. It feels conceptually wrong but on the other hand I guess it makes the implementation simpler.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125604



More information about the cfe-commits mailing list