Commit Graph

1550 Commits

Author SHA1 Message Date
Mishal Shah
345e9881d1 Merge pull request #22699 from apple/stable-update-5.1
Update Swift:master to work with new stable re-branch from swift-5.1-branch
2019-02-20 12:22:00 -08:00
Michael Gottesman
3178f5cabb [basic] Add comparison operators to NullablePtr<T> against T* and other NullablePtr<T>.
It is always safe to compare a nullptr with a non-null pointer.
2019-02-18 18:41:51 -08:00
Bob Wilson
213efe089c Merge commit '06120c9d9d1a28275a0ecd7466775b1d71716be7' into stable-update-5.1 2019-02-17 10:20:59 -08:00
Slava Pestov
71ff168ad5 Sema: Add a couple more counters 2019-02-07 23:46:31 -05:00
Saleem Abdulrasool
adcdc39791 swift: update for LLVM SVN r344140
Update swift's usage of clang::vfs which has been hoisted into LLVM.
2019-02-07 17:53:42 -08:00
David Ungar
2f65ac3735 Cosmetic cleanups 2019-01-30 17:16:49 -08:00
David Ungar
323c42c532 Fomat 2019-01-24 18:46:49 -08:00
David Ungar
26ef59f576 Fixes from master 2019-01-24 18:46:49 -08:00
David Ungar
b520b242dc Collapsed lots of changes. 2019-01-24 18:46:49 -08:00
Saleem Abdulrasool
aa4e9cb725 Basic: set the correct storage class for the alignment
`cl` objects to the initialization of the templated type differing in storage
class due to the indication of `constexpr`.  `constexpr` does not give the value
itself a `const` storage class.  However, because the value is not initialized
inline, it does not like the `constexpr` attribute.  Apply the `constexpr` only
on clang, and correct the storage to `const`.
2019-01-18 11:51:34 -08:00
Jordan Rose
129f39d89e Merge pull request #21513 from jrose-apple/cachet
[ParseableInterface] Pass prebuilt cache path down to sub-invocations

And several other fixes that got folded into this PR.
2019-01-09 14:58:59 -08:00
Ankit Aggarwal
45290837b4 Merge pull request #21110 from aciidb0mb3r/swiftpm-manifest-version
Extend @available to support PackageDescription
2019-01-07 12:20:23 -08:00
Daniel Dunbar
8980213f7c Merge pull request #20687 from ddunbar/swasm-allow-wasm-object-format
[Swift+WASM] Allow Wasm object format.
2019-01-04 08:34:43 -08:00
Saleem Abdulrasool
896cc340fa Basic: check for definition of _LIBCPP_VERSION (NFC)
Add a defined check for the macro rather than an unconditional check to
avoid a `-Wundef` warning when building without libc++.
2018-12-30 10:26:29 -08:00
Jordan Rose
4bfe4eff6d [ParseableInterfaces] Add -prebuilt-module-cache-path to the frontend
When trying to load a swiftinterface, search this directory before
doing all the work of building a swiftmodule.
2018-12-17 18:23:28 -08:00
Ankit Aggarwal
92d09f4e19 Extend @available to support PackageDescription
<rdar://problem/46548531> Extend @available to support PackageDescription

This introduces a new private availability kind "_PackageDescription" to
allow availability testing by an arbitary version that can be passed
using a new command-line flag "-swiftpm-manifest-version". The semantics
are exactly same as Swift version specific availability. In longer term,
it maybe possible to remove this enhancement once there is
a language-level availability support for 3rd party libraries.

Motivation:

Swift packages are configured using a Package.swift manifest file. The
manifest file uses a library called PackageDescription, which contains
various settings that can be configured for a package. The new additions
in the PackageDescription APIs are gated behind a "tools version" that
every manifest must declare. This means, packages don't automatically
get access to the new APIs. They need to update their declared tools
version in order to use the new API. This is basically similar to the
minimum deployment target version we have for our OSes.

