Commit Graph

817 Commits

Author SHA1 Message Date
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