Commit Graph

19 Commits

Author SHA1 Message Date
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Alexander Shaposhnikov
1525e9bfc5 [Windows] Add initial implementation for TaskQueue 2019-05-14 11:42:08 -07:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Saleem Abdulrasool
6111d4deed Basic: move TaskQueue serialization
The implementation is small and would need to be replicated into the
default implementation.  Move the definition into the common TaskQueue
implementation.  This repairs the Windows build of the compiler.
2018-05-30 11:53:54 -07:00
Benjamin Herzog
ac10fb3462 [Driver] Added process information to emitted messages
When providing the -parseable-output flag to the swift compiler, it will provide json formatted messages about tasks that run.
I added some optional usage information in form of user time, system time and maxrss to the output. This can be used by other tools using the compiler to get some insights about time and memory usage.
Since the output does not longer match processes run (in batch mode), I also added a real_pid field so the client could reason about jobs that belong together if needed.

rdar://39798231
2018-05-25 13:12:57 -07:00
Graydon Hoare
c1682fa465 [Driver] <rdar://39504759> Continue demultiplexing subprocess output after initial read. 2018-04-18 11:52:11 -07:00
Sho Ikeda
eaf33e0998 [gardening][lib/Basic] Replace typedef with using 2018-03-13 13:46:38 +09:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
Sean Callanan
399709ccb8 Optionally separate Tasks` stderr from stdout.
Fixes a serious problem where spurious output from xcrun breaks
swift's discovery of libarclite.

<rdar://problem/28573949>
2017-01-11 11:11:23 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Connor Wakamo
93f7f2ad43 [driver] Fixed a bug in DummyTaskQueue where it would not generate unique ProcessIds.
Since DummyTaskQueue does not actually execute, it keeps a counter of
ProcessIds. This previously was a local variable; it is now static since
multiple instances of DummyTaskQueue may be used, depending on the requested
commands.

No tests for this yet, but this will be required to properly test parseable
output.

Swift SVN r20849
2014-07-31 21:19:57 +00:00
Connor Wakamo
b7d4e98f70 [driver] Added support for detecting and reporting crashed subprocesses.
Added a TaskSignalledCallback to TaskQueue, which will be called instead of
TaskFinishedCallback if the task exited abnormally.

In Unix/TaskQueue.inc, check WIFSIGNALED if the task did not pass WIFEXITED,
and call the TaskSignalledCallback if necessary. In Default/TaskQueue.inc, check
for a return code of -2; if present, call the TaskSignalledCallback instead of
the TaskFinishedCallback.

Updated Compilation to pass a TaskSignalledCallback.

Added diagnostics to indicate when a command signalled as well as when a command
failed with either poor diagnostics or a non-1 exit code. (These match Clang’s
diagnostics.) Added tests to ensure these diagnostics are emitted when the
frontend crashes or fails an assertion (if assertions are available).

This fixes <rdar://problem/16012199>.

Swift SVN r13654
2014-02-07 22:03:33 +00:00
Connor Wakamo
b7aec0e72c [driver] Added a DummyTaskQueue class, which calls TaskBeganCallback/TaskFinishedCallback but does not actually execute subtasks.
While this is not yet used, Compilation will be able to adopt this for easier testing of driver-level task execution (instead of forcing all driver-level tests to invoke the frontend, linker, etc.).

Swift SVN r12349
2014-01-15 21:27:55 +00:00
Connor Wakamo
cc00fd1048 [driver] Rework the Unix implementation of TaskQueue::execute() to support reading from pipes as they fill, instead of all at once at the end.
Instead of always calling waitpid() and looking for the termination of a task, call poll() and watch for events on the pipes which are used for buffering subtask output. When we receive a POLLIN or POLLPRI event, ask the corresponding Task to read from the pipe; when we receive a POLLHUP or POLLERR event, wait for the subtask to finish and then ask the Task to perform its post-execution tasks.

Now that the Unix implementation properly handles large amounts of subtask output, re-enable the Unix implementation (if supported).

This fixes <rdar://problem/15795234>.

Swift SVN r12293
2014-01-14 20:39:23 +00:00
Connor Wakamo
aec43d811a [driver] Disable the Unix implementation of TaskQueue.
The current implementation does not read() from each Task's pipe until execution
finishes. This causes subtasks to block in write() if the pipe is full, which
only happens if there is a large amount of output (such as in -dump-ast mode).

Fixing output buffering and reenabling the Unix TaskQueue implementation is
tracked by <rdar://problem/15795234>.

Swift SVN r12135
2014-01-10 21:56:18 +00:00
Connor Wakamo
ed061a5bfa [driver] Introduced a new TaskQueue class for parallel execution and output buffering.
Due to the nature of this class, there are two implementations of TaskQueue:
a Unix-specific implementation which supports both parallel execution and output
buffering, and a default implementation which supports neither of these features.
(The default implementation uses the functions from llvm/Support/Program.h for execution.)

TaskQueue allows clients to provide a TaskBeganCallback and a TaskFinishedCallback,
each of which will be called when a new task begins or when a task finishes execution,
respectively. Clients may add tasks to the TaskQueue in either of these callbacks,
and clients can stop further execution by returning TaskFinishedResponse::StopExecution
from the TaskFinishedCallback.

Swift SVN r12059
2014-01-08 19:10:41 +00:00