struct blah * P;
union blah *P2;
we now emit:
t.c:2:1: error: redefinition of 'blah' with tag that does not match previous use
union blah *P2;
^
t.c:1:8: error: previous use is here
struct blah * P;
^
llvm-svn: 39275
- Add support for getting the namespace of a decl.
- Move type down the inheritance hierarchy, it doesn't make sense for a struct
to have a type, and typedef's use types in different ways than variables do.
- Add initial TagDecl/RecordDecl classes.
llvm-svn: 39267
Detect and emit errors when names are redefined in the same scope, e.g.
test/Parser/argument_redef.c, which now emits:
argument_redef.c:4:22: error: redefinition of 'A'
int foo(int A) { int A; }
^
argument_redef.c:4:13: error: previous definition is here
int foo(int A) { int A; }
^
llvm-svn: 39257
an extra scope stack to be pushed between the function body and arguments, which
causes the parser to incorrectly accept stuff like 'int foo(int A) { int A; }',
which is test/Parser/argument_redef.c.
llvm-svn: 39252
X = sizeof(int (void a));
X = sizeof(int (int, void));
X = sizeof(int (void, ...));
We now emit:
t.c:6:24: error: void argument may not have a name
X = sizeof(int (void a));
^
t.c:7:24: error: 'void' must be the first and only parameter if specified
X = sizeof(int (int, void));
^
t.c:8:19: error: 'void' must be the first and only parameter if specified
X = sizeof(int (void, ...));
^
And we pretty print this correctly (even though void isn't stored in the
arg list of the function type):
X = sizeof(int (void));
However, this approach will have to change to handle typedefs of void.
llvm-svn: 39235
declarator interface handles all alloc/dealloc issues related to the argument
list. Before the client had to alloc and Declarator did the dealloc.
llvm-svn: 39234
This lets us pretty print stuff like this:
void foo() {
int X;
X = sizeof(void (*(*)())());
X = sizeof(int(*)(int, float, ...));
X = sizeof(void (*(int arga, void (*argb)(double Y)))(void* Z));
as:
X = sizeof(void (*(*)())())
X = sizeof(int (*)(int, float, ...))
X = sizeof(void (*(int, void (*)(double)))(void *))
Ah the wonders of 'modern' C syntax!
llvm-svn: 39232
the info. Also, call Actions.ParseParamDeclaratorType instead of
Actions.ParseDeclarator for parameter type lists: we don't want declaration
objects created when parsing a function declarator, we just want type info.
llvm-svn: 39230
parameters: build an array of ParamInfo structures and pass it to the
declarator for safe keeping (it owns the list).
Next step: actually populate the arg array with useful stuff.
llvm-svn: 39229