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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 07:55:16 PST 2022


foad added inline comments.


================
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));
----------------
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.


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