Commit Graph

1953 Commits

Author SHA1 Message Date
swift-ci
c4b6f8912a Merge pull request #31003 from zoecarver/sil-parser/move-lib 2020-04-13 20:14:17 -07:00
zoecarver
6f339f800d [SIL] [Parser] Move ParserSIL into SIL library.
Move the source files from ParserSIL into the SIL library and remove the
ParserSIL library. ParsersSIL doesn't need to be its own library and this change will
simplify our builds.
2020-04-13 17:23:08 -07:00
Matt Davis
feb03ebcd7 [DiagnosticVerifier] Explicit convert a StringRef into a std::string.
The newer llvm StringRef library has removed the implicit StringRef to
std::string conversion.  (See: llvm/llvm-project@adcd026)

This patch also uses a StringRef to compare another StringRef
eliminating the need to perform a StringRef to std::string conversion.
I am concerned that StringRef's are being stored in
ExpectedEducationalNotes, but as long as the StringRef does not out live
the definition this is totally cool then.
2020-04-11 09:29:58 -07:00
Erik Eckstein
6da902ef8b Add an option to completely disable SIL verification.
This is useful to disable SIL verification in an assert build of the compiler.
2020-04-10 20:10:24 +02:00
Owen Voorhees
456081715e Merge pull request #30947 from owenv/verifier-asan-fix
[DiagnosticVerifier] Fix ASAN issue in the verifier
2020-04-10 11:25:51 -05:00
Owen Voorhees
20d3afc439 [DiagnosticVerifier] Fix ASAN issue where Twine was stored to a temporary 2020-04-10 04:53:05 -07:00
Owen Voorhees
cfbedd81c4 [DiagnosticVerifier] Add support for asserting presence of edu notes 2020-04-09 18:18:25 -07:00
omochimetaru
a07b35ab03 [Diagnostics] Improve {{none}} fix-it verifier (#30791)
* [Diagnostics] Improve {{none}} fix-it verifier

* split two conditions

* define "none" constant

* support plural

* use Twine and add comment for replacement range

* check if {{none}} is at the end

* use noneMarkerStartLoc

* update second {{none}} error message

Co-Authored-By: Owen Voorhees <owenvoorhees@gmail.com>

* update test case for second {{none}}

* fix test case for new {{none}} check

* Use named struct

* set const

Co-authored-by: Owen Voorhees <owenvoorhees@gmail.com>
2020-04-09 15:32:14 -07:00
Dan Zheng
2eb460de4d [AutoDiff upstream] Add forward-mode differentiation. (#30878)
JVP functions are forward-mode derivative functions. They take original
arguments and return original results and a differential function. Differential
functions take derivatives wrt arguments and return derivatives wrt results.

`JVPEmitter` is a cloner that emits JVP and differential functions at the same
time. In JVP functions, function applications are replaced with JVP function
applications. In differential functions, function applications are replaced
with differential function applications.

In JVP functions, each basic block takes a differential struct containing callee
differentials. These structs are consumed by differential functions.
2020-04-08 11:29:21 -07:00
Artem Chikin
0d1013245e Merge pull request #30782 from artemcm/Rcross-import
Add -Rcross-import option
2020-04-07 19:04:47 -07:00
Artem Chikin
b679fd8738 Add -Rcross-import option
It is an optional, user-accessible mechanism to have the compiler tell you what it’s cross-importing.

Resolves rdar://problem/60381893
2020-04-02 19:45:39 -07:00
Dan Zheng
1308fc69c5 [AutoDiff] Simplify conditions enabling differentiable programming. (#30765)
Previously, two conditions were necessary to enable differentiable programming:
- Using the `-enable-experimental-differentiable-programming` frontend flag.
- Importing the `_Differentiation` module.

Importing the `_Differentiation` module is the true condition because it
contains the required compiler-known `Differentiable` protocol. The frontend
flag is redundant and cumbersome.

Now, the frontend flag is removed.
Importing `_Differentiation` is the only condition.
2020-04-02 03:24:03 -07:00
Owen Voorhees
d6a2910f41 Update DiagnosticVerifier.cpp 2020-04-01 15:12:30 -07:00
Owen Voorhees
2c2850d7eb Merge branch 'master' into verifier-wording-fix 2020-04-01 17:05:24 -05:00
Arnold Schwaighofer
4f2d2ddd72 Merge pull request #30748 from aschwaighofer/irgen_disable_typelayout_witness_at_onone
IRGen: Disable type layout based value witness generation at Onone
2020-04-01 10:12:02 -07:00
Saleem Abdulrasool
023380189e Merge pull request #30732 from allevato/update-deps
Add dependencies where targets depend on inclusions from unspecified targets.
2020-04-01 09:23:48 -07:00
Arnold Schwaighofer
1bde486a63 IRGen: Disable type layout based value witness generation at Onone
Type layout based witness generation can emit quite complex IR that will
lead to code bloat if the llvm optimizer is not run.

No need to use type layouts at Onone.

rdar://61155295
2020-04-01 07:18:23 -07:00
Robert Widmann
a337b67f69 Stage In Flags To Fall Back To Manual Tracking
Request-based incremental dependencies are enabled by default. For the time being, add a flag that will turn them off and switch back to manual dependency tracking.
2020-03-31 16:16:53 -07:00
Tony Allevato
5284cb6f99 Add dependencies where targets depend on inclusions from unspecified targets.
A follow-up PR adds a flag to control an inline namespace that allows
symbols in libDemangling to be distinguished between the runtime and
the compiler. These dependencies ensure that the flag is plumbed
through for inclusions of Demangling headers that aren't already
covered by existing `target_link_libraries`.
2020-03-31 09:19:41 -07:00
Robert Widmann
58e63f7185 Merge pull request #28313 from owenv/verifier-consumer
[DiagnosticVerifier] Make DiagnosticVerifier a DiagnosticConsumer
2020-03-30 17:46:30 -07:00
Hamish Knight
d2434e1bf7 NFC: Rename NameBinding to ImportResolution 2020-03-29 18:43:58 -07:00
Owen Voorhees
465bab002f [DiagnosticVerifier] Make Diagnostic Verifier a DiagnosticConsumer subclass
Update DiagnosticVerifier to respect color flags

Improve DiagnosticVerifier test coverage

verifier updates to support new llvm stable branch
2020-03-28 12:29:53 -07:00
Owen Voorhees
791312fb74 Turn Educational Notes On-By-Default (#30583)
* [Diagnostics] Turn educational notes on-by-default

* [Diagnostics] Only include educational notes in printed output if -print-educational-notes is passed

* Make -print-educational-notes a driver option

* [Diagnostics] Issue a printed remark if educational notes are available, but disabled

* [docs] Update educational notes documentation and add a contributing guide

* [Diagnostics] Cleanup PrintingDiagnosticConsumer handling of edu notes

* Revert "[Diagnostics] Issue a printed remark if educational notes are available, but disabled"
For now, don't notify users if edu notes are available but disabled. This decision can be reevaluated later.
2020-03-27 15:29:48 -07:00
Nathan Hawes
4ccc95f9b2 Merge pull request #30636 from nathawes/cross-import-indexing
[Index] Add index support for cross import overlays.
2020-03-26 09:22:07 -07:00
Nathan Hawes
a785fa6cee [Frontend][Index] Add frontend option to skip indexing the stdlib (for test performance)
Several tests related to indexing system modules were taking a considerable
amount of time (100+ seconds in the worst case) indexing the standard library.
This adds a frontend option to skip it and updates those tests to pass it.
2020-03-25 14:36:23 -07:00
Dan Zheng
e5cb871428 [AutoDiff upstream] Add flag-gated AdditiveArithmetic derivation. (#30628)
Add `AdditiveArithmetic` derived conformances for structs, gated by the
`-enable-experimential-additive-arithmetic-derivation` flag.

Structs whose stored properties all conform to `AdditiveArithmetic` can derive
`AdditiveArithmetic`:
- `static var zero: Self`
- `static func +(lhs: Self, rhs: Self) -> Self`
- `static func -(lhs: Self, rhs: Self) -> Self`
- An "effective memberwise initializer":
  - Either a synthesized memberwise initializer or a user-defined initializer
    with the same type.

Effective memberwise initializers are used only by derived conformances for
`Self`-returning protocol requirements like `AdditiveArithmetic.+`, which
require memberwise initialization.

Resolves TF-844.
Unblocks TF-845: upstream `Differentiable` derived conformances.
2020-03-25 10:31:50 -07:00
omochimetaru
e1cb1a2057 Merge pull request #30501 from omochi/fix-verify-range
[Diagnostics] Fix range of fix-its in verify mode
2020-03-24 11:25:15 +09:00
Owen Voorhees
768c4385cf [DiagnosticVerifier] More accurate wording when printing diagnostics from external sources 2020-03-21 15:11:46 -07:00
Robert Widmann
55241243f7 Defensively copy obligation keys 2020-03-19 19:23:12 -07:00
Robert Widmann
ea3ef98139 Merge pull request #30302 from CodaFi/all-the-fixins
Teach the Dependency Verifier to Emit Fixits
2020-03-19 17:14:26 -07:00
Robert Widmann
6abf057dc7 Teach the verifier to emit fixits
Emit nicely formatted fixits that contain the expectations the user should have written.
2020-03-19 14:16:53 -07:00
Robert Widmann
21cfcfef2c Merge pull request #30505 from CodaFi/ligated-legacy
[NFC] Remove the Legacy Semantic Queries Bit
2020-03-19 13:45:27 -07:00
Joe Groff
b4abd44e03 Merge pull request #30479 from jckarter/disable-mangled-name-metadata
IRGen: Add a flag to disable mangled name type metadata accessors.
2020-03-19 12:01:38 -07:00
Robert Widmann
6d60d01420 [NFC] Remove the Legacy Semantic Queries Bit
Clients that wish to avoid semantic requests should decline to register
those requests.
2020-03-19 11:04:12 -07:00
omochimetaru
3ccec26390 [Diagnostics] Fix range of fix-its in verify mode 2020-03-19 18:47:57 +09:00
Xi Ge
5fba4b3e4c Merge pull request #30484 from nkcsgexi/58563540
ModuleInterface: consider inherited protocols from super class when collecting handled protocols
2020-03-18 21:34:23 -07:00
Xi Ge
45d0eca9c7 ModuleInterface: consider inherited protocols from super class when collecting handled protocols
Protocol conformances can be implied by super classes. When collecting the list
of IncludedProtocols, we should traverse the class inheritance chain and collect
all protocols.

Without this change, these implied conformances will be printed again via a synthesized
extension at the end of the Swift interface file, leading to an error of redundant
conformances when building modules.

rdar://58563540
2020-03-18 17:21:13 -07:00
Brent Royal-Gordon
cd7bc73a0a Merge pull request #30462 from brentdax/futures-end-part-two
Provide fallback SourceLoc for swiftinterface build errors
2020-03-18 16:23:49 -07:00
Joe Groff
72b13e8c65 IRGen: Add a flag to disable mangled name type metadata accessors.
Useful as a workaround for runtime demangler bugs, or in rare cases where there are
performance problems with the demangler.
2020-03-18 13:55:01 -07:00
Pavel Yaskevich
d6ebb03c97 Merge pull request #30247 from owenv/combined-descriptive-diag-flags
Support the combination of -enable-educational-notes and -enable-experimental-diagnostic-formatting
2020-03-18 09:44:29 -07:00
Brent Royal-Gordon
a27fdad4e5 Provide fallback SourceLoc for swiftinterface build errors
When a swiftinterface fails to build for any of various reasons, we try to diagnose the failure at the site of the `import` declaration. But if the import is implicitly added—which happens for many SDK modules, like the standard library and ClangImporter overlays—there is no source location for the import, so the error ends up being diagnosed at <unknown>:0. This causes a number of issues; most notably, Xcode doesn’t display the diagnostic as prominently as others.

This change falls back to diagnosing the error at line 1, column 1 of the swiftinterface file itself. This is perhaps not an ideal location, and it won’t help with I/O errors where we can’t open the swiftinterface file (and therefore can’t diagnose an error in it), but it should improve the way we display most module interface building errors.
2020-03-17 18:44:31 -07:00
Dmitri Gribenko
841eeb05b0 Merge pull request #30403 from MForster/forster/string-fixes
Cherry-pick StringRef->std::string conversion fixes into `master`
2020-03-17 12:09:36 +01:00
Robert Widmann
ecb58a12d7 Merge pull request #30439 from CodaFi/swift-is-an-untyped-languge-now-i-dont-make-the-rules
[NFC] Break TypeChecker Down Into a Namespace
2020-03-16 21:17:45 -07:00
Robert Widmann
70b6bbcb13 Remove swift::createTypeChecker
Replace it with the "legacy semantic queries" bit. The remaining client
of this bit is SourceKit, which appears to require this bit be set
conditionally so certain semantic property wrapper requests return
a sentinel value.

We should migrate these requests to a syntactic interface as soon as
possible.

rdar://60516325
2020-03-16 19:20:22 -07:00
Robert Widmann
52f4aba784 IRGen Requests
Implement the IRGen Request infrastructure and provide the first
request: generating IR from a given SourceFile.
2020-03-16 18:00:33 -07:00
Owen Voorhees
592ce68c55 Support the combination of -enable-educational-notes and -enable-experimental-diagnostic-formatting 2020-03-14 09:21:06 -07:00
Brent Royal-Gordon
5b7a13cf69 Merge pull request #30410 from brentdax/futures-end
Improve diagnostic for broken module interfaces
2020-03-14 01:25:58 -07:00
Brent Royal-Gordon
a7a5e340aa Improve diagnostic for broken module interfaces
Currently, when a swiftinterface file fails to load, we emit the specific diagnostics for the failures, followed by a generic “failed to load module ‘Foo’” message. This PR improves that final diagnostic, particularly when the cause may be that the interface was emitted by a newer compiler using backwards-incompatible syntax.
2020-03-13 20:31:55 -07:00
Michael Forster
345a9147ec Explicit SmallString->std::string conversion.
This is only needed temporarily until commit d7049213 from upstream
LLVM hits the swift/master branch.
2020-03-13 19:16:49 +01:00
Alex Langford
e92599fa63 Follow-up change to PR30186
`std::string(...)` -> `.str()`
2020-03-13 19:08:22 +01:00