Index: lang/c/anonymous/TestAnonymous.py
===================================================================
--- lang/c/anonymous/TestAnonymous.py	(revision 179756)
+++ lang/c/anonymous/TestAnonymous.py	(working copy)
@@ -11,29 +11,64 @@
     mydir = os.path.join("lang", "c", "anonymous")
 
     @dsym_test
-    def test_expr_with_dsym(self):
+    def test_expr_nest_with_dsym(self):
         self.buildDsym()
-        self.expr()
+        self.expr_nest()
 
+    @dsym_test
+    def test_expr_child_with_dsym(self):
+        self.buildDsym()
+        self.expr_child()
+
+    @dsym_test
+    def test_expr_grandchild_with_dsym(self):
+        self.buildDsym()
+        self.expr_grandchild()
+
+    @dsym_test
+    def test_expr_parent(self):
+        self.buildDsym()
+        self.expr_parent()
+
     @skipIfGcc # llvm.org/pr15036: LLDB is unable to parse DWARF generated by GCC
     @skipIfIcc # llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC
     @dwarf_test
-    def test_expr_with_dwarf(self):
+    def test_expr_nest_with_dwarf(self):
         self.buildDwarf()
-        self.expr()
+        self.expr_nest()
 
+    @skipOnLinux # llvm.org/pr15036: LLDB is unable to parse DWARF
+    @dwarf_test
+    def test_expr_child_with_dwarf(self):
+        self.buildDwarf()
+        self.expr_child()
+
+    @expectedFailureGcc # llvm.org/pr15036: LLDB is unable to parse DWARF
+    @expectedFailureIcc # llvm.org/pr15036: LLDB is unable to parse DWARF
+    @dwarf_test
+    def test_expr_grandchild_with_dwarf(self):
+        self.buildDwarf()
+        self.expr_grandchild()
+
+    @dwarf_test
+    def test_expr_parent(self):
+        self.buildDwarf()
+        self.expr_parent()
+
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
-        # Find the line number to break inside main().
-        self.line = line_number('main.c', '// Set breakpoint 0 here.')
+        # Find the line numbers to break in main.c.
+        self.line0 = line_number('main.c', '// Set breakpoint 0 here.')
+        self.line1 = line_number('main.c', '// Set breakpoint 1 here.')
+        self.line2 = line_number('main.c', '// Set breakpoint 2 here.')
 
-    def common_setup(self):
+    def common_setup(self, line):
         exe = os.path.join(os.getcwd(), "a.out")
         self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
 
-        # Break inside the foo function which takes a bar_ptr argument.
-        lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+        # Set breakpoints inside and outside methods that take pointers to the containing struct.
+        lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -46,16 +81,56 @@
         self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
             substrs = [' resolved, hit count = 1'])
 
-    def expr(self):
-        self.common_setup()
+    def expr_nest(self):
+        self.common_setup(self.line0)
 
-        # This should display correctly.
+        # These should display correctly.
+        self.expect("expression n->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 4"])
+            
+        self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 2"])
+
+    def expr_child(self):
+        self.common_setup(self.line1)
+
+        # These should display correctly.
         self.expect("expression c->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 4"])
             
-        self.expect("expression c->b", VARIABLES_DISPLAYED_CORRECTLY,
+        self.expect("expression c->grandchild.b", VARIABLES_DISPLAYED_CORRECTLY,
             substrs = ["= 2"])
 
+        self.expect("expression z", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["dummy = 2"])
+
+    def expr_grandchild(self):
+        self.common_setup(self.line2)
+
+        # These should display correctly.
+        self.expect("expression g.child.foo.d", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 4"])
+            
+        self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["= 2"])
+
+    def expr_parent(self):
+        self.common_setup(self.line2)
+
+        # These should display correctly.
+        self.expect("expression pz", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["(type_z *) $0 = 0x0000"])
+
+        self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY,
+            substrs = ["(type_y) $1 = {"])
+
+        # This should fail because pz is 0.
+        self.expect("expression *(type_z *)pz",
+            substrs = ["Couldn't dematerialize struct"], error = True)
+
+
+
+
 if __name__ == '__main__':
     import atexit
     lldb.SBDebugger.Initialize()
Index: lang/c/anonymous/main.c
===================================================================
--- lang/c/anonymous/main.c	(revision 179756)
+++ lang/c/anonymous/main.c	(working copy)
@@ -1,28 +1,82 @@
 #include <stdio.h>
 
-struct container {
+struct anonymous_nest {
   struct {
     struct {
       int a;
       int b;
-    };
+    }; // anonymous
     struct {
       int c;
       int d;
     } foo;
-  };
+  }; // anonymous
 };
 
-int processor (struct container *c)
+struct anonymous_child {
+  struct {
+    struct {
+      int a;
+      int b;
+    } grandchild;
+    struct {
+      int c;
+      int d;
+    } foo;
+  }; // anonymous
+};
+
+struct anonymous_grandchild {
+  struct {
+    struct {
+      int a;
+      int b;
+    }; // anonymous
+    struct {
+      int c;
+      int d;
+    } foo;
+  } child;
+};
+
+int processor_nest (struct anonymous_nest *n)
 {
-  return c->foo.d + c->b; // Set breakpoint 0 here.
+  return n->foo.d + n->b; // Set breakpoint 0 here.
 }
 
+int processor_child (struct anonymous_child *c)
+{
+  return c->foo.d + c->grandchild.b; // Set breakpoint 1 here.
+}
+
+int processor_grandchild (struct anonymous_grandchild *g)
+{
+  return g->child.foo.d + g->child.b;
+}
+
+
+
+typedef struct {
+    int dummy;
+} type_y;
+
+typedef struct {
+    type_y y;
+} type_z;
+
+
+
 int main()
 {
-  struct container c = { 0, 2, 0, 4 };
-  
-  printf("%d\n", processor(&c));
+  struct anonymous_nest n = { 0, 2, 0, 4 };
+  struct anonymous_child c = { 0, 2, 0, 4 };
+  struct anonymous_grandchild g = { 0, 2, 0, 4 };
+  type_z *pz = 0;
+  type_z z = {{2}};
 
+  printf("%d\n", processor_nest(&n));
+  printf("%d\n", processor_child(&c));
+  printf("%d\n", processor_grandchild(&g)); // Set breakpoint 2 here.
+
   return 0;
 }
