Commit Graph

1737 Commits

Author SHA1 Message Date
Robert Widmann
7cd3541c62 Merge pull request #41656 from MillerTechnologyPeru/feature/ppc32
[stdlib] Added PowerPC 32-bit support
2022-03-07 15:08:26 -08:00
Alsey Coleman Miller
b85e673a78 [stdlib] Added Armv5 support 2022-03-06 00:56:32 -05:00
Becca Royal-Gordon
bbcd980aff Add flag for minimum inlining version 2022-03-04 10:54:52 -08:00
Alsey Coleman Miller
0ab3eec987 Added PowerPC 32-bit support 2022-03-03 22:21:33 -05:00
Ben Langmuir
5ce7bf9c18 Use std::reverse_iterator_range
We're using c++14, so no need to use the llvm:: copy of this. The llvm
version is going away, so this fixes build errors on the "next" branch.
2022-02-24 13:49:28 -08:00
Rintaro Ishizaki
7486cd1c21 [SwiftCompiler] Move common bridging facilities to 'Basic'
A preparation for AST/DiagnosticEngine bridging
2022-02-20 22:06:39 -08:00
Rintaro Ishizaki
7ef93b2a67 [Basic] Move copyCString to Basic/StringExtras.
Also, use StringRef.copy() instead of copyString().
2022-02-18 11:34:45 -08:00
John McCall
54c38cbb71 Fix and generalize the printing of suppressible features,
and make `@_unsafeInheritExecutor` a suppressible feature.

Some language features are required in order to parse a
declaration correctly, but some can safely be ignored.
For the latter, we'd like the module interface to simply
contain the declaration twice, once with the feature and
once without.  Some basic support for that was already
added for the SpecializeAttributeWithAvailability feature,
but it didn't interact correctly with required features
that might be checked in the same `#if` clause (it simply
introduced an `#else`), and it wasn't really set up to
allow multiple features to be handled this way.  There
were also a few other places that weren't updated to
handle this, presumably because they never coincided
with a `@_specialize` attribute.

Introduce the concept of a suppressible feature, which
is anything that the ASTPrinter can modify the current
PrintOptions in order to suppress.  Restructure the
printing of compatibility checks so that we can print
the body multiple times with different settings.
Print required feature checks in an outer `#if...#endif`,
then perform a separate `#if...#else...#endif` within
if we have suppressible features.  If there are multiple
suppressible features, check for the most recent first,
on the assumption that it will imply the rest; then
perform subsequent checks with an `#elsif` clause.

This should be a far more solid foundation on which to
build compatibility checks in the future.

`@_unsafeInheritExecutor` needs to be suppressible
because it's been added to some rather important
existing APIs.  Simply suppressing the entire decl will
effectively block old tools from using a new SDK to
build many existing projects (if they've adopted
`async`).  Dropping the attribute changes the semantics
of these functions, but only if the compiler features
the SE-0338 scheduling change; this is a very narrow
window of main-branch development builds of the tools,
none of which were officially released.
2022-02-16 16:58:56 -05:00
Anthony Latsis
8e4ea9b01a [NFC] DiagnosticVerifier: Move 'getColumnNumber' into SourceManager 2022-01-31 05:04:09 +03:00
Becca Royal-Gordon
1275e626be Merge pull request #41035 from beccadax/dont-take-this-literally
Don't import string macros with invalid UTF-8
2022-01-27 13:56:28 -08:00
Becca Royal-Gordon
4bd532ab9a Don't import string macros with invalid UTF-8
Swift string literals are only permitted to contain well-formed UTF-8, but C does not share this restriction, and ClangImporter wasn't checking for that before it created `StringLiteralExpr`s for imported macros; this could cause crashes when importing a header. This commit makes us drop these macros instead.

Although invalid UTF-8 always *did* cause a segfault in my testing, I'm not convinced that there isn't a way to cause a miscompile with a bug like this. If we somehow did generate code that fed ill-formed UTF-8 to the builtin literal init for Swift.String, the resulting string could cause undefined behavior at runtime. So I have additionally added a defensive assertion to StringLiteralInst that any UTF-8 string represented in SIL is well-formed. Hopefully that will catch any non-crashing compiler bugs like this one.

