[PATCH] D30299: [tablegen] Optionally format tablegen targets with clang-format

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 09:41:35 PDT 2017


dsanders added a comment.

Sorry for being slow to get back to this one. I've been prioritising the other patches.

>> I am a bit concerned about making GISel special in terms of how the output looks. I can see the argument but I am also wondering if we don't what to have a control on that. For instance, in SDISel, each entry in the array is on its own line and clang-format could break that.
> 
> Is that the case for many of the files that we generate? If not, maybe we can make it opt-out instead?
>  Alternatively, clang-format accepts some configuration options, is there any combination of those that would make the output of SDISel look ok when clang-formatted?

I think it's beneficial to some of them, for example MatchTable0 in the AsmMatcher is a lot easier to read after clang-format. However there's definitely some things clang-format shouldn't touch. Here's a couple examples:
AArch64GenAsmWriter.inc: AsmStrs isn't particularly readable either way but the comments are difficult to spot after clang-format
AArch64GenDAGISel.inc: Tablegen uses indentation to show the scopes but clang-format destroys this information. GlobalISel will probably end up doing something similar in the long run.

If clang-format has a way to protect certain regions then we could add the appropriate annotations and generally enable it.


https://reviews.llvm.org/D30299





More information about the llvm-commits mailing list