Commit Graph

10 Commits

Author SHA1 Message Date
Rintaro Ishizaki
6c0af2a24f [Syntax] Introduce CodeBlockItem (#14458)
CodeBlockItem represents Decl, Stmt or Expr that optionally followed by
semi-colon.
SourceFile syntax holds a list of CodeBlockItem.
2018-02-08 10:31:01 +09:00
Xi Ge
e560170a60 libSyntax: Parse member access expression. (#13119)
* libSyntax: Parse member access expression.

This patch uses createNodeInPlace from syntax parsing context API to
merge an expression with its suffix to create recursive nodes such as
member access expression.

Meanwhile, this patch breaks down a signed integer or float literal to a
prefix operator expression. This expression consists of two parts: an
operator and the following expression. This makes literals like "+1" or
"-1" no different from other prefix unary expressions such as "!true".
2017-11-28 16:29:50 -08:00
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