[PATCH] D91761: [FileCheck] Add a literal check directive

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 02:17:56 PST 2020


thopre added a comment.

You should add examples for the other directives as well (CHECK-LITERAL-DAG, CHECK-LITERAL-NOT, CHECK-LITERAL-COUNT)



================
Comment at: llvm/docs/CommandGuide/FileCheck.rst:663-669
+The "CHECK-LITERAL(-x):" directive
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you need to check a literal string match. There are no regex matching,
+variable capture or expansion performed. This is useful when the text to match
+would require excessive escapping otherwise. LITERAL can be used with plain
+CHECK, next CHECK (CHECK-LITERAL-NEXT), COUNT, DAG, SAME, NOT or DAG CHECK (CHECK-LITERAL-DAG).
----------------
Proposed rewording. If not convinced by it you should at least fix the syntax for mentioning a directive and the typo on "escaping".


================
Comment at: llvm/include/llvm/FileCheck/FileCheck.h:70
   int Count; ///< optional Count for some checks
+  bool Literal; ///< optional Whether to treat match as literal
 
----------------
I know that's what the above line did but I'd simply phrase it as per suggestion.


================
Comment at: llvm/lib/FileCheck/FileCheck.cpp:1597-1600
+Check::FileCheckType &Check::FileCheckType::setLiteralMatch(bool literal) {
+  Literal = literal;
+  return *this;
+}
----------------
Given how simple is this I would put it in the class declaration.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91761



More information about the llvm-commits mailing list