summaryrefslogtreecommitdiffstats
path: root/clang/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* refactor tag processing into a new ParseTag method. Share this betweenChris Lattner2007-01-251-36/+38
| | | | | | structs and enums. llvm-svn: 39298
* create field decl objects for the members of a struct/union. Diagnose codeChris Lattner2007-01-231-3/+10
| | | | | | | | | | | | | | | 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
* add callback for fields.Chris Lattner2007-01-231-6/+2
| | | | llvm-svn: 39290
* structure bodies can't get scopes.Chris Lattner2007-01-231-5/+0
| | | | llvm-svn: 39288
* simplify structure body parsing code. Reorganize how tags are processed.Chris Lattner2007-01-231-44/+64
| | | | | | | | | | | | | | 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-1/+2
| | | | | | converting a declspec with TST = struct/union. Pretty print as well. llvm-svn: 39284
* Generalize DeclSpec::TypedefRep to allow it to hold any type representation.Chris Lattner2007-01-232-3/+3
| | | | | | Use it to hold the declaration object for a struct/union. llvm-svn: 39282
* split the code for parsing a struct/union body out into its own method.Chris Lattner2007-01-231-95/+103
| | | | llvm-svn: 39281
* make file-static function be a static declspec method.Chris Lattner2007-01-231-2/+2
| | | | llvm-svn: 39280
* Make some file-static functions be static methods in the DeclSpec class.Chris Lattner2007-01-231-2/+2
| | | | llvm-svn: 39279
* There is no need for the Action::TagType enum, use DeclSpec::TST instead.Chris Lattner2007-01-231-7/+5
| | | | llvm-svn: 39278
* Finish tag processing. Since it can be shared with C++ Classes and enums,Chris Lattner2007-01-231-2/+4
| | | | | | rename it to ParseTag. llvm-svn: 39277
* When parsing a struct/union tag, we need to know whether the tag is a useChris Lattner2007-01-231-3/+11
| | | | | | | or a definition/declaration of a tag. This is required to handle C99 6.7.2.3p11 properly. llvm-svn: 39274
* LLVM now has SmallSet, use it.Chris Lattner2007-01-231-23/+10
| | | | llvm-svn: 39270
* invoke a new callback when starting to parse a struct/union tagChris Lattner2007-01-221-2/+14
| | | | llvm-svn: 39268
* Do not use ParseCompoundStatement to parse the body of a function. This causesChris Lattner2007-01-211-2/+4
| | | | | | | | 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
* Split code out of ParseCompoundStatement into ParseCompoundStatementBody.Chris Lattner2007-01-211-5/+17
| | | | | | | This fixes a bug where a missing } could cause the scope stacks to get unbalanced and will be used for function body parsing. llvm-svn: 39249
* Add support for parsing and pretty printing const_cast, dynamic_cast,Chris Lattner2006-12-043-2/+77
| | | | | | reinterpret_cast, and static_cast. Patch by Bill! llvm-svn: 39247
* add some commentsChris Lattner2006-12-041-2/+2
| | | | llvm-svn: 39242
* Scrutinize K&R parameter declarations. This implements C99 6.9.1p6, correctlyChris Lattner2006-12-032-33/+136
| | | | | | diagnosing malformed K&R function definitions. llvm-svn: 39241
* Diagnose errors like:Chris Lattner2006-12-031-3/+35
| | | | | | | | void bar(int X, int X); void blah(X, Y, X) int X, Y; {} llvm-svn: 39239
* move void argument checking from the parser to the semantic analysis stage.Chris Lattner2006-12-031-22/+0
| | | | | | | This allows us to handle typedefs of void correctly. This implements clang/test/Sema/void_arg.c llvm-svn: 39236
* Handle void correctly in the argument list for a function. For:Chris Lattner2006-12-031-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* finesse the interface to Declarator for function declarators so that theChris Lattner2006-12-021-8/+1
| | | | | | | 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
* implement AST representation for function types with and without a prototype.Chris Lattner2006-12-021-0/+5
| | | | | | | | | | | | | | | | | | | | 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-021-1/+2
| | | | llvm-svn: 39231
* Next step of retaining information about function prototypes: actually retainChris Lattner2006-12-022-34/+37
| | | | | | | | 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-022-6/+23
| | | | | | | | | 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
* doing this makes the diagnostics too verbose for no useful gain.Chris Lattner2006-11-281-2/+0
| | | | llvm-svn: 39228
* capture sourcelocation info for type specifiers. This improves diagnosticsChris Lattner2006-11-283-43/+49
| | | | | | for things like 'short _Complex'. llvm-svn: 39227
* record location info for const/volatile/restrictChris Lattner2006-11-282-7/+21
| | | | llvm-svn: 39226
* add loc info for the inline specifier, fix some fixme's by using it.Chris Lattner2006-11-282-7/+12
| | | | llvm-svn: 39225
* record accurate sourceloc info for storage class specs, so we can reportChris Lattner2006-11-283-13/+26
| | | | | | | | | | | | | | | | things like: t.c:4:10: error: invalid storage class specifier in function declarator int foo2(auto int Aaslfkasdflkj, register B); ^ instead of: t.c:4:19: error: invalid storage class specifier in function declarator int foo2(auto int Aaslfkasdflkj, register B); ^ llvm-svn: 39224
* Finish converting DeclSpec to use accessors.Chris Lattner2006-11-283-14/+23
| | | | llvm-svn: 39223
* Convert more code to use DeclSpec accessorsChris Lattner2006-11-283-9/+16
| | | | llvm-svn: 39222
* add accessors to DeclSpec, start moving clients over to use them.Chris Lattner2006-11-283-11/+6
| | | | llvm-svn: 39221
* verify C99 6.7.5.3p2Chris Lattner2006-11-281-10/+27
| | | | llvm-svn: 39219
* add some comments.Chris Lattner2006-11-211-2/+7
| | | | llvm-svn: 39217
* Implement a TODO: properly invoke actions for the * in things like:Chris Lattner2006-11-211-1/+4
| | | | | | | | where P is a pointer. int A[*P]; llvm-svn: 39199
* fix a variable shadowing issue that caused us to misparse:Chris Lattner2006-11-211-19/+19
| | | | | | | | | | void B() { memcpy (3, 2, 1); } where memcpy is undeclared. llvm-svn: 39198
* split the ParseFunctionDefinition action into two actions, one which isChris Lattner2006-11-211-1/+3
| | | | | | 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-201-8/+16
| | | | | | | | int A() { return X(); } llvm-svn: 39194
* parse identifier expressions properly. This allows us diagnose this:Chris Lattner2006-11-201-4/+9
| | | | | | | | | | | | | | | | | | | | | | | 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
* Create a new TypeNameType class, which represents typedefs as types. ThisChris Lattner2006-11-201-1/+1
| | | | | | | | | | 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-203-10/+17
| | | | | | typedef. llvm-svn: 39188
* add an action method for declspecs without declarators, like "struct foo;".Chris Lattner2006-11-192-17/+2
| | | | llvm-svn: 39184
* rename ParsedClassDeclaration -> ParsedObjcClassDeclaration.Chris Lattner2006-11-192-5/+6
| | | | llvm-svn: 39183
* build TypedefDecl objects when parsing typedefs.Chris Lattner2006-11-192-4/+11
| | | | | | Add a parsing fastpath for when we see typedef at the top-level. llvm-svn: 39182
* add an action for parsing type names.Chris Lattner2006-11-191-2/+1
| | | | llvm-svn: 39180
* rearrange the type printing code so that we can do the horrible C "inside out"Chris Lattner2006-11-131-1/+1
| | | | | | | | | thing properly. This allows us to print types like: int (*A)[restrict static 4][6]; properly, in addition to representing them properly. :) llvm-svn: 39178
OpenPOWER on IntegriCloud