Commit Graph

23 Commits

Author SHA1 Message Date
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Evan Wilde
f3ff561c6f [NFC] add llvm namespace to Optional and None
This is phase-1 of switching from llvm::Optional to std::optional in the
next rebranch. llvm::Optional was removed from upstream LLVM, so we need
to migrate off rather soon. On Darwin, std::optional, and llvm::Optional
have the same layout, so we don't need to be as concerned about ABI
beyond the name mangling. `llvm::Optional` is only returned from one
function in
```
getStandardTypeSubst(StringRef TypeName,
                     bool allowConcurrencyManglings);
```
It's the return value, so it should not impact the mangling of the
function, and the layout is the same as `std::optional`, so it should be
mostly okay. This function doesn't appear to have users, and the ABI was
already broken 2 years ago for concurrency and no one seemed to notice
so this should be "okay".

I'm doing the migration incrementally so that folks working on main can
cherry-pick back to the release/5.9 branch. Once 5.9 is done and locked
away, then we can go through and finish the replacement. Since `None`
and `Optional` show up in contexts where they are not `llvm::None` and
`llvm::Optional`, I'm preparing the work now by going through and
removing the namespace unwrapping and making the `llvm` namespace
explicit. This should make it fairly mechanical to go through and
replace llvm::Optional with std::optional, and llvm::None with
std::nullopt. It's also a change that can be brought onto the
release/5.9 with minimal impact. This should be an NFC change.
2023-06-27 09:03:52 -07:00
Saleem Abdulrasool
671576d2d3 Basic: silence MSVC pedantic warning (NFC)
The constructor here required multiple user-defined conversions which is
not exactly pedantically correct.  Add an explicit indicator that the
constructor being invoked is the `StringRef` constructor to convert the
`SmallString` to a `StringRef` which can then be implicitly converted to
the `Optional<StringRef>`.  This silences a MSVC warning (clang should
catch this with `-pedantic`).
2019-06-02 11:32:21 -07:00
Alexander Shaposhnikov
1525e9bfc5 [Windows] Add initial implementation for TaskQueue 2019-05-14 11:42:08 -07:00
Jason Mittertreiner
8998235ed6 Enable Child Memory Usage Tracking on Windows (#23686)
Windows requires a handle to get memory usage, so do a slight refactor
to collect the child's memory usage as it exits instead of as the parent
is cleaning up.
2019-03-30 18:54:30 -07:00
Jason Mittertreiner
b895f0cf17 Have Windows Call Signaled Callback on Crashes (#23018)
The signaled callback is treated more as a general crash handler clean
up wise. While it doesn't 100% line up, have Windows call the signaled
callback on exit codes considered to be errors.
2019-03-01 17:49:26 -08:00
Jason Mittertreiner
2680c34a15 Implement SeparateErrors on Windows
To display stack traces from child processes, the driver combines stdout
and stderror together on Unix. This makes the Basic implementation also
do that.
2019-02-27 14:39:50 -08:00
Jason Mittertreiner
ac0d9ef31a Fixed Driver Dependency Tests on Windows
All Driver/Dependency Tests now pass on Windows!
2019-02-21 11:19:57 -08: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
d425ec110e Basic: use new signature for ExecuteNoWait
Adjust the remaining instance of the `ExecuteNoWait` to use the
llvm::ArrayRef<StringRef> without an implicit conversion.  This allows swiftc to
build on Windows once again.
2018-08-29 13:00:24 -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
Saleem Abdulrasool
000ee2514d Basic: simplify conversion deduction
The `redirects` parameter is of type `ArrayRef` which is default constructed
through the special `None` type.  Use `None` rather than `nullptr` which would
attempt to create a 0-sized array with a `nullptr`.  This fixes the build on
Windows.
2018-03-20 09:39:20 -07:00
Hugh Bellamy
975d8d1297 Fix Windows build as a result of recent TaskQueue changes 2017-01-19 09:22:28 +00:00
Hugh Bellamy
09abbfeefd Fix lib/Basic Windows/Cygwin build
(cherry picked from commit ff17c26b7a)

https://github.com/apple/swift/pull/6812
2017-01-14 20:48:43 -05:00
Matthew Carroll
5497bfb7b4 SR-3175: Include the terminating signal number in the driver output
* Add the signal number of the terminated task to the output of the driver on platforms for which the signal number is available. The new key in the parseable driver output is "signal".
* Add a test to verify that the signal number is emitted.
* Add documentation for the new "signal" key emitted in the parseable driver output.

https://bugs.swift.org/browse/SR-3175
2017-01-13 13:48:41 -05: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
practicalswift
022efe94c4 Reference file names (and not paths) in file headers. 2016-01-04 09:56:23 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +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
dd9614e80c [driver] Add TaskQueue::getNumberOfParallelTasks().
For the Unix implementation, this returns NumberOfParallelTasks (unless that value is 0, in which case it returns the default value of 1).
For the Default implementation, this always returns 1, since it does not support parallelism.

Swift SVN r12348
2014-01-15 21:27:50 +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