Commit Graph

2818 Commits

Author SHA1 Message Date
Harlan
5e02d2a877 Implement #warning and #error (#14048)
* Implement #warning and #error

* Fix #warning/#error in switch statements

* Fix AST printing for #warning/#error

* Add to test case

* Add extra handling to ParseDeclPoundDiagnostic

* fix dumping

* Consume the right paren even in the failure case

* Diagnose extra tokens on the same line after a diagnostic directive
2018-02-03 18:07:05 -05:00
swift-ci
40d04786ab Merge remote-tracking branch 'origin/master' into master-next 2018-01-31 21:09:16 -08:00
swift-ci
26cc79d4df Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-31 20:58:20 -08:00
Saleem Abdulrasool
a134cdb2a3 SIL: use unsigned for the member for bool
Use `unsigned` instead of `bool` for the member to make all members of
the structure the same.  This fixes the behaviour of the structure on
Windows.  The difference in the type caused the bitfields to be pushed
to the natural alignment of int resulting in the structure being padded
to 12-bytes instead of being packed into 4.  Using `#pragma pack` also
did not make a difference here as the structure remained padded to
12-bytes.
2018-01-31 18:56:55 -08:00
swift-ci
044cb7b521 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-29 10:07:02 -08:00
swift-ci
736d66f34d Merge remote-tracking branch 'origin/master' into master-next 2018-01-29 09:45:28 -08:00
Arnold Schwaighofer
fac09e985b SIL : Use the enum 's generic signature and the payloads type for an indirect enum payload's box type.
i.e for:

enum Indirect<T> {
  indirect cast payload(first: T, second :T)
}

let _ = Indirect<X>

The payload's SIL box type will be:

$<t_0_0> { var (first: t_0_0, second: t_0_0) } <X>

