[cfe-dev] dump-record-layouts output inconsistent ?

Jan Smets via cfe-dev cfe-dev at lists.llvm.org
Tue Jul 18 07:57:46 PDT 2017


Hi list

I have noticed that the dumped record layouts aren't always consistent
with other output of that same dump.

The following examples below should hopefully make clear what I mean.

Is this expected or should I file a bug report for it?

Please keep me in CC as I'm not subscribed to the list.

Thank you



typedef struct {
    struct {
        int tFilterParamsPCount;
        int tFilterParamsBCount;
    } egress;
    struct {
        int tFilterParamsPCount;
        int tFilterParamsBCount;
    } ingress;
} tFltrParamsStats;

typedef struct bla {
    tFltrParamsStats bla;
};


*** Dumping AST Record Layout
         0 | struct (anonymous at /tmp/test.c:2:5)
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               ^========== should be "struct
tFltrParamsStats::(anonymous at /tmp/test.c:2:5)" ???

         0 |   int tFilterParamsPCount
         4 |   int tFilterParamsBCount
           | [sizeof=8, align=4]

*** Dumping AST Record Layout
         0 | struct tFltrParamsStats::(anonymous at /tmp/test.c:6:5)
         0 |   int tFilterParamsPCount
         4 |   int tFilterParamsBCount
           | [sizeof=8, align=4]

*** Dumping AST Record Layout
         0 | tFltrParamsStats
         0 |   struct tFltrParamsStats::(anonymous at /tmp/test.c:2:5) egress
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  ^=== should match this

         0 |     int tFilterParamsPCount
         4 |     int tFilterParamsBCount
         8 |   struct tFltrParamsStats::(anonymous at /tmp/test.c:6:5) ingress
         8 |     int tFilterParamsPCount
        12 |     int tFilterParamsBCount
           | [sizeof=16, align=4]


And


typedef struct tEECardPllData32B
{
    char version;
    struct
    {
        char pll;
        int frequency;
    } d[16];
} tEECardPllData32B;

typedef struct bla2 {
    tEECardPllData32B bla;
};


*** Dumping AST Record Layout
         0 | struct tEECardPllData32B::(anonymous at /tmp/test.c:22:5)
         0 |   char pll
         4 |   int frequency
           | [sizeof=8, align=4]

*** Dumping AST Record Layout
         0 | struct tEECardPllData32B
         0 |   char version
         4 |   struct (anonymous struct at /tmp/test.c:22:5) [16] d
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                ^======== This again is different. It's "anonymous
struct" instead of "anonymous".
                          Also here it could/should be 'struct
tEECardPllData32B::(anonymous at /tmp/test.c:22:5)'

           | [sizeof=132, align=4]


-- 
Smets Jan
jan at smets.cx



More information about the cfe-dev mailing list