Chris Lattner
19dbcaa171
pull the casting operators into LLVM.h
...
Swift SVN r421
2011-07-19 05:57:01 +00:00
Chris Lattner
e647b29339
stop the llvm-namespace-qualification-insanity by caving in and
...
adding a new swift/AST/LLVM.h file which forward declares and imports
common llvm classes, starting with SMLoc.
Swift SVN r420
2011-07-19 05:49:43 +00:00
Chris Lattner
de094d7cde
Introduce i1/i8/i16/i64 types, and switch int to be 64-bit.
...
Swift SVN r390
2011-05-31 03:48:36 +00:00
Chris Lattner
5e28a6fcdd
Finally get around to doing a major type system refactoring, where we introduce Type as a "smart pointer" and rename the existing Type class to TypeBase.
...
This prevents use of isa/dyn_cast/etc on Type*'s and means we just pass around Type by value instead of having to use Type* everywhere.
Swift SVN r343
2011-04-05 01:06:57 +00:00
Chris Lattner
fd2bf74f06
Move getCanonicalType from being a method on ASTContext to being a method on Type.
...
Swift SVN r314
2011-03-22 05:23:51 +00:00
Chris Lattner
44ac12cb21
Remove some old code, add an assert to get an assert instead of null pointer deref on invalid call.
...
Swift SVN r268
2011-03-14 23:39:13 +00:00
Chris Lattner
db236941d0
Check in a massive rewrite of how sema works for expressions in an effort to make way for separate parsing, name binding, type checking phases.
...
Highlights of this include:
1) most of SemaExpr is gone now, when parsing, all expressions are assigned null types.
2) the introduction of a new TypeChecking pass, which assigns types to expressions, and checks their constraints.
3) ElementRefDecl now properly stores an access path for what it is accessing, and ElementRefDecl's get added to the AST.
4) The parser is much much simpler for expressions now, it just collects lists of primary exprs into SequenceExprs unconditionally.
5) This means that formation of binary expressions, function application etc is now done by TypeChecking. This is actually simpler, though admittedly surprising.
6) This introduces a new -parse-dump mode which just parses but does not perform name binding or type checking.
I've been working on this for a while and it is still quite broken: it still doesn't handle anondecls at all, doesn't perform conversion checking for default tuple elements, has missing pieces of varname name binding etc. However, there is no reason to not crash land it now, it's not like I'm going to break anyone else.
Swift SVN r262
2011-03-13 21:52:03 +00:00
Chris Lattner
40d4fedcb8
Make it invalid to call getCanonicalType before name binding is fully completed. This *will* cause assertion failures on valid code at this point because too much sema stuff happens at parse time.
...
Swift SVN r253
2011-03-02 08:02:44 +00:00
Chris Lattner
b233848006
Tidy up and clean up code and error recovery in the parser. Add some templated allocation functions to ASTContext to simplify clients.
...
Swift SVN r248
2011-03-02 06:15:52 +00:00
Chris Lattner
272d9e8dad
Propagate "there were errors in the input" out to the exit code of the swift app by adding a "HadError" bool to ASTContext.
...
Swift SVN r244
2011-03-01 07:59:53 +00:00
Chris Lattner
dd2e2d8df3
Introduce UnresolvedType, make ASTContext have the singleton, update getCanonicalType to do the "right" thing.
...
Swift SVN r239
2011-02-26 02:33:52 +00:00
Chris Lattner
80e1ae6104
Rework a bunch of stuff in the type system: now the *only* way to name a type is through a 'typealias' and there is no such thing as a OneOfDecl. Instead, we have OneOfType's, which are always anonymous. "oneof declarations" and "struct declarations" are now both just sugar.
...
This eliminates the NamedTypeDecl class (because there is now only one named type decl), eliminates OneOfDecl, renames AliasTypeDecl to NameAliasTypeDecl for good measure, and introduces OneOfType.
This preserves all existing syntax, and allows stuff like this:
func test6(checkboxenabled : oneof { Yep, Nope }) {
test6(:Yep)
}
Which is an anonymous oneof.
Swift SVN r237
2011-02-26 02:03:01 +00:00
Chris Lattner
50b3fcc3d1
Switch TupleType to hold its elements with an llvm::ArrayRef instead of manually doing it.
...
Swift SVN r235
2011-02-22 07:15:54 +00:00
Chris Lattner
f9673bb44a
Remove the type symbol table from ASTContext, using the scoped hash table in SemaDecl instead. We resolve a bunch of fixmes (types now give a "previous definition here" diag), remove weird mutating state from ASTContext, and allow us to have shadowed types.
...
Swift SVN r234
2011-02-22 07:02:00 +00:00
Chris Lattner
2e26241a7a
Fix AliasType to point to the TypeAliasDecl instead of replicating its contents.
...
Swift SVN r229
2011-02-22 06:11:48 +00:00
Chris Lattner
93eea9c8bc
Simplify ASTContext's transforming of NamedTypeDecls into types. It now doesn't unique them, the decls do for themselves. ASTContext still has the type symbol table.
...
Swift SVN r228
2011-02-22 06:07:32 +00:00
Chris Lattner
818cd27748
Implement tuple to tuple conversions that involve default element values.
...
Swift SVN r221
2010-11-27 17:17:57 +00:00
Chris Lattner
906ba908fd
Rename 'data' to 'oneof', resolving a fixme in the spec. Yay for CLU!
...
Swift SVN r212
2010-11-11 01:20:36 +00:00
Chris Lattner
6f7564235d
Wire up sema support for creating array types.
...
Swift SVN r207
2010-10-17 13:12:47 +00:00
Chris Lattner
ff38a2db1b
AST Support for arrays.
...
Swift SVN r206
2010-10-17 12:56:04 +00:00
Chris Lattner
09a023c3cd
Now that we have simple user defined data types, remove the __builtin_else_hack type. woot.
...
Swift SVN r179
2010-10-09 22:06:13 +00:00
Chris Lattner
ac855b690b
Move ActOnTypeAlias to SemaDecl since a type alias *is* a decl that *installs* a type. Add some fixme's and rename some junk in ASTContext relating to the typemap. Diagnose redefinitions of named types. Install a typemap entry when a data declaration is defined.
...
We can now declare variables to be of data type.
Swift SVN r178
2010-10-09 22:01:25 +00:00
Chris Lattner
9ba168ace5
Fix Alias uniquing to reuse the already-uniqued identifier object instead of being a string map. Make getAliasType fail if a redefinition happens and make getNamedType return datatype's as well.
...
Swift SVN r177
2010-10-09 21:30:56 +00:00
Chris Lattner
aefb083fed
Make the DataType class, wire it into ASTContext.
...
Swift SVN r176
2010-10-09 21:11:27 +00:00
Chris Lattner
57c697172a
Split NamedDecl into NamedDecl with a ValueDecl subclass that has the type and value of the decl.
...
Swift SVN r173
2010-10-09 20:28:11 +00:00
Chris Lattner
d2abfde434
introduce a new builtin type to represent the result of the else binary operator (which is a temporary hack until we get user defined types).
...
Use it to define ife/else. Fix some precedence/parsing bugs that implementing else exposed.
Swift SVN r162
2010-08-08 22:37:56 +00:00
Chris Lattner
c1294622bf
Cleanup type stuff.
...
Swift SVN r147
2010-08-04 06:35:54 +00:00
Chris Lattner
e1e335610f
int is no longer a keyword, it is a type alias for the new __builtin_int32_type type.
...
Swift SVN r146
2010-08-04 05:27:45 +00:00
Chris Lattner
a8916a6106
implement semantic analysis and AST representation for AliasType (aka typedefs in C).
...
Swift SVN r144
2010-08-04 05:14:57 +00:00
Chris Lattner
f704c58c42
Two significant changes:
...
1. Change the representation of TupleType to contain TupleTypeElt structs instead of PointerUnion<Type*, NameDecl*>
2. Change type canonicalization to not strip field names off tuples, and change type conversion logic to use canonical types again.
Also adds some stuff to the todo list, destined to never be short.
Swift SVN r141
2010-08-04 03:35:53 +00:00
Chris Lattner
1bb344c282
strength reduce our handling of dependent types. Now, you can't compose dependent types, there isn't a (dep, int) type, the whole tuple gets dependent type. This simplifies things a bit.
...
Swift SVN r134
2010-08-03 04:36:05 +00:00
Chris Lattner
9107a90d55
add support for representing dependent types.
...
Swift SVN r117
2010-07-30 18:18:28 +00:00
Chris Lattner
fa78da101b
implement lazy construction of canonical types, ala clang. This only affect tuples at the moment, but will affect type aliases someday.
...
Swift SVN r90
2010-07-25 22:41:05 +00:00
Chris Lattner
2bafb0e8fb
Introduce new NamedDecl and FuncDecl classes. The difference between the two is syntactic sugar, so most clients want NamedDecl. This doesn't implement FuncDecl yet, which isn't a high prio for me in the short term.
...
Swift SVN r77
2010-07-24 19:09:09 +00:00
Chris Lattner
8bf327b648
add a new AST/Identifier class which represents a uniqued string.
...
Add support to ASTContext to unique strings into identifiers.
Swift SVN r62
2010-07-23 03:40:02 +00:00
Chris Lattner
d6c8f0b621
make the AST representation of void just be ().
...
Swift SVN r53
2010-07-22 05:49:57 +00:00
Chris Lattner
fba7359c9c
eliminate a #include from ASTContext.h
...
Swift SVN r52
2010-07-22 05:47:33 +00:00
Chris Lattner
842821d541
add FunctionType, have sema create it and have ASTContext
...
unique it.
Swift SVN r51
2010-07-22 05:44:17 +00:00
Chris Lattner
c363b58ea1
Introduce TupleType, an AST representation of tuples.
...
Swift SVN r49
2010-07-22 01:58:01 +00:00
Chris Lattner
2eeee5faca
give ASTContext a SourceMgr reference, add diagnostic hooks to SemaBase.
...
Swift SVN r39
2010-07-19 05:13:55 +00:00
Chris Lattner
a3164a1a1a
add void type.
...
Swift SVN r35
2010-07-19 04:40:47 +00:00
Chris Lattner
f36e4aa921
introduce Type ast node.
...
Swift SVN r33
2010-07-19 04:33:59 +00:00
Chris Lattner
66199fa090
implement a new IntegerLiteral ast node, add plumbing for
...
allocation of exprs from ASTContext.
Swift SVN r28
2010-07-19 00:42:30 +00:00
Chris Lattner
d3756f2627
Sketch out the new AST library, lets start with expressions.
...
Swift SVN r25
2010-07-19 00:05:11 +00:00