Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Handle void correctly in the argument list for a function. For: | Chris Lattner | 2006-12-03 | 1 | -0/+3 | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 | |||||
* | implement AST representation for function types with and without a prototype. | Chris Lattner | 2006-12-02 | 3 | -2/+135 | |
| | | | | | | | | | | | | | | | | | | | | 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 builder | Chris Lattner | 2006-12-02 | 2 | -0/+14 | |
| | | | | llvm-svn: 39231 | |||||
* | Next step of retaining information about function prototypes: actually retain | Chris Lattner | 2006-12-02 | 2 | -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 function | Chris Lattner | 2006-12-02 | 1 | -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 diagnostics | Chris Lattner | 2006-11-28 | 1 | -1/+1 | |
| | | | | | | for things like 'short _Complex'. llvm-svn: 39227 | |||||
* | Finish converting DeclSpec to use accessors. | Chris Lattner | 2006-11-28 | 2 | -14/+17 | |
| | | | | llvm-svn: 39223 | |||||
* | Convert more code to use DeclSpec accessors | Chris Lattner | 2006-11-28 | 1 | -1/+1 | |
| | | | | llvm-svn: 39222 | |||||
* | add accessors to DeclSpec, start moving clients over to use them. | Chris Lattner | 2006-11-28 | 1 | -3/+3 | |
| | | | | llvm-svn: 39221 | |||||
* | When a decl is popped from its current scope, link it to the decl chain for | Chris Lattner | 2006-11-21 | 1 | -5/+10 | |
| | | | | | | the containing function. This avoids leaking decls. llvm-svn: 39197 | |||||
* | split the ParseFunctionDefinition action into two actions, one which is | Chris Lattner | 2006-11-21 | 2 | -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 Lattner | 2006-11-20 | 4 | -7/+62 | |
| | | | | | | | | int A() { return X(); } llvm-svn: 39194 | |||||
* | remember referenced decls in our AST's | Chris Lattner | 2006-11-20 | 2 | -4/+3 | |
| | | | | llvm-svn: 39193 | |||||
* | parse identifier expressions properly. This allows us diagnose this: | Chris Lattner | 2006-11-20 | 3 | -12/+31 | |
| | | | | | | | | | | | | | | | | | | | | | | | 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 types | Chris Lattner | 2006-11-20 | 4 | -6/+13 | |
| | | | | llvm-svn: 39191 | |||||
* | correctly handle stuff like: | Chris Lattner | 2006-11-20 | 3 | -4/+10 | |
| | | | | | | | | typedef int G; X = sizeof(const G); X = sizeof(restrict G); llvm-svn: 39190 | |||||
* | Create a new TypeNameType class, which represents typedefs as types. This | Chris Lattner | 2006-11-20 | 3 | -5/+36 | |
| | | | | | | | | | | 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 the | Chris Lattner | 2006-11-20 | 2 | -4/+3 | |
| | | | | | | typedef. llvm-svn: 39188 | |||||
* | decls should all have types | Chris Lattner | 2006-11-19 | 1 | -5/+4 | |
| | | | | llvm-svn: 39187 | |||||
* | remove #include of clang/Parse/DeclSpec.h from clang/AST/Decl.h | Chris Lattner | 2006-11-19 | 2 | -5/+5 | |
| | | | | llvm-svn: 39186 | |||||
* | implement RTTI for Decl objects, eliminate some hokey virtual methods. | Chris Lattner | 2006-11-19 | 1 | -5/+7 | |
| | | | | llvm-svn: 39185 | |||||
* | add an action method for declspecs without declarators, like "struct foo;". | Chris Lattner | 2006-11-19 | 2 | -1/+20 | |
| | | | | llvm-svn: 39184 | |||||
* | build TypedefDecl objects when parsing typedefs. | Chris Lattner | 2006-11-19 | 3 | -22/+45 | |
| | | | | | | Add a parsing fastpath for when we see typedef at the top-level. llvm-svn: 39182 | |||||
* | Parse and remember types enough that we can pretty print: | Chris Lattner | 2006-11-19 | 4 | -4/+17 | |
| | | | | | | | | | | | | | | void foo(int X) { X = __alignof(int); X = sizeof(const int** restrict ** volatile*); } as: x = __alignof(int) x = sizeof(int const **restrict **volatile *) llvm-svn: 39181 | |||||
* | add an action for parsing type names. | Chris Lattner | 2006-11-19 | 1 | -2/+1 | |
| | | | | llvm-svn: 39180 | |||||
* | rearrange the type printing code so that we can do the horrible C "inside out" | Chris Lattner | 2006-11-13 | 2 | -16/+32 | |
| | | | | | | | | | 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 | |||||
* | change print methods to render into a string, which is more useful for ↵ | Chris Lattner | 2006-11-13 | 1 | -25/+26 | |
| | | | | | | | | diagnostics and for handling precedence of types more accurately llvm-svn: 39177 | |||||
* | Implement parsing, printing and AST'ing of array types (except for the bounds). | Chris Lattner | 2006-11-12 | 3 | -19/+76 | |
| | | | | | | | | | | This allows us to handle: int (*A)[restrict static 4][6]; for example. llvm-svn: 39176 | |||||
* | Implement and use isa/dyncast/cast etc for Type classes. | Chris Lattner | 2006-11-12 | 1 | -2/+2 | |
| | | | | llvm-svn: 39175 | |||||
* | Teach ASTContext to delete all created types in its dtor. | Chris Lattner | 2006-11-12 | 2 | -23/+43 | |
| | | | | | | | Teach getPointerType to (stupidly) memoize all created pointers. Give types an enum so we can implement classof. llvm-svn: 39174 | |||||
* | Build ASTs for the pointer qualifiers on declarators. This allows us to | Chris Lattner | 2006-11-12 | 4 | -66/+100 | |
| | | | | | | | | | | parse (and print) things like: int* const* restrict* const volatile*** etc. llvm-svn: 39173 | |||||
* | We can now parse and remember the distinction between: | Chris Lattner | 2006-11-12 | 1 | -2/+2 | |
| | | | | | | | | 'unsigned char' and 'unsigned char const'. -Chris llvm-svn: 39172 | |||||
* | implement conversion of simple declspec base types, and implement TypeRef::dump | Chris Lattner | 2006-11-11 | 3 | -1/+89 | |
| | | | | llvm-svn: 39170 | |||||
* | restructure code to build the framework for creating types from declarators. | Chris Lattner | 2006-11-11 | 5 | -49/+117 | |
| | | | | llvm-svn: 39166 | |||||
* | add the builtin types | Chris Lattner | 2006-11-10 | 1 | -0/+49 | |
| | | | | llvm-svn: 39164 | |||||
* | Let ASTContext hold target info, since it's useful | Chris Lattner | 2006-11-10 | 2 | -2/+23 | |
| | | | | llvm-svn: 39162 | |||||
* | introduce a new ASTContext class to hold long-lived ast nodes. | Chris Lattner | 2006-11-10 | 5 | -26/+25 | |
| | | | | llvm-svn: 39161 | |||||
* | move the rest of the expr sema to SemaExpr.cpp and the decl processing stuff | Chris Lattner | 2006-11-10 | 4 | -235/+233 | |
| | | | | | | to SemaDecl.cpp llvm-svn: 39159 | |||||
* | move semantic analysis of break/continue out of the parser into the sema class. | Chris Lattner | 2006-11-10 | 3 | -4/+36 | |
| | | | | llvm-svn: 39157 | |||||
* | move semantic analysis of statements to it's own file. | Chris Lattner | 2006-11-10 | 2 | -91/+106 | |
| | | | | llvm-svn: 39156 | |||||
* | split semantic analysis of expressions out to its own file | Chris Lattner | 2006-11-10 | 2 | -220/+239 | |
| | | | | llvm-svn: 39155 | |||||
* | move ASTBuilder.h/cpp to be a private Sema.h/cpp files, not part of the | Chris Lattner | 2006-11-10 | 2 | -5/+5 | |
| | | | | | | interface exported by libast. llvm-svn: 39154 | |||||
* | rename ASTBuilder to Sema | Chris Lattner | 2006-11-09 | 3 | -71/+63 | |
| | | | | llvm-svn: 39153 | |||||
* | Change courses on how we do semantic analysis. Semantic analysis | Chris Lattner | 2006-11-09 | 3 | -13/+241 | |
| | | | | | | | | fundamentally requires having an AST around, so move all sema to the AST library. This is the first step, later steps will be needed to clean up libast. llvm-svn: 39150 | |||||
* | pretty print postfix ++/-- nicer | Chris Lattner | 2006-11-05 | 2 | -5/+20 | |
| | | | | llvm-svn: 39137 | |||||
* | start factoring actions into two flavors: minimal and semantic actions. | Chris Lattner | 2006-11-05 | 1 | -1/+1 | |
| | | | | llvm-svn: 39133 | |||||
* | print indirect goto correctly | Chris Lattner | 2006-11-05 | 1 | -1/+1 | |
| | | | | llvm-svn: 39122 | |||||
* | build ast nodes and print goto/goto*/break/continue. | Chris Lattner | 2006-11-05 | 3 | -7/+57 | |
| | | | | llvm-svn: 39121 | |||||
* | Add ast node support for case/default/label stmts. | Chris Lattner | 2006-11-05 | 3 | -1/+52 | |
| | | | | llvm-svn: 39120 | |||||
* | implement AST node for switch stmt | Chris Lattner | 2006-11-04 | 3 | -22/+17 | |
| | | | | llvm-svn: 39119 |