TableGen: some LangRef doc fixes

Summary: Change-Id: I1442e2daa09cab727a01d8c31893b50e644a5cd3

Reviewers: tra, simon_tatham, craig.topper

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D47530

Change-Id: I397655dd18b7ff978c1affa3174740d9c1a82594
llvm-svn: 333901
diff --git a/llvm/docs/TableGen/LangIntro.rst b/llvm/docs/TableGen/LangIntro.rst
index b77dad0..ea46550 100644
--- a/llvm/docs/TableGen/LangIntro.rst
+++ b/llvm/docs/TableGen/LangIntro.rst
@@ -152,8 +152,8 @@
 ``foreach <var> = [ <list> ] in <def>``
     Replicate <body> or <def>, replacing instances of <var> with each value
     in <list>.  <var> is scoped at the level of the ``foreach`` loop and must
-    not conflict with any other object introduced in <body> or <def>.  Currently
-    only ``def``\s are expanded within <body>.
+    not conflict with any other object introduced in <body> or <def>.  Only
+    ``def``\s and ``defm``\s are expanded within <body>.
 
 ``foreach <var> = 0-15 in ...``
 
@@ -348,6 +348,23 @@
 despite the fact that it derives (indirectly) from the ``C`` class, because the
 ``D`` class overrode its value.
 
+References between variables in a record are substituted late, which gives
+``let`` expressions unusual power. Consider this admittedly silly example:
+
+.. code-block:: text
+
+  class A<int x> {
+    int Y = x;
+    int Yplus1 = !add(Y, 1);
+    int xplus1 = !add(x, 1);
+  }
+  def Z : A<5> {
+    let Y = 10;
+  }
+
+The value of ``Z.xplus1`` will be 6, but the value of ``Z.Yplus1`` is 11. Use
+this power wisely.
+
 .. _template arguments:
 
 Class template arguments