]> granicus.if.org Git - clang/commit
Add global static variables for anonymous union fields. This makes
authorEric Christopher <echristo@gmail.com>
Thu, 10 Apr 2014 05:20:00 +0000 (05:20 +0000)
committerEric Christopher <echristo@gmail.com>
Thu, 10 Apr 2014 05:20:00 +0000 (05:20 +0000)
commit993b99c22e182b24e042cc8281d899987e11d337
treebe28238ab938107eec67615342d31ac276668870
parentc38f186f229b37875b73ecd4c1d44d62c38bc354
Add global static variables for anonymous union fields. This makes
sure that a debugger can find them when stepping through code,
for example from the included testcase:

   12     int test_it() {
   13       c = 1;
   14       d = 2;
-> 15       a = 4;
   16       return (c == 1);
   17     }
   18
(lldb) p a
(int) $0 = 2
(lldb) p c
(int) $1 = 2
(lldb) p d
(int) $2 = 2

and a, c, d are all part of the file static anonymous union:

static union {
  int c;
  int d;
  union {
    int a;
  };
  struct {
    int b;
  };
};

Fixes PR19221.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205952 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGDebugInfo.h
test/CodeGenCXX/debug-info-anon-union-vars.cpp [new file with mode: 0644]