Commit Graph

8 Commits

Author SHA1 Message Date
Harlan
a5098e6b69 Generate libSyntax API (#10926)
* Generate libSyntax API

This patch removes the hand-rolled libSyntax API and replaces it with an
API that's entirely automatically generated. This means the API is
guaranteed to be internally stylistically and functionally consistent.
2017-07-25 18:19:58 -07:00
practicalswift
40cf4d183d [gardening] Use consistent spacing after if, for and while 2017-04-14 17:35:36 +02:00
Harlan Haskins
c2aeb55119 Add tests for IntegerLiteralExprSyntax.
This also fixes a typo in makePrefixOperator and implements
IntegerLiteralExprSyntax::withSign.
2017-03-21 09:24:42 -07:00
David Farler
bc590e3edd [Syntax] Reenable thread-safe caching test 2017-02-28 10:47:14 -08:00
David Farler
032d0537bd Merge pull request #7797 from bitjammer/rdar-30729901-link-pthread-linux-unittests
[Syntax] ThreadSafeCachingTests: Use a thread pool
2017-02-28 09:26:04 -08:00
David Farler
45a7320db1 [Syntax] ThreadSafeCachingTests: Use a thread pool
Instead of spawning a thread across test iterations (whoops, out of
threads), use a thread pool of size 2. When turning off atomic caching,
this is enough to trigger a race in 5 iterations or fewer for me, so
10000 ought to be enough for most machines.

This should fix hitting the thread limit on Linux.

rdar://problem/30729901
2017-02-27 20:39:19 -08:00
David Farler
d5ae1abc23 Temporarily disable ThreadSafeCachingTests during testing.
I believe I have a fix in https://github.com/apple/swift/pull/7797
but need to run it a few times on Linux before merging.

rdar://problem/30729901
2017-02-27 20:35:45 -08:00
David Farler
c343298b8f [Syntax] Implement return-statement and integer-literal-expr
A return statement needs something to return, so implement
integer-literal-expression too. This necessarily also forced
UnknownExprSyntax, UnknownStmtSyntax, and UnknownDeclSyntax,
which are stand-in token buckets for when we don't know
how to transform/migrate an AST.

This commit also contains the core function for caching
SyntaxData children. This is highly tricky code, with some
detailed comments in SyntaxData.{h,cpp}. The gist is that
we have to atomically swap in a SyntaxData pointer into the
child field, so we can maintain pointer identity of SyntaxData
nodes, while still being able to cache them internally.

To prove that this works, there is a multithreaded test that
checks that two threads can ask for a child that hasn't been
cached yet without crashing or violating pointer identity.

https://bugs.swift.org/browse/SR-4010
2017-02-22 18:45:29 -08:00