Commit Graph

75 Commits

Author SHA1 Message Date
Meghana Gupta
f458d9b490 Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag (#39516)
* Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag

This includes a bit in the module format to represent if the module was
compiled with -enable-ossa-modules flag. When compiling a client module
with -enable-ossa-modules flag, all dependent modules are checked for this bit,
if not on, recompilation is triggered with -enable-ossa-modules.

* Updated tests
2021-10-04 18:46:40 -07:00
Michael Gottesman
4a189d8025 [cmake] Work around a bug in the swift-driver by passing host side libraries from LLVMSupport to linker jobs via a -Xlinker flag.
Clang and Swift both support this so we can do this until the actual fix lands
in a host toolchain to unblock ErikE.

The specific problem is the swift driver should just push tbd files through to
the linker, but it treats it as an input file. I am going to be putting a fix
into 5.5. This patch in the mean time filters out the tbd files in cmake. This
is a temporary fix.

I also had to add direct dependencies from swift-refactor and
libSwiftSyntaxParser on LLVMSupport to ensure that the right linker flags get to
them.
2021-06-01 18:43:12 -07:00
Alex Hoppen
6095053fe1 [libSyntax] Explicitly return 0 as length of missing deferred tokens
Previously, we were always accessing the `DeferredTokenNode`’s `Range`, which is not valid if the token is missing, thus causing an assertion failure when asked for its length.

Fixes rdar://77391988 [SR-14552]
2021-05-04 15:00:44 +02:00
Alex Hoppen
b20683252b [libSyntax] Eliminate loop and memory allocation translating ParsedRawSyntaxNode to RecordedOrDeferredNode 2021-03-12 08:47:08 +01:00
Alex Hoppen
350ac1514c [libSyntax] Only keep track of range in ParsedRawSyntaxNode if verifying element ranges
This makes ParsedRawSyntaxNode a zero-cost wrapper around RecordedOrDeferredNode in the case that ranges are not verified.
2021-03-11 19:58:59 +01:00
Alex Hoppen
a47bd7089e [libSyntax] Don't create dedicated deferred nodes in SyntaxTreeCreator
We have finally reached our goal of optimising deferred node creation
for SyntaxTreeCreator. Instead of creating dedicated deferred nodes and
copying the data into a RawSyntax node when recording, we always create
RawSyntax nodes. Recording a deferred node is thus a no-op, since we
have already created a RawSyntax node. Should a deferred node not be
recorded, it stays alive in the SyntaxArena without any reference to it.
While this means, we are leaking some memory for such nodes, most nodes
do get recorded, so the overhead should be fine compared to the
performance benefit.
2021-03-10 08:48:18 +01:00
Alex Hoppen
efb91f70a1 [libSyntax] Handle deferred node data in SyntaxParseActions
By now ParsedRawSyntaxNode does not have any knowledge about deferred
node data anymore, which frees up SyntaxParseActions (and, in
particular its sublass SyntaxTreeCreator) to perform optimisations to
more efficiently create and record deferred nodes.
2021-03-09 14:26:08 +01:00
Alex Hoppen
a48713717e [libSyntax] Store range in token_data in C lib parse actions
We don't actually need the range for layout nodes, so just store it
for token nodes. This will also make deferred node handling easier
later on, because we don't need to keep track of layout node ranges.
2021-03-08 18:40:42 +01:00
Alex Hoppen
dd9e831ba7 [libSyntax] Explicitly pass source file length to c parse actions
Previously, the passed in source file was implicitly terminated by the
first null character. The source file might, however, contain a null
character in the middle and we shouldn't stop parsing at it.
2021-03-04 22:20:11 +01:00
Alex Hoppen
dc8eed4279 [libSyntax] Delete discardRecordedNode
It doesn't do anything anymore and we shouldn't have it, so let's just
remove it.
2021-03-02 20:07:26 +01:00
Alex Hoppen
76fbae1526 [libSyntax] Change OpaqueSyntaxNode to be a const void *
The data of an OpaqueSyntaxNode should never be modified. Also, this
allows us to get rid of two const_casts.
2021-03-02 20:07:26 +01:00
Alex Hoppen
3adefd375c [Lexer] Push trivia piece lexing down to SyntaxParseActions
The SyntaxParseActions can decide how to handle the raw trivia, either
lex them into pieces or store them raw to be lexed when needed.
2021-02-05 08:15:54 +01:00
Alex Hoppen
bfe0a00551 Merge pull request #35429 from ahoppen/remove-bytetree
Remove ByteTree serialization format
2021-01-15 09:28:19 +01:00
Alex Hoppen
8ec8516893 Remove ByteTree serialization format
It was originally designed for faster trasmission of syntax trees from
C++ to SwiftSyntax, but superceded by the CLibParseActions. There's no
deserializer for it anymore, so let's just remove it.
2021-01-14 20:37:49 +01:00
Saleem Abdulrasool
6009dcb5e5 build: improve _InternalSwiftSyntaxParser installation
Use the `TARGETS` form of `install` to avoid having to spell out the
location and file name to install.  Additionally, setup the installation
rules to work better for Windows by listing install locations for the
archive (static library) form (which includes the import library on
Windows), library form (which is the Unix library), and the runtime
component (the .dll on Windows).
2020-12-25 09:46:36 -08:00
Hamish Knight
f57299a587 Formalize some SourceFile parsing outputs
Currently when parsing a SourceFile, the parser
gets handed pointers so that it can write the
interface hash and collected tokens directly into
the file. It can also call `setSyntaxRoot` at
the end of parsing to set the syntax tree.

In preparation for the removal of
`performParseOnly`, this commit formalizes these
values as outputs of `ParseSourceFileRequest`,
ensuring that the file gets parsed when the
interface hash, collected tokens, or syntax tree
is queried.
2020-06-03 11:03:56 -07:00
Argyrios Kyrtzidis
791309155d [Parse] Fix issue with incremental re-parsing for SwiftSyntax emitting bogus parsing error
rdar://60232712
2020-03-18 16:00:04 -07:00
Hamish Knight
f56b061407 [Parse] Check the SourceFile for #if evaluation
Remove the `EvaluateConditionals` flags from the
parser, and instead query the source file.

This commit also changes ParserUnit such that it
doesn't evaluate #if conditions by default, as
none of its clients appear to require it. The
only client that wasn't explicitly disabling #if
evaluation and is processing the resulting AST is
swift-indent, so this commit also adds a test to
ensure it continues to work correctly with #if
decls.
2020-03-02 14:12:37 -08:00
Hamish Knight
0d5a5e12d5 Move #if evaluation flag out of PersistentParserState
Move this flag onto the parser instead. Now the
only client of PersistentParserState is code
completion.
2020-02-28 10:51:12 -08:00
swift_jenkins
f60eec9290 Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 13:20:27 -08:00
Saleem Abdulrasool
1d5947b3bd build: remove SWIFT_NEEDS_EXPLICIT_LIBDISPATCH
Restore the previous commit which somehow passed the buildbot given a
missing condition on the sub-configure for libdispatch.  This makes it
more explicit as to what the desire is; the variable was being used to
serve as a proxy for whether the build is not on a Darwin target.
2019-11-20 08:27:30 -08:00
swift_jenkins
71872d5dbe Merge remote-tracking branch 'origin/master' into master-next 2019-11-20 05:40:00 -08:00
David Zarzycki
475f7c1e63 Revert "build: remove SWIFT_NEED_EXPLICIT_LIBDISPATCH (NFC)"
This reverts commit 18570c723f because it
breaks building on platforms that do not want or need libdispatch.
2019-11-20 08:14:03 +02:00
swift_jenkins
014d56a156 Merge remote-tracking branch 'origin/master' into master-next 2019-11-19 11:59:49 -08:00
Saleem Abdulrasool
18570c723f build: remove SWIFT_NEED_EXPLICIT_LIBDISPATCH (NFC)
This flag was being used as an alias for whether or not the host is
non-Darwin.  Rather than adding custom checks for this, use the explicit
check that CMake supports.  This simplifies the logic and avoids the
proliferation of custom variables which can become confusing for others
who are not familiar with the custom build infrastructure.
2019-11-19 08:24:53 -08:00
swift-ci
d9223a7d16 Merge remote-tracking branch 'origin/master' into master-next 2019-11-12 13:30:45 -08:00
Robert Widmann
48805b1d44 Give ASTContext TypeCheckerOptions
Strip TypeChecker of all of this state.
2019-11-12 09:56:01 -08:00
swift-ci
ae278ae961 Merge remote-tracking branch 'origin/master' into master-next 2019-10-30 14:50:00 -07:00
Jordan Rose
5c2185f395 Merge pull request #27868 from owenv/diag-info-refactor
[Diagnostics] Refactor DiagnosticConsumer interface to remove unnecessary params
2019-10-30 14:49:11 -07:00
Owen Voorhees
8a6711769e [Diagnostics] Refactor DiagnosticConsumer interface
DiagnosticInfo now holds all the information needed to consume
a diagnostic, so remove unneeded parameters from handleDiagnostic.
2019-10-29 13:52:12 -07:00
Xi Ge
64c0680686 Merge remote-tracking branch 'apple/master' into master-next 2019-10-28 10:19:36 -07:00
Saleem Abdulrasool
2dbb7fae96 build: add a dependency on the just built clang (NFC)
When building in a unified build and building the host tools with a
non-clang compiler, we switch compilers.  In such a case, we need to
actually add an explicit dependency on the new compiler.
2019-10-26 17:17:41 -07:00
Rintaro Ishizaki
aeec682c90 [SyntaxParse] Prevent memory leak in Syntax parsing
Essentially re-applying b09f87594a
2019-10-15 16:27:32 -07:00
Rintaro Ishizaki
8a03e08966 Revert "Merge pull request #26403 from rintaro/gsoc-2019-part1"
This reverts commit 1a211e6e5f, reversing
changes made to 482d0621a6.
2019-10-14 15:18:05 -07:00
Rintaro Ishizaki
00613db8db Revert "Merge pull request #27230 from rintaro/syntaxparsse-rdar55421369"
This reverts commit b09f87594a, reversing
changes made to d0b7ecab00.
2019-10-14 12:47:23 -07:00
swift-ci
9d1d30b201 Merge remote-tracking branch 'origin/master' into master-next 2019-09-18 22:49:58 -07:00
Rintaro Ishizaki
9f642f0bc1 Revert "Merge pull request #27203 from CodaFi/movin-on-up"
This reverts commit 387d2a9aee, reversing
changes made to bf1ab6c29d.
2019-09-17 16:42:44 -07:00
swift-ci
44d37fa038 Merge remote-tracking branch 'origin/master' into master-next 2019-09-16 15:49:59 -07:00
Robert Widmann
d8aaf29617 Revert "Merge pull request #27132 from rintaro/syntaxparse-parsedrawsyntax-moveonly"
This reverts commit e675c4947d, reversing
changes made to 73315ba01e.
2019-09-16 15:10:33 -07:00
swift-ci
c78de56a8d Merge remote-tracking branch 'origin/master' into master-next 2019-09-13 16:09:33 -07:00
Rintaro Ishizaki
e675c4947d Merge pull request #27132 from rintaro/syntaxparse-parsedrawsyntax-moveonly
[SyntaxParse] Prevent memory leak in Syntax parsing
2019-09-14 01:06:15 +02:00
swift-ci
b719d49432 Merge remote-tracking branch 'origin/master' into master-next 2019-09-12 11:10:23 -07:00
Saleem Abdulrasool
cd2a9dd2e9 SwiftSyntaxParser: simplify build rules (NFC)
Rather than use explicit permissions, use `install(PROGRAMS` to achieve
the same permission set.  It is unclear why the library is installed as
a program, but maintain the current permissions.
2019-09-11 19:27:33 -07:00
Rintaro Ishizaki
b9985dbe87 [SyntaxParse] Fix memory leak for explicit syntax actions
Add SyntaxParseActions::discardRecordedNode() as a workaround for memory
leak during syntax parsing migration.
2019-09-11 16:33:49 -07:00
swift-ci
b503ced230 Merge remote-tracking branch 'origin/master' into master-next 2019-08-22 16:29:14 -07:00
Alex Langford
61be4d969f [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.

This is a resubmission (with modifications) of an earlier change. I originally
committed this but there were problems with some installation rules.
2019-08-22 10:16:50 -07:00
Jonas Devlieghere
b4d268e9e1 Migrate llvm::make_unique to std::make_unique
Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances in the swift repo.
2019-08-15 11:32:39 -07:00
Ben Langmuir
327c666b8a Revert "[CMake][NFC] Introduce component targets for proper dependency tracking" 2019-08-08 16:35:59 -07:00
Alex Langford
50a0e87c69 [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.
2019-08-08 11:50:35 -07:00
Jan Svoboda
f0395a469a Revert "Revert "[Parser] Decouple the parser from AST creation (part 1)"" 2019-07-30 04:34:09 +00:00