Commit Graph

289 Commits

Author SHA1 Message Date
John McCall
b095a5efd8 Add -debugger-support to permit the inevitable series of exceptions
and special-cases that we want to permit when parsing for the debugger.

Swift SVN r13754
2014-02-10 18:47:00 +00:00
Chris Lattner
2792e55be4 remove the -enable-new-objc-properties staging option, and
simplify some code.


Swift SVN r12976
2014-01-26 23:24:35 +00:00
Chris Lattner
38698af3cc This is a WIP implementation of a major change to how ObjC properties are
represented: they should have an explicit getter and setter synthesized by
Sema, instead of by silgen and tenuously tied in by IRGen.

There is more work to be done on this (e.g. I need to figure out how to get
the bodies properly type checked), so it is hidden behind a new
-enable-new-objc-properties flag.



Swift SVN r12907
2014-01-24 07:04:42 +00:00
Joe Groff
5b7e9ee279 Hide NominalTypePatterns behind a compiler switch.
These aren't fully baked and probably won't be soon.

Swift SVN r12628
2014-01-21 00:49:28 +00:00
Chris Lattner
cc31c6edb5 remove the '-enable-let-arguments' staging option.
Swift SVN r12374
2014-01-16 01:29:14 +00:00
Chris Lattner
b0b5a8f774 Switch constructor arguments, curried arguments and selector arguments to be
'let' values (so they are immutable and don't get a box, etc).  Add a flag to
the swift compiler that turns the bulk of function arguments into lets, but 
don't set it yet.


Swift SVN r12274
2014-01-14 03:53:11 +00:00
Chris Lattner
cb2010f780 remove the -enable-mutable-methods langopt, it isn't doing anything anymore.
Swift SVN r11695
2013-12-28 16:06:41 +00:00
Joe Groff
e06ee37dca Enable SIL protocol witnesses.
We should be able to cut out another layer of IRGen grime now.

This does XFAIL one test, test/Prototypes/TextFormatting.swift, which fails because of a weird archetype ordering in a nested substitution list. This should get sorted out by switching to interface types, so I'm going to let it go until then.

Swift SVN r11618
2013-12-24 04:36:03 +00:00
Chris Lattner
01be26cd4b Add a new command line option that turns on by-value self arguments for structs
when a method is not declared @inout.


Swift SVN r11386
2013-12-17 17:25:42 +00:00
Joe Groff
6547c69b33 Turn on lazy global initializers.
Swift SVN r11136
2013-12-11 18:59:56 +00:00
Joe Groff
e9deb9e75f Add an -emit-sil-protocol-witness-tables flag.
So we can break stuff while it's turned on.

Swift SVN r10922
2013-12-06 15:58:00 +00:00
Doug Gregor
0428eeaebf Introduce --debug-constraints-attempt=N to debug a specific constraint system.
The constraint solver statistics now tell us which of the constraint
systems we are solving were the largest. This lets us look at what the
solver does with that constraint system without piling on the
debugging spew.


Swift SVN r10638
2013-11-21 18:53:00 +00:00
Joe Groff
a049ee9d38 SILGen: (Optionally) emit lazy initializers and accessor fns for globals.
For every global pattern binding, emit a lazy initializer token and function that initializes the global variables in that binding. For each of those vars, create an accessor that Builtin.once's the lazy initializer before producing the address. Hide this all behind a switch till the surrounding serialization and IRGen infrastructure catches up.

Swift SVN r10511
2013-11-16 00:50:19 +00:00
Joe Groff
a1f123350f Enable NS_OPTIONS import by default.
Some work needs to be done on static member lookup and bitwise operations, but what's implemented now isn't a regression from what we have (except for an unfortunate case in Foundation.swift where we need to fully qualify a constant in a single-element NS_OPTIONS).

Swift SVN r10471
2013-11-14 23:21:28 +00:00
Joe Groff
fdd858dd21 ClangImporter: Import NS_OPTIONS constants as static properties.
Apply the same prefix-chopping logic as for NS_ENUM to produce static property names to put inside the Swift type we create. For now, continue importing NS_OPTIONS as structs with a single integer field; in the short term it's easy to put a C-like interface over them this way.

Swift SVN r10434
2013-11-13 23:19:32 +00:00
Joe Groff
774db24a8a Enable importing of NS_ENUMs as Swift enums.
A problem with name lookup from Clang module contexts <rdar://problem/15410928> means I have to disable a ~= overload in the ObjectiveC overlay. Other than that, NS_ENUM import should be ready to go.

Swift SVN r10018
2013-11-07 03:49:37 +00:00
Joe Groff
16c5d69e17 ClangImporter: Recognize NS_ENUM declarations and import as Swift enums.
When we see an enum declaration in the Clang importer, look at its source location to see if it was produced as part of an NS_ENUM macro expansion. If so, take the 'Enum' route through the Clang importer and import it as a Swift enum. This will break things until we have end-to-end support for Clang-imported enums, so hide it behind an -import-ns-enum switch for now.

Swift SVN r9951
2013-11-05 01:38:00 +00:00
Joe Groff
1616276923 SILGen: Remove 'SILGenLValuePeepholes' flag.
r9931 fixes the crashes this exposes, so we can enable it by default now.

Swift SVN r9935
2013-11-04 22:54:54 +00:00
Chris Lattner
68af974227 Remove 'axle' related code and build machinery. It turns out that we
will not be pursuing this project in the immediate future.



Swift SVN r9901
2013-11-03 16:04:27 +00:00
Joe Groff
cd74f49434 Revert "SILGen: Enable lvalue-to-lvalue copy_addr initialization peephole by default."
This reverts commit r9347. The copy_addr peephole still crashes the
Demo-2012-07/uniq.swift test on the buildbot.

Swift SVN r9358
2013-10-15 18:18:29 +00:00
Joe Groff
47dd733c3f SILGen: Enable lvalue-to-lvalue copy_addr initialization peephole by default.
The Interpreter crashes this introduced in the end-to-end pipeline seem to have subsided, now that DI is prepared for it.

Swift SVN r9349
2013-10-15 16:56:15 +00:00
Joe Groff
2ffd735255 SILGen: Peephole lvalue-to-lvalue initializations as copy_addrs.
If we're using emitExprInto to emit a LoadExpr, we can handle that by emitting a copy_addr from the underlying lvalue to the initialization instead of building and storing the rvalue, which plays better with the direction we're taking for value semantics optimizations.

This is currently guarded behind a flag -enable-silgen-lvalue-peepholes because it introduces a miscompile in the stdlib that crashes some tests; requires further investigation before making live.

Swift SVN r9027
2013-10-08 20:44:09 +00:00
John Garvin
4a8ac0d752 Parse kernel, vertex, and fragment function attributes. Metadata is not yet being generated.
This is part of <rdar://problem/14951602> AGP5 bring up: Parse AGP5 kernel function attributes.



Swift SVN r8670
2013-09-25 22:16:57 +00:00
Chris Lattner
dea8213ef9 remove the -enable-definite-init command line option. Definite init
seems to have stuck.


Swift SVN r7956
2013-09-05 20:37:41 +00:00
Chris Lattner
1332be7ede add a new "-enable-definite-init" command line option that will gate the
new definitive initialization work until it is ready to be on by default.
This needs to be a langoption as well, because it will affect some of the
things SILGen does.


Swift SVN r7135
2013-08-10 20:30:13 +00:00
Argyrios Kyrtzidis
66d1e516c8 Refactor how multiple parsing passes and delayed parsing works.
-Introduce PersistentParserState to represent state persistent among multiple parsing passes.
  The advantage is that PersistentParserState is independent of a particular Parser or Lexer object.
-Use PersistentParserState to keep information about delayed function body parsing and eliminate parser-specific
  state from the AST (ParserTokenRange).
-Introduce DelayedParsingCallbacks to abstract out of the parser the logic about which functions should be delayed
  or skipped.

Many thanks to Dmitri for his valuable feedback!

Swift SVN r6580
2013-07-25 01:40:16 +00:00
Dmitri Hrybenko
3c5b12fc0f Code completion: add a lot of infrastructure code
* Added a mode in swift-ide-test to test code completion.  Unlike c-index-test,
  the code completion token in tests is a real token -- we don't need to
  count lines and columns anymore.

* Added support in lexer to produce a code completion token.

* Added a parser interface to code completion.  It is passed down from the
  libFrontend to the parser, but its functions are not called yet.

* Added a sketch of the interface of code completion consumer and code
  completion results.

Note: all this is not doing anything useful yet.


Swift SVN r6128
2013-07-10 20:53:40 +00:00
Dmitri Hrybenko
f73d866d91 Implement delayed parsing for function bodies
In order to do this, we need to save and restore parser state easily.  The
important pieces of state are:

* lexer position;
* lexical scope stack.

Lexer position can be saved/restored easily.  We don't need to store the tokens
for the function body because swift does not have a preprocessor and we can
easily re-lex everything we need.  We just store the lexer state for the
beginning and the end of the body.

To save the lexical scope stack, we had to change the underlying data
structure.  Originally, the parser used the ScopedHashTable, which supports
only a stack of scopes.  But we need a *tree* of scopes.  I implemented
TreeScopedHashTable based on ScopedHashTable.  It has an optimization for
pushing/popping scopes in a stack fashion -- these scopes will not be allocated
on the heap.  While ‘detached’ scopes that we want to re-enter later, and all
their parent scopes, are moved to the heap.

In parseIntoTranslationUnit() we do a second pass over the 'structural AST'
that does not contain function bodies to actually parse them from saved token
ranges.


Swift SVN r5886
2013-06-28 22:38:10 +00:00
Joe Groff
8a5cec78e1 ClangImporter: Enable import of objc protocol types.
Remove the -import-objc-protocol-types flag and make it the default behavior. Update swiftFoundation's NSDictionary extensions to use NSCopyingProto keys instead of plain id.

This breaks a test because the type-checker isn't able to solve for NSCopyingProto from a literal type, requiring a manual 'as NSNumber/NSString' coercion to help it along.

Swift SVN r5641
2013-06-18 02:31:20 +00:00
Joe Groff
e9cd5b255c ClangImporter: Conditionally reenable import of ObjC protocol types.
Import ObjC protocol decls into Swift with the [class_protocol] and [objc] attributes. Add an -import-objc-protocol-types flag to reenable import of ObjC qualified object types as Swift protocol types.

Swift SVN r5604
2013-06-16 02:08:24 +00:00
Joe Groff
dbc314cdab Add a -use-malloc switch for memory debugging.
This flag makes ASTContext and SILModule's allocators go through malloc instead of using bump pointer allocators, so that GuardMalloc or similar tools can be used to look for memory bugs.

Swift SVN r5472
2013-06-04 20:35:01 +00:00
Doug Gregor
c038ab92e6 Remove -no-constraint-checker/-constraint-checker and the corresponding language option.
Swift SVN r5387
2013-05-29 22:16:34 +00:00
Joe Groff
12c5999b44 Strip out -no-nsstring-is-string flag and associated LangOptions bit.
Swift SVN r5383
2013-05-29 19:42:12 +00:00
Doug Gregor
27575443e2 [Constraint solver] Use the new constraint solver, start deleting the old one.
The new constraint solver is very close to providing parity with the
old solver, and is significantly faster, so cut over to the new
solver. There are minor adjustments to two tests: one where we're
losing sugar (Int becomes Int64) and another where our ignorance of
overload resolution means we don't reject something silly that we
should.

Note that this only affects the *solver* component of the
constraint-based type checker; we haven't completely obsoleted the old
type checker yet.



Swift SVN r5281
2013-05-23 20:18:22 +00:00
Doug Gregor
00c8099fe6 [Constraint solver] Initial work on a less horrible solver.
This solver handles most of what the old solver does (enabling it by
default only causes 9 test failures), but is radically simpler and
already significantly faster (~50% slower than the old-old type
checker on swift.swift). There are some egregious hacks here to still
be eliminated (see FIXMEs), but it's a start.


Swift SVN r5272
2013-05-22 20:01:32 +00:00
Doug Gregor
01e1240b35 [Clang Importer] Map NSString* function parameters/results to String.
This is the trivial part of <rdar://problem/13723763>, which performs
an import-time remapping of NSString* to String. Because this change
completele breaks IR generation, it is under the off-by-default flag
-nsstring-is-string.


Swift SVN r5058
2013-05-06 20:07:42 +00:00
Chris Lattner
e6a644780f remove an attribute.
Swift SVN r4569
2013-04-01 23:25:09 +00:00
Doug Gregor
e27279c0ff Turn on the constraint-based type checker by default <rdar://problem/13324871>.
Lots of tests (46 of them) fail with the constraint-based type
checker, either due to changes in diagnostics or due to outright
bugs in the constraint-based type checker. Use -no-constraint-checker
for these tests.

Note that the hack to parse imported swift.swift with
-no-constraint-checker remains in place, for build-performance
reasons.



Swift SVN r4300
2013-03-06 06:32:40 +00:00
Doug Gregor
42b1ab6fbd Introduce a LangOptions class to capture various type-checker-tweaking flags. For now, introduce bits to enable the constraint solver and to enable debugging of the constraint solver, and use those to eliminate the "useConstraintSolver" bit that was threaded through too much of the type checker.
Swift SVN r2836
2012-09-12 20:19:33 +00:00