[cfe-commits] FW: [PATCH] Fix tag decls/enum constants in function prototypes

James Molloy james.molloy at arm.com
Thu Jan 26 01:50:32 PST 2012


Ping ^ 2

-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu
[mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of James Molloy
Sent: 20 January 2012 14:42
To: cfe-commits at cs.uiuc.edu
Subject: [cfe-commits] FW: [PATCH] Fix tag decls/enum constants in function
prototypes

Ping!

-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu
[mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of James Molloy
Sent: 18 January 2012 15:56
To: cfe-commits at cs.uiuc.edu
Cc: juli at clockworksquid.com; ken.dyck at onsemi.com
Subject: [cfe-commits] [PATCH] Fix tag decls/enum constants in function
prototypes

Hi,

Attached is a patch that fixes PR5477 and PR5464
(http://llvm.org/bugs/show_bug.cgi?id=5477 ,
http://llvm.org/bugs/show_bug.cgi?id=5464).

The problem is ensuring tags and enum constants that are created as part of
a function prototype end up in the scope of the function definition, and
ensuring that they do not incorrectly conflict with identifiers in the
global scope. E.g.:

Const int AA = 5;
int f (enum {AA, BB} e) {
  Return AA;
}

Clang currently errors out: test.c:2:15: error: redefinition of 'AA'

The patch attached fixes this, and more complex examples such as:

struct a {
    struct b {
        int j;
    } b;
};

int foo(struct a { struct b { int j; } b; struct b { char glorx; } glorx; }
*);

It introduces some statefulness into Sema, but it appears that Sema is
already stateful so I hope that won't be a problem.

Could someone please review it? (some code taken from the current patch at
PR5464)

Cheers,

James
 







More information about the cfe-commits mailing list