Commit Graph

849 Commits

Author SHA1 Message Date
Chris Lattner
10f5c2fc66 remove the UnresolvedType, representing it with a null Type() instead. There is no need to
have two different ways to represent the same thing.  This has the pleasant bonus that stuff
crashes when you do things with unresolved types.


Swift SVN r513
2011-08-12 05:19:52 +00:00
Chris Lattner
6f7c702321 disable copy and assignment of various types, and plain 'operator new' of others
using the new '0x way.


Swift SVN r443
2011-07-24 19:33:27 +00:00
Chris Lattner
c9ec409046 Context.getNewOneOfType -> OneOfType::getNew
Swift SVN r428
2011-07-19 06:28:36 +00:00
Chris Lattner
a39857ab85 migrate ASTContext::getTupleType -> TupleType::get
Swift SVN r427
2011-07-19 06:26:55 +00:00
Chris Lattner
649a577059 move from ASTContext::getArrayType -> ArrayType::get
Swift SVN r426
2011-07-19 06:22:04 +00:00
Chris Lattner
e106d336cb while I'm in a cleanup mood, move the factory functions from
types off of ASTContext onto the types themselves.  This 
never made sense for clang, and makes the same amount of sense
for swift.  Start with function types.


Swift SVN r425
2011-07-19 06:17:26 +00:00
Chris Lattner
10017bef15 ArrayRef and SmallVector[Impl]
Swift SVN r423
2011-07-19 06:03:26 +00:00
Chris Lattner
7275ca527a pull in StringRef and Twine.
Swift SVN r422
2011-07-19 06:00:20 +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
79ba41c1fe add a specialization of AllocateCopy to help out argument deduction a bit,
simplifying some code.


Swift SVN r385
2011-04-29 07:18:11 +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
a93a1f640b Rearrange some cases, only try to-tuple conversion if a tupleexpr isn't a grouping paren.
Swift SVN r315
2011-03-22 05:42:30 +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
3f0af37333 Allow allocating a type of any ArrayRef from ASTContext.
Swift SVN r260
2011-03-13 20:46:50 +00:00
Chris Lattner
ddb760bf2b Remove the concept of an ASTConsumer, add a new TranslationUnitDecl.
Swift SVN r255
2011-03-04 22:08:34 +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
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
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
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