[PATCH] D117117: [FileCheck] Allow literal '['s before "[[var...]]"

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 13:50:10 PST 2022


thopre accepted this revision.
thopre added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/FileCheck/FileCheck.cpp:1194
+    size_t FixedMatchEnd =
+        std::min(PatternStr.find("{{", 1), PatternStr.find("[[", 1));
     RegExStr += Regex::escape(PatternStr.substr(0, FixedMatchEnd));
----------------
foad wrote:
> thopre wrote:
> > Why the special treatment for `{{` here since only the `[[[` case is handled above?
> Only for consistency and/or efficiency. At this point we know that PatternStr does not start with `{{` since it was handled above, so there is no need to check for it at offset 0. And I found it easier to understand the code if both calls to `find` look the same.
Fair enough


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117117



More information about the llvm-commits mailing list