summaryrefslogtreecommitdiffstats
path: root/clang/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* When injecting a definition for implicitly defined functions, do so atChris Lattner2007-01-281-4/+8
| | | | | | | translation-unit scope, so we only warn about each implicitly defined function once. This cuts the number of errors parsing carbon.h from 616 to 550. llvm-svn: 39325
* Start doing trivial merging of function prototypes. If we have a functionChris Lattner2007-01-271-2/+6
| | | | | | | proto, then a function body, and they have the same type, don't emit an error. This reduces #errors from 654->616 llvm-svn: 39324
* Add some better diagnostics for things like:Chris Lattner2007-01-271-3/+33
| | | | | | | int foo; int foo(); llvm-svn: 39323
* Refactor conflict handling code, no functionality change.Chris Lattner2007-01-272-22/+78
| | | | llvm-svn: 39322
* Eliminate the last of the slow lookups, by making non-prototyped function typesChris Lattner2007-01-272-23/+19
| | | | | | | use the folding set. This eliminates 359 slow lookups from carbon.h (the rest) but doesn't substantially speed up parse. llvm-svn: 39320
* Switch arraytypes over to using a FoldingSet instead of a stupid linearChris Lattner2007-01-272-13/+24
| | | | | | | search. This reduces 'dumb' lookups from 1225 to 359, speeding up parse of carbon.h from 0.173 to 0.156s (10%). llvm-svn: 39319
* Fix test/Parser/argument_qualified.cChris Lattner2007-01-271-1/+3
| | | | llvm-svn: 39316
* adjust to change in SmallSet interfaceChris Lattner2007-01-271-2/+1
| | | | llvm-svn: 39313
* Switch pointers over to using a FoldingSet to unique them instead ofChris Lattner2007-01-272-9/+20
| | | | | | | | "obviously braindead" linear searches. reduces the number of slow type lookups from 10K to 883 on carbon.h, speeding up parsing from 3.5 to 1.26s. llvm-svn: 39312
* Eliminate "obviously braindead" canonicalization of function types, usingChris Lattner2007-01-272-19/+23
| | | | | | | a foldingset instead. This reduces the number of slow type lookups from 32K to 10K, which speeds up parsing of carbon.h from 11s to 3.5s. llvm-svn: 39311
* Use a cache in TypedefDecl to make ASTContext::getTypedefType trivial.Chris Lattner2007-01-261-10/+3
| | | | | | | This speeds up parsing carbon.h from 16.0s to 11.3s, reducing slow lookups from 63K to 32K. llvm-svn: 39308
* rename some classes, no functionality changes.Chris Lattner2007-01-265-10/+10
| | | | llvm-svn: 39307
* TagDecl now holds a cache for the type corresponding to it. This speeds upChris Lattner2007-01-261-10/+3
| | | | | | | | ASTContext::getTagDeclType by not having to do a linear search. With this, parse time for carbon.h drops from 21.8s to 16.0s and # slow lookups drop from 83K to 63K. llvm-svn: 39306
* start gather stats on types processed. carbon.h currently yields:Chris Lattner2007-01-262-31/+104
| | | | | | | | | | | | | | | | | | | | | *** AST Context Stats: 30594 types total. 19 builtin types 3929 pointer types 308 array types 18883 function types with proto 8 function types with no proto 2988 typename (typedef) types 4459 tagged types 1476 struct types 80 union types 0 class types 2903 enum types 83298 slow type lookups Next up, making type canonicalization not trivially silly. llvm-svn: 39305
* Don't crash if GetTypeForDeclarator can't grok a type.Chris Lattner2007-01-251-9/+16
| | | | llvm-svn: 39304
* Reject:Chris Lattner2007-01-251-1/+20
| | | | | | | | | | | | | | | struct q { int a, a; }; with: t.c:3:19: error: duplicate member 'a' struct q { int a, a; }; ^ t.c:3:16: error: previous definition is here struct q { int a, a; }; ^ llvm-svn: 39303
* Register enumconstantdecls in their appropriate scope and check for conflicts.Chris Lattner2007-01-251-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | This emits these diagnostics: t.c:4:14: error: redefinition of 'a' enum foo22 { a, b }; ^ t.c:3:5: error: previous definition is here int a; ^ t.c:8:17: error: redefinition of enumerator 'b' enum foo23 { c, b }; ^ t.c:4:17: error: previous definition is here enum foo22 { a, b }; ^ 4 diagnostics generated. for: int a; enum foo22 { a, b }; enum foo23 { c, b }; llvm-svn: 39302
* Create EnumConstantDecl objects for each enum value, and fill them intoChris Lattner2007-01-253-4/+47
| | | | | | | 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-252-9/+11
| | | | | | | | 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-252-7/+23
| | | | llvm-svn: 39297
* Enforce the rest of C99 6.7.2.1p2, emitting diagnostics like:Chris Lattner2007-01-253-10/+66
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Add Type::isIncompleteType, which implements the algorithm described inChris Lattner2007-01-231-0/+23
| | | | | | C99 6.2.5. llvm-svn: 39289
* 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-233-9/+44
| | | | | | 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-222-2/+6
| | | | | | 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
* make Decl::getName() not crash if the decl is unnamed (e.g. an unnamed argument)Chris Lattner2007-01-211-1/+3
| | | | llvm-svn: 39260
* 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
* avoid allocating memory for empty arg listsChris Lattner2007-01-211-2/+5
| | | | llvm-svn: 39255
* Next big step in function parsing: create decl objects for parameters,Chris Lattner2007-01-213-9/+57
| | | | | | | 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-045-4/+64
| | | | | | 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
* implement a fixme: make BuiltinType have an enum, specifying which type it is,Chris Lattner2006-12-032-27/+50
| | | | | | instead of having a string. llvm-svn: 39237
* move void argument checking from the parser to the semantic analysis stage.Chris Lattner2006-12-032-3/+35
| | | | | | | This allows us to handle typedefs of void correctly. This implements clang/test/Sema/void_arg.c llvm-svn: 39236
OpenPOWER on IntegriCloud