This gating is important for allowing packages to maintain backwards
compatibility. SwiftPM currently checks for API usages at runtime in
order to implement this gating. This works reasonably well but can lead
to a poor experience with features like code-completion and module
interface generation in IDEs and editors (that use sourcekit-lsp) as
SwiftPM has no control over these features.
2018-12-08 09:38:40 +05:30
Slava Pestov
aa747dcd81 Remove property behaviors 2018-12-07 20:38:33 -05:00
swift-ci
39161d5b36 Merge pull request #20600 from adrian-prantl/36032653 2018-12-05 17:01:58 -08:00
Adrian Prantl
d63debeb60 Experimental: Extend ClangImporter to import clang modules from DWARF
When debugging Objective-C or C++ code on Darwin, the debug info
collected by dsymutil in the .dSYM bundle is entirely
self-contained. It is possible to debug a program, set breakpoints and
print variables even without having the complete original source code
or a matching SDK available. With Swift, this is currently not the
case. Even though .dSYM bundles contain the binary .swiftmodule for
all Swift modules, any Clang modules that the Swift modules depend on,
still need to be imported from source to even get basic LLDB
functionality to work. If ClangImporter fails to import a Clang
module, effectively the entire Swift module depending on it gets
poisoned.

This patch is addressing this issue by introducing a ModuleLoader that
can ask queries about Clang Decls to LLDB, since LLDB knows how to
reconstruct Clang decls from DWARF and clang -gmodules producxes full
debug info for Clang modules that is embedded into the .dSYM budle.

This initial version does not contain any advanced functionality at
all, it merely produces an empty ModuleDecl. Intertestingly, even this
is a considerable improvement over the status quo. LLDB can now print
Swift-only variables in modules with failing Clang depenecies, and
becuase of fallback mechanisms that were implemented earlier, it can
even display the contents of pure Objective-C objects that are
imported into Swift. C structs obviously don't work yet.

rdar://problem/36032653
2018-12-05 13:54:13 -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
5d85177233 Basic: prefer the move assignment for TreeScopeHashTableDetachedScope
MSVC objects to the const assignment and move assignment operator.  Simply
prefer the move semantics.
2018-11-30 10:33:57 -08:00
Andrew Trick
ff132a711f Merge pull request #20630 from atrick/fix-quadratic-block-merge
Fix block merging after inlining to be linear, not quadratic.
2018-11-27 11:08:59 -08:00
Andrew Trick
8de89c392a Add a scale-test validation test for quadratic behavior during inlining.
Adds a stat to SILInstruction's transferNodesFromList to record the
number of times an instruction is transfered to another block. This is
the only way I can think of to detect quadratic behavior of passes
that split basic blocks.
2018-11-26 15:24:41 -08:00
swift-ci
f521e1d395 Merge pull request #20775 from davezarzycki/rule_of_five_or_zero 2018-11-26 15:09:36 -08:00
David Zarzycki
8b86fdef1b [NFC] Rule of five/zero feedback 2018-11-26 16:48:24 -05:00
Doug Gregor
d5f6d7f2cb Merge pull request #20491 from DougGregor/runtime-conformance-descriptor-cache
[Runtime] Cache protocol conformance descriptors, not witness tables.
2018-11-26 12:56:23 -08:00
Doug Gregor
39481149a3 [Runtime] Compute generic metadata cache info once per type.
Rather than scanning through the generic parameters and generic requirements
each time we form a key for the generic metadata cache, compute these
values once, when the cache itself is first initialized.
2018-11-26 10:46:42 -08:00
Daniel Dunbar
1efee0c27a [Swift+WASM] Allow Wasm object format.
- This currently does nothing more than adopt the ELF conventions, but for the
   Wasm object file format.
