summaryrefslogtreecommitdiffstats
path: root/clang/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Create EnumConstantDecl objects for each enum value, and fill them intoChris Lattner2007-01-252-4/+32
| | | | | | | the EnumDecl when the enum type is complete. This allows us to detect redefinitions of enums. llvm-svn: 39300
* Add EnumDecl, warn about forward references to enums:Chris Lattner2007-01-251-4/+6
| | | | | | | | t.c:2:6: warning: ISO C forbids forward references to 'enum' types enum foo22* X; ^ llvm-svn: 39299
* Save the member list of a struct/union in the RecordDecl for the struct.Chris Lattner2007-01-251-7/+9
| | | | llvm-svn: 39297
* Enforce the rest of C99 6.7.2.1p2, emitting diagnostics like:Chris Lattner2007-01-252-10/+59
| | | | | | | | | | | | | | | | | | | | | | | | t.c:10:15: warning: 'bonk' may not be nested in a struct due to flexible array member struct bink bonk; ^ t.c:13:14: error: 'struct bink' may not be used as an array element due to flexible array member struct bink A[123]; ^ for: struct bink { struct bink *a; int X[]; // ok. }; struct foo { int A; struct bink bonk; }; struct bink A[123]; llvm-svn: 39296
* Compile:Chris Lattner2007-01-241-6/+25
| | | | | | | | | | | | | | | | | | | | | struct bork { int X[]; }; struct bink { struct bink a; int X[]; // ok. }; to: t.c:3:7: error: flexible array 'X' not allowed in otherwise empty struct int X[]; ^ t.c:7:15: error: field 'a' has incomplete type struct bink a; ^ llvm-svn: 39295
* Enforce C99 6.7.2.1p2:Chris Lattner2007-01-241-2/+24
| | | | | | | | t.c:5:8: error: field 'foo' declared as a function void foo(); ^ llvm-svn: 39294
* create field decl objects for the members of a struct/union. Diagnose codeChris Lattner2007-01-232-8/+60
| | | | | | | | | | | | | | | like: struct S { struct S {} X; }; with: t.c:2:19: error: nested redefinition of 'struct' struct S { struct S {} X; }; ^ t.c:2:1: error: previous definition is here struct S { struct S {} X; }; ^ llvm-svn: 39292
* Diagnose invalid sizeof/alignof operands.Chris Lattner2007-01-231-1/+19
| | | | llvm-svn: 39291
* simplify structure body parsing code. Reorganize how tags are processed.Chris Lattner2007-01-232-11/+32
| | | | | | | | | | | | | | Diagnose redefintion of tag types, e.g.: t.c:7:8: error: redefinition of 'blah' struct blah {}; ^ t.c:1:8: error: previous definition is here struct blah { ^ 2 diagnostics generated. llvm-svn: 39286
* Add TaggedType, which represents tagged decls as types. Create these whenChris Lattner2007-01-231-3/+11
| | | | | | converting a declspec with TST = struct/union. Pretty print as well. llvm-svn: 39284
* fix some incorrect assertionsChris Lattner2007-01-231-3/+4
| | | | llvm-svn: 39283
* Generalize DeclSpec::TypedefRep to allow it to hold any type representation.Chris Lattner2007-01-231-1/+1
| | | | | | Use it to hold the declaration object for a struct/union. llvm-svn: 39282
* There is no need for the Action::TagType enum, use DeclSpec::TST instead.Chris Lattner2007-01-232-16/+16
| | | | llvm-svn: 39278
* Finish tag processing. Since it can be shared with C++ Classes and enums,Chris Lattner2007-01-232-17/+27
| | | | | | rename it to ParseTag. llvm-svn: 39277
* Diagnose mixing of tags. For example, for:Chris Lattner2007-01-231-7/+15
| | | | | | | | | | | | | | | | 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
* When parsing a struct/union tag, we need to know whether the tag is a useChris Lattner2007-01-232-3/+19
| | | | | | | or a definition/declaration of a tag. This is required to handle C99 6.7.2.3p11 properly. llvm-svn: 39274
* Unstack identifiers more carefully when poping scope. Add assertion to ↵Chris Lattner2007-01-231-1/+18
| | | | | | | | | catch the bad case and handle identifiers in the same namespace correctly. This implements test/Parser/c-namespace.c llvm-svn: 39272
* Make name lookup properly obey C namespaces, simplify decl construction ↵Chris Lattner2007-01-221-1/+5
| | | | | | byeliminating the 'next' pointer from the ctor, and add initial support forparsing struct/union tags. llvm-svn: 39266
* Make name lookup properly obey C namespaces, simplify decl construction byChris Lattner2007-01-221-19/+57
| | | | | | | eliminating the 'next' pointer from the ctor, and add initial support for parsing struct/union tags. llvm-svn: 39265
* Change scopes to maintain decls, not identifiers.Chris Lattner2007-01-211-13/+22
| | | | | | | | | | | | | | 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
* Handle C99 6.7.5.3p10, fixing test/Parser/attributes.cChris Lattner2007-01-211-2/+10
| | | | llvm-svn: 39256
* Next big step in function parsing: create decl objects for parameters,Chris Lattner2007-01-212-9/+40
| | | | | | | inserting them into the function body scope and registering them with the corresponding FunctionDecl. llvm-svn: 39253
* Add support for parsing and pretty printing const_cast, dynamic_cast,Chris Lattner2006-12-042-0/+44
| | | | | | reinterpret_cast, and static_cast. Patch by Bill! llvm-svn: 39247
* add some commentsChris Lattner2006-12-041-3/+12
| | | | llvm-svn: 39242
* Scrutinize K&R parameter declarations. This implements C99 6.9.1p6, correctlyChris Lattner2006-12-031-0/+23
| | | | | | diagnosing malformed K&R function definitions. llvm-svn: 39241
* Enforce C99 6.7.5.3p3, rejecting code like:Chris Lattner2006-12-031-0/+5
| | | | | | void foo(void (*q)(a,b,c)) {} llvm-svn: 39240
* Diagnose errors like:Chris Lattner2006-12-031-5/+5
| | | | | | | | void bar(int X, int X); void blah(X, Y, X) int X, Y; {} llvm-svn: 39239
* reject int(const void).Chris Lattner2006-12-031-0/+4
| | | | llvm-svn: 39238
* move void argument checking from the parser to the semantic analysis stage.Chris Lattner2006-12-031-3/+27
| | | | | | | This allows us to handle typedefs of void correctly. This implements clang/test/Sema/void_arg.c llvm-svn: 39236
* implement AST representation for function types with and without a prototype.Chris Lattner2006-12-021-1/+19
| | | | | | | | | | | | | | | | | | | | 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
* implement ParseParamDeclaratorType in the ast builderChris Lattner2006-12-022-0/+14
| | | | llvm-svn: 39231
* Next step of retaining information about function prototypes: actually retainChris Lattner2006-12-022-6/+6
| | | | | | | | 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
* First step towards accurately retaining information about functionChris Lattner2006-12-021-1/+1
| | | | | | | | | 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
* capture sourcelocation info for type specifiers. This improves diagnosticsChris Lattner2006-11-281-1/+1
| | | | | | for things like 'short _Complex'. llvm-svn: 39227
* Finish converting DeclSpec to use accessors.Chris Lattner2006-11-282-14/+17
| | | | llvm-svn: 39223
* Convert more code to use DeclSpec accessorsChris Lattner2006-11-281-1/+1
| | | | llvm-svn: 39222
* add accessors to DeclSpec, start moving clients over to use them.Chris Lattner2006-11-281-3/+3
| | | | llvm-svn: 39221
* When a decl is popped from its current scope, link it to the decl chain forChris Lattner2006-11-211-5/+10
| | | | | | the containing function. This avoids leaking decls. llvm-svn: 39197
* split the ParseFunctionDefinition action into two actions, one which isChris Lattner2006-11-212-9/+26
| | | | | | called before and one which is called after function definition parsing. llvm-svn: 39196
* Add support for C90 implicitly defined functions, e.g.:Chris Lattner2006-11-204-7/+62
| | | | | | | | int A() { return X(); } llvm-svn: 39194
* remember referenced decls in our AST'sChris Lattner2006-11-201-2/+1
| | | | llvm-svn: 39193
* parse identifier expressions properly. This allows us diagnose this:Chris Lattner2006-11-202-12/+26
| | | | | | | | | | | | | | | | | | | | | | | typedef int X; int A() { return X; } int B() { return Y; } as: /Users/sabre/test.c:5:10: error: unexpected type name 'X': expected expression return X; ^ /Users/sabre/test.c:9:10: error: use of undeclared 'Y' value return Y; ^ llvm-svn: 39192
* remember and pretty-print cast typesChris Lattner2006-11-203-3/+10
| | | | llvm-svn: 39191
* correctly handle stuff like:Chris Lattner2006-11-201-2/+2
| | | | | | | | typedef int G; X = sizeof(const G); X = sizeof(restrict G); llvm-svn: 39190
* Create a new TypeNameType class, which represents typedefs as types. ThisChris Lattner2006-11-201-4/+12
| | | | | | | | | | allows us to handle stuff like: typedef int G; .. X = sizeof(G); llvm-svn: 39189
* when a typedef name is parsed as part of declspecs, remember the decl for theChris Lattner2006-11-202-4/+3
| | | | | | typedef. llvm-svn: 39188
* decls should all have typesChris Lattner2006-11-191-5/+4
| | | | llvm-svn: 39187
* remove #include of clang/Parse/DeclSpec.h from clang/AST/Decl.hChris Lattner2006-11-192-5/+5
| | | | llvm-svn: 39186
* implement RTTI for Decl objects, eliminate some hokey virtual methods.Chris Lattner2006-11-191-5/+7
| | | | llvm-svn: 39185
* add an action method for declspecs without declarators, like "struct foo;".Chris Lattner2006-11-192-1/+20
| | | | llvm-svn: 39184
OpenPOWER on IntegriCloud