rdar: //36799330
2018-01-27 15:33:47 -08:00
swift-ci
8e43888d75 Merge remote-tracking branch 'origin/master' into master-next 2018-01-26 15:59:34 -08:00
swift-ci
d73ff96f8d Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-26 15:46:32 -08:00
Joe Groff
d885098b58 Merge pull request #14169 from jckarter/optional-abi-check
SILGen: Accept optionals as ABI-compatible in either direction as block arguments.
2018-01-26 15:45:55 -08:00
Joe Groff
f9c267c9ef SILGen: Accept optionals as ABI-compatible in either direction as block arguments.
The thunking code we have for introducing runtime nil checks in thunks when an optional-to-non conversion appears in contravariant position doesn't handle blocks. This somehow-worked in previous versions of Swift (maybe due to assertions being off). Spot fix for rdar://problem/36843476.
2018-01-26 14:37:40 -08:00
swift-ci
b640284728 Merge remote-tracking branch 'origin/master' into master-next 2018-01-25 19:33:00 -08:00
swift-ci
eff5a1d0d7 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-25 19:24:58 -08:00
Michael Gottesman
950e55d899 [sil][typelowering] Inline (i.e. eliminate) the confusing method TypeLowering::getLoweringStyle() and change it to properly use TypeExpansionKind::None instead of TypeExpansionKind::DirectChildren for the non-expansion case.
Now we will consistently expand destroy_addr/copy_addr into either
{retain,release}_value or into ARC operations on its most derived descendents.
This will improve code-size (by not expanding when we didn't intend to), but
more importantly preserve invariants that the ARC optimizer depends upon.

rdar://36509461
2018-01-25 14:09:57 -08:00
swift-ci
7e604361f0 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-24 18:01:06 -08:00
swift-ci
542c60c6ea Merge remote-tracking branch 'origin/master' into master-next 2018-01-24 17:57:25 -08:00
Michael Gottesman
d14024acd3 [sil][typelowering] Rename the enum LoweringStyle => TypeExpansionKind and add a None case to make its usage clearer.
This enum controls how certain routines in TypeLowering potentially expand types
when performing copy_value/destroy_value operations. Its previous form was
problematic because:

1. The name LoweringStyle does't suggest anything related to expansion really.
The new has the word expansion in it explicitly.
2. The cases of LoweringStyle used to be Shallow, Deep. This caused confusion
since Shallow (the base case) was not a no-op. It just caused us to expand into
children. Now TypeExpansionKind has 3 cases to make this clear: None,
DirectChildren, and MostDerivedDescendents.

Confusion around this API caused us to canonicalize ARC operations differently
for different operations (e.g. copy_value/destroy_value vs
copy_addr/destroy_addr). This caused us to misout on some code-size wins (since
we were splitting some operations onto DirectChildren of aggregates), but more
importantly also caused the optimizer to break an invariant that the ARC
optimizer relied upon: local semantic pairings being at the same level of
abstraction. In a subsequent commit, I am going to fix that bug.

rdar://36509461
2018-01-24 16:28:03 -08:00
swift-ci
6d20635bb8 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-22 13:58:22 -08:00
swift-ci
63dc8bc06d Merge remote-tracking branch 'origin/master' into master-next 2018-01-22 13:50:55 -08:00
swift-ci
7f8c59eb31 Merge pull request #13898 from atrick/verify-inoutalias 2018-01-22 13:46:04 -08:00
swift-ci
80f654eaf6 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-21 12:58:12 -08:00
swift-ci
f3bc1d6cec Merge remote-tracking branch 'origin/master' into master-next 2018-01-21 12:49:06 -08:00
Slava Pestov
1831b5471e SIL: Clean up 'early serialization' a bit
- Clear the 'serialized' flag on witness tables and vtables
  after serialization, not just functions. This fixes SIL
  verifier failures if post-serialization SIL is printed
  out and parsed back in.

- Clear the 'serialized' flag when deserializing functions,
  witness tables and vtables in a module that has already
  been serialized. This fixes SIL verifier failures if
  we deserialize more declarations after serializing SIL.

We were seeing SIL verifier failures on bots that run the
tests with the stdlib built with non-standard flags.

Unfortunately I don't have a reduced test case that would
fail in PR testing without these fixes.

Fixes <rdar://problem/36682929>.
2018-01-21 01:35:13 -08:00
swift-ci
3e5193bf0b Merge remote-tracking branch 'origin/master' into master-next 2018-01-19 00:09:34 -08:00
swift-ci
542410aed2 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-18 23:58:15 -08:00
Doug Gregor
40283f9b73 [ABI] Add the protocol conformance descriptor into a witness table.
Extend witness tables with a pointer to the protocol conformance
descriptor from which the witness table was generated. This will allow
us to determine (for example) whether two witness tables were
generated from the same (or equivalent) conformances in the future, as
well as discover more information about the witness table itself.

Fixes rdar://problem/36287959.
2018-01-18 17:13:13 -08:00
swift-ci
fc2e2ee06e Merge remote-tracking branch 'origin/master' into master-next 2018-01-17 23:53:17 -08:00
swift-ci
9030475fae Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-17 20:12:00 -08:00
Adrian Prantl
b4781f63ef Debug Info: Create artificial functions in a virtual file <compiler-generated>.
For the majority of artificial helper functions the filename is
actively misleading since it usually represents the file of the caller
that triggered the helper to be generated. Instead, this patch creates
a virtual filname `<compiler-generated>` to make it very obvious that
the function has not correspondence to any source code.

<rdar://problem/33809560>
2018-01-17 11:09:35 -08:00
swift-ci
dc3be1bc46 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-16 15:01:33 -08:00
swift-ci
793fec37eb Merge remote-tracking branch 'origin/master' into master-next 2018-01-16 14:57:26 -08:00
Slava Pestov
9b0f6fca53 IRGen: Emit class dispatch thunks in IRGen instead of SILGen
This allows us to re-use the same code for emitting protocol dispatch
thunks.
2018-01-15 22:38:16 -08:00
swift-ci
5891e582f6 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-15 16:38:53 -08:00
swift-ci
ff3d0b22e0 Merge remote-tracking branch 'origin/master' into master-next 2018-01-15 16:29:12 -08:00
Andrew Trick
fb42d85dc3 Verify @inout_aliasable captures.
This is currently only done in DiagnoseStaticExclusivity because AllocBoxToStack
doesn't know how to set @noescape function types yet.
2018-01-15 13:46:02 -08:00
swift-ci
f7bcd1fc0e Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-14 23:19:03 -08:00
swift-ci
0deb3365f8 Merge remote-tracking branch 'origin/master' into master-next 2018-01-14 23:09:34 -08:00
Slava Pestov
c857a480e1 SIL: Introduce SILLinkage::PublicNonABI
This is going to be used for "always emit into client" functions,
such as default argument generators and stored property
initializers.

- In dead function elimination, these functions behave identically to
  public functions, serving as "anchors" for the mark-and-sweep
  analysis.

- There is no external variant of this linkage, because external
  declarations can use HiddenExternal linkage -- the definition should
  always be emitted by another translation unit in the same Swift
  module.

- When deserialized, they receive shared linkage, because we want the
  linker to coalesce multiple copies of the same deserialized
  definition if it was deserialized from multiple translation units
  in the same Swift module.

- When IRGen emits a definition with this linkage, it receives the
  same LLVM-level linkage as a hidden definition, ensuring it does not
  have a public entry point.
2018-01-14 22:59:40 -08:00
Slava Pestov
48897ded11 SIL: Remove never-emitted SILDeclRef::Kind::GlobalGetter 2018-01-14 21:39:53 -08:00
swift-ci
c7446e17f9 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-13 11:38:51 -08:00
swift-ci
4b8456f50f Merge remote-tracking branch 'origin/master' into master-next 2018-01-13 11:29:52 -08:00
Slava Pestov
f8ceae8aef SIL: Remove isLessVisibleThan()
Another cleanup before I add a new SILLinkage kind.

This operation is difficult to reason about and was only used by
the SIL verifier. Replace the SIL verifier checks with simpler
operations.

I still need to revisit and uncomment the default witness table
visibility check. Right now we serialize default witness tables,
but default witness thunks have private linkage, which is
clearly wrong.
2018-01-13 01:03:48 -08:00
swift-ci
6382b98251 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-13 00:20:02 -08:00
swift-ci
e44e13f5c4 Merge remote-tracking branch 'origin/master' into master-next 2018-01-13 00:10:15 -08:00
Slava Pestov
48d0407f43 SIL: Remove SILFunction::{is,set}KeepAsPublic() 2018-01-12 22:08:00 -08:00
swift-ci
21343fd342 Merge remote-tracking branch 'origin/master' into master-llvm-swift5-transition 2018-01-12 14:18:57 -08:00
swift-ci
957b3897d7 Merge remote-tracking branch 'origin/master' into master-next 2018-01-12 14:09:52 -08:00
John McCall
52bb547a7e Merge pull request #13866 from rjmccall/accessor-decl
Split AccessorDecl out from FuncDecl.  NFC.
2018-01-12 17:02:35 -05:00
John McCall
7f0f8830cd Split AccessorDecl out from FuncDecl. NFC.
This has three principal advantages:

- It gives some additional type-safety when working
  with known accessors.

- It makes it significantly easier to test whether a declaration
  is an accessor and encourages the use of a common idiom.

- It saves a small amount of memory in both FuncDecl and its
  serialized form.
2018-01-12 14:20:27 -05:00
swift-ci
8a7d0fbc03 Merge remote-tracking branch 'origin/master' into master-next 2018-01-11 18:29:32 -08:00