[PATCH] PPCallbacksTest expansion - part 1

Sean Silva silvas at purdue.edu
Thu Oct 17 17:12:08 PDT 2013


  Turning the preprocessor decisions into a serialized textual format is a great idea!

  Though this seems like it would be better done as an independent tool. I.e. one that reads its file on stdin (or as an argument) and prints out this information, for use in conjunction with FileCheck. That would allow idiomatic LLVM FileCheck testing similar to:

      ; RUN: opt < %s -sroa -S | FileCheck %s

  (that was from `llvm/test/Transforms/SROA/basictest.ll` but there are innumerable other examples).

  so the usage would be something like:

      ; RUN: pp-trace < %s | FileCheck %s

  That would also completely offload the burden of the pattern matching/specification to FileCheck, and integrate with developers' existing familiarity with FileCheck.


  Also, I'm not a huge fan of this ad-hoc serialization. Could you please use YAMLIO <http://llvm.org/docs/YamlIO.html> and have the output be YAML? YAMLIO is really simple to use once you get the hang of it. Look at LLVM's r183711 for a pretty minimal example; the code there only uses it for input, but YAMLIO is inherently bidirectional so output is just a matter of using `<<` rather than `>>`. Feel free to ask me questions too.

  YAML output would be *amazing*, since then it would be possible to write ad-hoc simple tools in any language (I'm thinking in particular scripting languages), for e.g. quickly checking assumptions, scoping out the prevalence of a particular pattern, etc.. Many languages have YAML parsers, and turning YAML into equivalent JSON is like a 10-line Python program, and then every language can access it.

http://llvm-reviews.chandlerc.com/D1966



More information about the cfe-commits mailing list