[PATCH] TableGen backend to generate an index in ctags(1) format.

Sean Silva silvas at purdue.edu
Tue Mar 19 08:45:05 PDT 2013



================
Comment at: utils/TableGen/CTagsEmitter.cpp:10
@@ +9,3 @@
+//
+// This tablegen backend emits an index of definitions in ctags(1) format.
+//
----------------
Cross-reference the helper script here.

================
Comment at: utils/TableGen/tdtags:1-18
@@ +1,19 @@
+#!/bin/sh
+#===-- tdtabs - TableGen tags wrapper ---------------------------*- sh -*-===#
+# vim:set sts=2 sw=2 et:
+#===----------------------------------------------------------------------===#
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+#===----------------------------------------------------------------------===#
+#
+# This is a wrapper script to simplify generating ctags(1)-compatible index
+# files for target .td files. Run tdtags -H for more documentation.
+#
+# For portability, this script is intended to conform to IEEE Std 1003.1-2008.
+#
+#===----------------------------------------------------------------------===#
+
----------------
TBQH this is probably the best example of shell scripting I've ever seen (i.e. it's very readable and organized). I honestly wish I could code shell like this.

Despite that, as far as maintainability is concerned, I really don't think that shell is the best language for this script. Pragmatically, I wouldn't trust myself to maintain this file and uphold the same code quality that you have set forth here. Are you familiar enough with Python to write this in Python? For these kinds of scripts, Python seems to be the de facto choice for LLVM. Additionally, Python is, broadly speaking, more portable than shell (for example, Python's platform abstraction extends to Windows as well, while shell is not a "first class citizen" there).

I'd like to emphasize that this script is masterfully written. My concern is that writing correct and robust shell is somewhat of a black art, which hampers the maintainability. I would be glad to point you in the right direction (which API's are best to use, etc.) for a Python script if you aren't familiar.


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



More information about the llvm-commits mailing list