[llvm] r201033 - [docs] TableGen easter egg: Multiline string literals

Sean Silva silvas at purdue.edu
Sat Feb 8 18:43:50 PST 2014


Author: silvas
Date: Sat Feb  8 20:43:50 2014
New Revision: 201033

URL: http://llvm.org/viewvc/llvm-project?rev=201033&view=rev
Log:
[docs] TableGen easter egg: Multiline string literals

They're called code fragments, but they are really multiline string
literals. Just spotted this usage in a patch by Aaron using "code
fragments" for holding documentation text. I remember someone bemoaning
the lack of multiline string literals in TableGen, so I'm explicitly
documenting that code fragments are multiline string literals.

Let it be known that any use case needing multiline string literals in
TableGen (such as descriptions of options, or whatnot) can use use
code fragments (instead of C-style string concatenation or exceedingly
long lines). E.g.

    class Bar<int n>;
    class Baz<int n>;
    class Doc<string desc> {
        string Desc = desc;
    }
    def Foo : Bar<1>, Baz<3>, Doc<[{
    This Foo is a Bar, and also a Baz. It can take 3 values:
        * Qux
        * Quux
        * Quuux
    }]>;

Modified:
    llvm/trunk/docs/TableGen/LangRef.rst

Modified: llvm/trunk/docs/TableGen/LangRef.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TableGen/LangRef.rst?rev=201033&r1=201032&r2=201033&view=diff
==============================================================================
--- llvm/trunk/docs/TableGen/LangRef.rst (original)
+++ llvm/trunk/docs/TableGen/LangRef.rst Sat Feb  8 20:43:50 2014
@@ -74,6 +74,9 @@ TableGen also has two string-like litera
    TokString: '"' <non-'"' characters and C-like escapes> '"'
    TokCodeFragment: "[{" <shortest text not containing "}]"> "}]"
 
+:token:`TokCodeFragment` is essentially a multiline string literal
+delimited by ``[{`` and ``}]``.
+
 .. note::
    The current implementation accepts the following C-like escapes::
 





More information about the llvm-commits mailing list