Fixes rdar://67840900.
2022-01-26 20:57:13 -08:00
Doug Gregor
c7a5049a28 Separate the C++ and Objective-C generated header output types.
Otherwise, when an output file map is provided, we'll use the same
path for both. Fixes rdar://87987062.
2022-01-25 22:53:03 -08:00
swift-ci
41ef4e8c9d Merge remote-tracking branch 'origin/main' into rebranch 2021-12-20 09:15:08 -08:00
Alex Hoppen
669e3f34a6 Merge pull request #40155 from ahoppen/pr/improve-module-search-path-lookup
[Serialization] Improve module loading performance
2021-12-20 18:09:17 +01:00
swift-ci
a496a9490a Merge remote-tracking branch 'origin/main' into rebranch 2021-12-16 08:39:25 -08:00
Xi Ge
28eef324d0 Frontend: support emitting ABI descriptor when specifying the path in supplementary output map. rdar://86559811 2021-12-15 22:42:15 -08:00
Alex Hoppen
fe7878ecce [Serialization] Improve module loading performance
When looking for a Swift module on disk, we were scanning all module search paths if they contain the module we are searching for. In a setup where each module is contained in its own framework search path, this scaled quadratically with the number of modules being imported. E.g. a setup with 100 modules being imported form 100 module search paths could cause on the order of 10,000 checks of `FileSystem::exists`. While these checks are fairly fast (~10µs), they add up to ~100ms.

To improve this, perform a first scan of all module search paths and list the files they contain. From this, create a lookup map that maps filenames to the search paths they can be found in. E.g. for
```
searchPath1/
  Module1.framework

searchPath2/
  Module1.framework
  Module2.swiftmodule
```
we create the following lookup table
```
Module1.framework -> [searchPath1, searchPath2]
Module2.swiftmodule -> [searchPath2]
```
2021-12-14 12:44:13 +01:00
swift-ci
ee96d2798c Merge remote-tracking branch 'origin/main' into rebranch 2021-11-30 08:33:02 -08:00
Saleem Abdulrasool
910fbee14e gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew
when building on Linux.  This helps identify actual issues when
building which can get lost in the stream of warning messages.  It also
helps restore the ability to build the compiler with gcc.
2021-11-27 11:40:17 -08:00
swift-ci
e7200268ed Merge remote-tracking branch 'origin/main' into rebranch 2021-11-13 09:34:28 -08:00
Artem Chikin
40a1b321f5 Add libSwiftScan entry-point to query target info.
This provides the library with functionality to answer `-print-target-info` queries in place of calls to `swift-frontend`.
2021-11-12 11:01:45 -08:00
Evan Wilde
6cc002012f Update ByteStream APIs from 32 to 64 bit
The ByteStream APIs were updated from 32 to 64 bits in LLVM.