2018-11-20 15:22:26 -07:00
David Zarzycki
fef48a52e7 Merge pull request #20649 from davezarzycki/fix_Wdefaulted-function-deleted-warnings
[Misc] NFC: Fix -Wdefaulted-function-deleted warnings
2018-11-18 11:40:00 -05:00
David Zarzycki
bf7f91b834 [Misc] NFC: Fix -Wdefaulted-function-deleted warnings 2018-11-17 08:30:59 -05:00
Slava Pestov
b570a5de87 Remove -enable-key-path-resilience staging flag 2018-11-16 23:18:37 -05:00
Ted Kremenek
6c8bed847f Merge pull request #20374 from tkremenek/swift5-verison
Bump compiler version to Swift 5.
2018-11-16 04:30:08 -08:00
Michael Ilseman
bca1b74427 [Character] Permit tagged emoji Character literals
Loosen up the compiler's grapheme analysis to allow the emoji tagged
sequences as graphemes.
2018-11-15 09:06:20 -08:00
Ted Kremenek
cf2dce9166 Merge branch 'master' of https://github.com/apple/swift into swift5-verison
# Conflicts:
#	test/api-digester/Outputs/stability-stdlib-source.swift.expected
2018-11-14 17:31:55 -08:00
Arnold Schwaighofer
619673e1fa Merge pull request #20570 from aschwaighofer/synthesize_accessors_dynamic_globals
Synthesize accessors for dynamic global variables
2018-11-14 14:35:47 -08:00
Arnold Schwaighofer
c3230dfc5c Add the implicit dynamic attribute in the IsDynamicRequest query 2018-11-14 12:04:17 -08:00
Vinicius Vendramini
e123750c12 Add option to dump AST to files
This adds two things:
- Calling `swiftc -dump-ast foo.swift [...] -o foo.ast` will dump the AST to the file `foo.ast`, instead of dumping it to `stderr` as usual.
- Calling `swiftc -dump-ast -output-file-map=outputFileMap.json *.swift [...]`, given an `outputFileMap.json` file that contains entries in the form `"ast-dump": "foo.ast"`, will dump the ASTs of the input files to their respective output files in the file map.

This should serve as a valid workaround to a bug mentioned in [the forums](https://forums.swift.org/t/error-when-dumping-the-ast-for-hundreds-of-files/17578) where the AST dump functionality crashes when called with too many input files. A few implementation details were also discussed in the same forum post.

As an aside, this also fixes a comment in `include/swift/Basic/PrimarySpecificPaths.h` that was incorrect.
2018-11-14 13:38:01 -02:00
Ted Kremenek
62799c013d Merge branch 'master' into swift5-version
# Conflicts:
#	test/api-digester/Outputs/stability-stdlib-source.swift.expected
2018-11-13 13:55:51 -08:00
Rahul Malik
d3cc043e58 Add Undefined Behavior sanitizer to Swift Driver (#18553)
This change allows the swift driver to link the ubsan runtime if
`-sanitize=undefined` is specified.
This is useful for sanitizing linked Objective-C code.
2018-11-13 12:11:56 -08:00
Ted Kremenek
748dae7d10 Merge remote-tracking branch 'upstream/master' into swift5-version
# Conflicts:
#	validation-test/stdlib/HashedCollectionFilter3.swift
#	validation-test/stdlib/HashingPrototype.swift
2018-11-09 09:39:22 -08:00
Marc Rasi
bf18697b4f parsing, typechecking, and SILGen for #assert
`#assert` is a new static assertion statement that will let us write
tests for the new constant evaluation infrastructure that we are working
on. `#assert` works by lowering to a `Builtin.poundAssert` SIL
instruction. The constant evaluation infrastructure will look for these
SIL instructions, const-evaluate their conditions, and emit errors if
the conditions are non-constant or false.

This commit implements parsing, typechecking and SILGen for `#assert`.
2018-11-07 16:34:17 -08:00
Ted Kremenek
46510a5eba Bump compiler version to Swift 5.
Main pieces:

- Bump swift-version to 5
- Remove -swift-version 3 support
2018-11-06 14:38:55 -08:00
Arnold Schwaighofer
c158106329 Allow dynamic without @objc in -swift-version 5
Dynamic functions will allow replacement of their implementation at
runtime.
2018-11-06 09:53:21 -08:00
Graydon Hoare
e272ece309 Merge pull request #20170 from graydon/text-interface-to-module
Switch from .sid files to using FILE_DEPENDENCY records in INPUT_BLOCK
2018-11-06 07:52:09 -08:00
John McCall
b08a3f35b0 [NFC] Add a utility to DiverseStack to simplify stable iteration 2018-11-03 01:00:17 -04:00
John McCall
b2e2b853ca [NFC] Pull CleanupBuffer up to DiverseStack 2018-11-03 01:00:17 -04:00
Graydon Hoare
4938b002b4 [ModuleInterface] Remove SwiftParseableInterfaceDeps files, use INPUT_BLOCK. 2018-11-01 10:51:16 -07:00
John McCall
4d2b513da6 [NFC] Extract common code for keying off of APInts 2018-10-31 05:18:19 -04:00
Slava Pestov
4063124c45 AST: Remove isSwiftVersion3() 2018-10-30 16:46:08 -04:00
David Ungar
1f4dfce598 Add -enable-experimental-dependencies and push it through. 2018-10-28 00:39:36 -07:00