Doug Gregor
3243108518
Introduce an new expression, MemberRefExpr, that refers to a
...
member of an object. This expression kind is currently used to refer
to properties within an object, but will eventually be extended to
refer to fields as well (once we make StructDecl real).
Swift SVN r1445
2012-04-17 00:35:06 +00:00
Eli Friedman
9009d294d2
More strictly special-case '..'; making '-.' etc. an operator would be a complete disaster.
...
Swift SVN r1444
2012-04-17 00:34:25 +00:00
Eli Friedman
6a001efbbb
Make "..", "*^.^*", etc. into overloadable operators. Make 1..10 construct a Range.
...
This has the side-effect that you can't explicitly refer to an operator* with "swift.*", etc., but per discussion with Doug, that's probably okay.
Swift SVN r1443
2012-04-17 00:21:38 +00:00
Eli Friedman
37de44a35d
Implement changes to parsing/sema/etc so that we can implement a REPL and the main module parses the same way as a REPL.
...
Next step: implement an actual REPL.
Swift SVN r1441
2012-04-16 23:52:01 +00:00
Chris Lattner
a9d01aaaec
eliminate macro in favor of an old-school static function.
...
Implement irgen of ptrtoint and inttoptr, which are only overloaded
on one type. Patch 1.5/2 of builtin cast support.
Swift SVN r1434
2012-04-14 02:35:39 +00:00
Chris Lattner
4f4c8b1455
add initial support for Builtin cast instructions, patch #1/2.
...
Swift SVN r1433
2012-04-14 00:56:35 +00:00
Doug Gregor
4fc32fd9b4
For a function that is either a getter or setter for a variable,
...
provide a mapping back to that variable. Teach the mangler to provide
a special mangling for such functions (__getVarName,
__setVarName). The mangling will undoubtedly change later, but the
point is that it will need to match the functions generated for
a resilient variable.
Swift SVN r1432
2012-04-14 00:11:04 +00:00
Chris Lattner
868eccff76
implement a new Builtin.gep operation which maps to the LLVM Getelementptr instruction,
...
used for pointer offseting. We can figure out inbounds later. This is to be used by
UnsafePointerInt
Swift SVN r1429
2012-04-13 23:10:42 +00:00
Chris Lattner
c7c61ecc01
remove the unary neg/not builtins. They're not needed and don't match LLVM IR.
...
Swift SVN r1425
2012-04-13 21:59:56 +00:00
Chris Lattner
62522bb7cb
add unary ~ to the stdlib for integer (not bool yet) types. Teach the mangler
...
to mangle it.
Swift SVN r1415
2012-04-13 06:05:49 +00:00
John McCall
af2399cd30
Significantly step up the validity asserting around the cleanup stack.
...
With that in place, fix ~Scope so that it uses the same code for
popping as Scope::pop() does, i.e. the code that modifies InnermostScope
before popping out.
This properly fixes the issue Doug patched over in r1387.
Swift SVN r1393
2012-04-11 18:00:48 +00:00
Doug Gregor
4c97c19a4f
"Fix" a use-after-free when dealing with dead cleanups, where we try
...
to look at the first element of an empty stack. The use-after-free
triggers occasionally for me during normal testing (about 1 failure
per 5 trials), but triggers on IRgen/func.swift regularly when using
guardmalloc.
John, please take a look; this feels more like treating a symptom than
addressing the cause.
Swift SVN r1389
2012-04-11 16:09:45 +00:00
John McCall
0146f895a0
Merge GenRefCount.cpp into GenHeap.cpp.
...
Swift SVN r1387
2012-04-11 03:44:47 +00:00
John McCall
6b1a0a2de4
Merge GenLocal.cpp and GenGlobal.cpp.
...
Swift SVN r1386
2012-04-11 03:39:01 +00:00
John McCall
5ad3782b01
Rework the IR-generation of initialization and teach the
...
compiler to enter properly-scoped cleanups to destroy local
variables.
Swift SVN r1385
2012-04-11 03:00:08 +00:00
John McCall
828463aa8d
Pack cleanups a little better.
...
Swift SVN r1384
2012-04-11 03:00:05 +00:00
John McCall
3e59c6484f
Fix a nasty bug when reallocating a DiverseStack.
...
Swift SVN r1383
2012-04-11 03:00:01 +00:00
John McCall
5c23fa7326
Move the initialization code out into its own file.
...
Swift SVN r1381
2012-04-11 02:59:55 +00:00
Eli Friedman
361481835c
Introduce a notion of module scope declarations; use it where appropriate instead of checking for a local declcontext.
...
Swift SVN r1380
2012-04-11 02:52:40 +00:00
Ted Kremenek
389dd1c174
Mark ~Cleanup() virtual to silence "has virtual functions but non-virtual destructor" warnings.
...
Swift SVN r1378
2012-04-11 00:06:20 +00:00
Ted Kremenek
6e473e89a0
Mark ~PathComponent() virtual to silence a bunch of "has virtual functions but non-virtual destructor" warnings in subclasses.
...
Swift SVN r1377
2012-04-11 00:06:13 +00:00
Ted Kremenek
352453a53b
Revert "Fix a bunch of "has virtual functions but non-virtual destructor" warnings"
...
Swift SVN r1376
2012-04-11 00:02:16 +00:00
Ted Kremenek
8a61ea1fd0
Fix a bunch of "has virtual functions but non-virtual destructor" warnings
...
Swift SVN r1373
2012-04-10 23:53:46 +00:00
Eli Friedman
5fd74f73a8
Fix comment.
...
Swift SVN r1368
2012-04-10 23:18:05 +00:00
Chris Lattner
ce7403dd1e
implement IRGen of escapes. High unicode escapes aren't handled yet, but all the
...
basics are.
Swift SVN r1363
2012-04-10 20:59:45 +00:00
John McCall
0cd849b19c
Complete the pattern-matching IR emission logic,
...
at least for exhaustive patterns.
Swift SVN r1359
2012-04-10 08:28:31 +00:00
John McCall
7faaf167f2
Editorial
...
Swift SVN r1358
2012-04-10 06:37:17 +00:00
John McCall
344a0fb5df
Change IR-gen to convert canonical types.
...
Swift SVN r1357
2012-04-10 06:36:01 +00:00
John McCall
f3e27d90ff
Change IR-generation so that it emits metadata objects for the
...
heap allocations it makes, and switch swift_alloc over to pass
that pointer in as well as the alignment. Also, compute
whether a type is POD during its generation and cache that in
the object, and introduce a method on TypeInfo to destroy an
object in memory.
Swift SVN r1356
2012-04-10 06:28:22 +00:00
Chris Lattner
508dcb3091
implement IRGen for simple strings.
...
Swift SVN r1352
2012-04-10 01:44:11 +00:00
Chris Lattner
5650d08ddf
implement parsing, AST, and sema support for simple strings,
...
no irgen yet.
Swift SVN r1351
2012-04-10 01:25:51 +00:00
Chris Lattner
2223774f5a
use cached type, thanks John
...
Swift SVN r1350
2012-04-10 01:22:34 +00:00
Chris Lattner
65b400e30d
introduce a new "Builtin.RawPointer" type, which corresponds to LLVM's "i8*" type,
...
and is just an unmanaged pointer. Also, introduce a basic swift.string type.
This is progress towards rdar://10923403 and strings. Review welcome.
Swift SVN r1349
2012-04-10 00:52:52 +00:00
Chris Lattner
fbfb76a515
rename 'plus' methods to 'static' methods, resolving:
...
<rdar://problem/10718220> Need a better name than 'plus' for "static" functions
Swift SVN r1340
2012-04-06 17:50:43 +00:00
John McCall
ca9f85d694
Add code for associating cleanups with intermediate
...
evaluation results and then claiming or forwarding the
ownership of such results.
Swift SVN r1337
2012-04-06 07:07:28 +00:00
John McCall
edad637ddb
In preparation for Explosion storing some sort of cleanup pointer,
...
add some APIs for working with non-cleaned-up entities.
Swift SVN r1336
2012-04-06 07:07:22 +00:00
John McCall
44677bc117
Fixes and embellishments, and actually make IR-gen properly
...
emit release cleanups. And they work!
Swift SVN r1334
2012-04-05 20:36:20 +00:00
John McCall
82da3ca63b
Permit StableIP to be initialized as invalid.
...
Swift SVN r1333
2012-04-05 20:36:20 +00:00
John McCall
82ca0e7720
Basic infrastructure for cleanup emission and branches. Totally untested!
...
Swift SVN r1332
2012-04-05 20:36:19 +00:00
John McCall
8196f40c4c
Add APIs to IRBuilder to capture a stable insertion point (which
...
stays in the same place in a function even when the current IP is
at the end of a block) and to temporarily shift the insertion point.
Swift SVN r1331
2012-04-05 20:36:18 +00:00
John McCall
665e82156c
Publicize the stable_iterator members on DiverseStackImpl
...
(since they're inherited from a private base class).
Also add some extra consistency checking.
Swift SVN r1330
2012-04-05 20:36:17 +00:00
Eli Friedman
f477cf588e
Introduce the notion of the "main" module, i.e. the module which defines main(). Disallow top-level statements in modules other than the main module. Fix IRGen to generate a main() function in the main module, and implement top-level statements. Get rid of the main() mangling hack. Part of <rdar://problem/11185451>.
...
I haven't really carefully considered whether existing type-checking etc. is correct for the main module (I think the name-binding rules need to be a bit different?), but it seems to work well enough for the obvious cases.
This is enough to get the one-liner "println(10)" to print "10" in "swift -i" mode, although the path to swift.swift still needs to be explicitly provided with -I.
Swift SVN r1325
2012-04-05 00:35:28 +00:00
Eli Friedman
d295d02c42
Initial interpreter implementation. The included pieces are enough to get the included simple.swift running in swift -i mode. <rdar://problem/10962290>, part 1.
...
Swift SVN r1319
2012-04-04 01:34:42 +00:00
Doug Gregor
5cf0a09e1a
Allow type coercion from one function type to another function type,
...
so long as the input and result types are equivalent modulo renaming
of labels. This conversion is a no-op.
Swift SVN r1318
2012-04-03 17:51:41 +00:00
Eli Friedman
94244131f7
Remove ElementRefDecl and DeclVarName. Add the replacement, PatternBindingDecl. Use proper pattern parsing for variable declarations. Uniformly use PatternBindingDecl for variable initialization. Adapt type-checking and IRGen for this new style of variable declaration. <rdar://problem/11124980>.
...
Swift SVN r1312
2012-04-02 23:49:28 +00:00
Doug Gregor
4cc616f2be
Rename the DependentType class to UnstructuredDependentType, because
...
this type is only going to cover dependent types for which there is
absolutely no structure. Still no functionality change.
Swift SVN r1292
2012-03-29 14:14:48 +00:00
Eli Friedman
debd0361ee
Fix a couple crashers for tuples with default values.
...
Swift SVN r1289
2012-03-29 02:54:02 +00:00
Eli Friedman
bc73d196a3
Add an unsupported error for curried local functions for the moment.
...
Swift SVN r1287
2012-03-29 01:47:45 +00:00
Eli Friedman
4384ef192e
Add IRGen for local FuncExprs. (This doesn't support local FuncDecls yet.)
...
Swift SVN r1286
2012-03-29 01:28:44 +00:00
Eli Friedman
fb10b02951
Basic capturing appears to be working correctly; turn it on.
...
Swift SVN r1285
2012-03-29 00:37:06 +00:00