[llvm-commits] PATCH: FileCheck to allow referencing vars defined on the same line

Dmitri Gribenko gribozavr at gmail.com
Sat Dec 1 06:55:04 PST 2012


On Sat, Dec 1, 2012 at 4:10 PM, Eli Bendersky <eliben at google.com> wrote:
> Following up on
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/157198.html
> and linked messages, the attached patch builds up on the previous work
> and adds the ability to reference variables defined earlier on the
> same line in FileCheck. This should enable writing many tests in a
> cleaner way.

+  /// VariableDefs - Maps definitions of variables to their parenthesized
+  /// capture numbers.
+  /// E.g. for the pattern "foo[[bar:.*]]baz", VariableDefs will map
"bar" to 1.

Please don't duplicate function or class name inside the comment.
Please also don't duplicate the comment in .cpp file.  Old code is
written that way, but current coding style advises not to duplicate.

This link may be helpful:
<http://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments>.

+  std::map<StringRef, unsigned> VariableDefs;

StringMap?

+          std::string backref = std::string("\\") +

This should be 'Backref'.  Also trailing whitespace.

+void Pattern::AddBackrefToRegEx(StringRef Backref) {
+  RegExStr += Backref;
+}

Maybe this should take an 'unsigned' parameter?

> If this looks alright to people, I will also update the FileCheck
> documentation and probably add some more tests.

Please add tests that check that we count parentheses in user's
regexes correctly (i.e., that CurParen is correct).

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the llvm-commits mailing list