Updating methods in the ExponentialGrowthAppendingBinaryByteStream.
2021-10-21 13:40:42 -07:00
Evan Wilde
a5f11c4851 Fix the main->next merge conflicts
This cleans up all of the merge conflicts from main into next after the
rebranch merge.
2021-10-15 15:57:55 -07:00
Ben Barham
624337148b [NFC] Formatting cleanup to help with next conflicts 2021-10-15 17:15:51 +10:00
Doug Gregor
a91feb3309 Update the OS runtime mapping for Apple OS versions.
Fixes the rest of rdar://84065193, makingn sure we don't link against
compatibility libraries we don't need.
2021-10-13 23:02:11 -07:00
swift_jenkins
66ebca7439 Merge remote-tracking branch 'origin/main' into next 2021-10-04 23:00:40 -07:00
Richard Howell
140c02466a Add -prefix-serialized-debugging-options (#39555)
This commit adds a new frontend flag that applies debug path prefixing to the
paths serialized in swiftmodule files. This makes it possible to use swiftmodule
files that have been built on different machines by applying the inverse map
when debugging, in a similar fashion to source path prefixing.

The inverse mapping in LLDB will be handled in a follow up PR.

Second pass at #39138

Tests updated to handle windows path separators.

This reverts commit f5aa95b381.
2021-10-04 22:41:32 -07:00
swift_jenkins
e8bfb5c8ec Merge remote-tracking branch 'origin/main' into next 2021-10-01 11:54:40 -07:00
Saleem Abdulrasool
f5aa95b381 Revert "Add -prefix-serialized-debugging-options" (#39544)
Reverts #39138

This is causing a failure on Windows: https://ci-external.swift.org/job/oss-swift-windows-x86_64-vs2019/6659/consoleText
2021-10-01 11:19:44 -07:00
swift-ci
c51550f30e Merge remote-tracking branch 'origin/main' into rebranch 2021-09-30 15:11:41 -07:00
swift_jenkins
390be2244b Merge remote-tracking branch 'origin/main' into next 2021-09-30 14:20:59 -07:00
Richard Howell
58d67be645 Add ClangImporterOptions::getRemappedExtraArgs
This commit adds a function to remap the clang arguments passed
during compilation. This is intented to be shared across the
Swift compiler and LLDB to apply path remapping for debug info
paths.
2021-09-30 08:13:28 -07:00
swift_jenkins
31a5a3401d Merge remote-tracking branch 'origin/main' into next 2021-09-27 16:41:29 -07:00
Doug Gregor
f4aa6266df arm64 macOS was introduced with version Swift
Generalize the check from arm64e to also include arm64. Fixes
rdar://83502661.
2021-09-27 14:05:25 -07:00
swift_jenkins
88460388ae Merge remote-tracking branch 'origin/main' into next 2021-09-27 09:21:05 -07:00
swift-ci
899723065c Merge remote-tracking branch 'origin/main' into rebranch 2021-09-27 09:13:14 -07:00
Alastair Houghton
8be084f30a Merge pull request #39187 from al45tair/problem/79725187
[Demangler] Improve remangler error handling
2021-09-27 17:03:49 +01:00
swift_jenkins
d572e4125f Merge remote-tracking branch 'origin/main' into next 2021-09-24 11:01:15 -07:00
swift-ci
220daa4c05 Merge remote-tracking branch 'origin/main' into rebranch 2021-09-24 10:53:33 -07:00
Kuba Mracek
b073df2c6d 64-bit watchOS should imply a 5.3 minimum version of the Swift runtime 2021-09-23 18:02:56 -07:00
swift_jenkins
392072a249 Merge remote-tracking branch 'origin/main' into next 2021-09-21 21:21:27 -07:00
swift-ci
5f454ca504 Merge remote-tracking branch 'origin/main' into rebranch 2021-09-21 21:13:29 -07:00
Kuba (Brecka) Mracek
942b0e8a63 The concurrency compat library should not be unconditionally used in arm64e builds (#39385) 2021-09-21 21:01:21 -07:00
swift_jenkins
45402f827a Merge remote-tracking branch 'origin/main' into next 2021-09-21 17:01:40 -07:00
swift-ci
4ec5df9a2a Merge remote-tracking branch 'origin/main' into rebranch 2021-09-21 16:53:46 -07:00
Alexis Laferrière
362cacf5a1 [Basic] Update getSwiftRevision to return a StringRef 2021-09-21 10:02:40 -07:00
swift_jenkins
11d6966f09 Merge remote-tracking branch 'origin/main' into next 2021-09-08 14:22:36 -07:00
swift-ci
b627a0c01e Merge remote-tracking branch 'origin/main' into rebranch 2021-09-08 14:13:13 -07:00
Argyrios Kyrtzidis
8c1b3004a4 [Basic/Darwin] Follow the llvm convention of including additional code with .inc extension, instead of .cpp 2021-09-08 09:59:07 -07:00
Alastair Houghton
3f01f853a6 [Demangling] Add error handling to the remangler.
Mangling can fail, usually because the Node structure has been built
incorrectly or because something isn't supported with the old remangler.
We shouldn't just terminate the program when that happens, particularly
if it happens because someone has passed bad data to the demangler.

rdar://79725187
2021-09-06 17:49:09 +01:00