Commit Graph

4604 Commits

Author SHA1 Message Date
swift-ci
f15cad3609 Merge remote-tracking branch 'origin/master' into master-next 2017-04-28 20:08:31 -07:00
Doug Gregor
447dce6c1f Merge pull request #9004 from itaiferber/swift-archival-serialization
Swift Archival & Serialization API
2017-04-28 20:02:33 -07:00
swift-ci
cdde06ac25 Merge remote-tracking branch 'origin/master' into master-next 2017-04-27 15:56:02 -07:00
adrian-prantl
b25d44302f Merge pull request #6403 from adrian-prantl/29481673
Represent Swift errors as DW_TAG_thrown_type in DWARF
2017-04-27 11:28:46 -07:00
Adrian Prantl
d50448a55f Represent Swift errors as DW_TAG_thrown_type in DWARF
This allows the debugger to display them alongside the function's
return value when finish-ing a function.

rdar://problem/29481673
2017-04-27 09:45:54 -07:00
Huon Wilson
9a255607ee [IRGen] Visibility of deleted private method vtable stubs should match original.
Previously this would mean something like

    class C {
        private func f() {}
    }

would end up with the symbol for f being completely public (external,
default visibility), even though it only needs to match the internal
class (external, hidden visibility).
2017-04-26 16:57:54 -07:00
Arnold Schwaighofer
422ab072a6 Merge pull request #8932 from aschwaighofer/irgen_enum_primitive_copy_as_memcpy
IRGen: Enums - Use memcpy for indirectly primitive copying fixed size types
2017-04-26 14:24:34 -07:00
swift-ci
0bf7a00c3f Merge pull request #8879 from aschwaighofer/wip_use_llvm_codegen_Os_heuristics_instead_of_O3 2017-04-26 13:11:34 -07:00
Itai Ferber
e2318392be Add CodingKey and *codable derived conformance
* Allow CodingKey conformance to be automatically derived for enums
  which have no raw type (with no associated values) and which have
  a raw type of String or Int.
* Allow Encodable and Decodable conformance to be automatically derived
  for classes and structs with Encodable/Decodable properties
* Add initial unit tests for verifying derived conformance
2017-04-25 13:13:35 -07:00
Slava Pestov
454495f974 IRGen: Subclass existential scalar downcasts
This handles the case where the left hand side of the cast is known
to be class-like, and the right hand side is known at compile time
to be a protocol composition type.

Note that this change results in a small optimization -- a checked
cast of a metatype known to be a class metatype to a class-constrained
existential metatype no longer has to emit an explicit check that
the source is class-constrained.

Fully dynamic casts are coming up next.
2017-04-25 02:42:14 -07:00
Slava Pestov
a2c1548055 IRGen: Fix type conversion of protocol compositions containing a generic superclass constraint
Do the same thing we do for nominal types, where if the type
contains an archetype, just mangle the unbound generic form,
since the name is just for documentation purposes in LLVM IR
dumps and does not have to be unique.

This is tested as part of an upcoming patch.
2017-04-25 01:32:45 -07:00
Slava Pestov
cb95ee3581 IRGen: Don't crash when emitting a capture descriptor containing an opened existential 2017-04-25 01:32:45 -07:00
Arnold Schwaighofer
ae46d52d9b IRGen: Fix undefined behavior virtual class without virtual destructor 2017-04-24 18:22:49 -07:00
swift-ci
771cdb8a82 Merge remote-tracking branch 'origin/master' into master-next 2017-04-24 11:08:52 -07:00
Jordan Rose
e575d2d5ba [ClangImporter] Error structs from enums are not imported decls.
Enums with the ns_error_domain attribute represent codes for NSError,
which means Swift developers will expect to interact with them in
terms of Error. SE-0112 improved bridging for these enums to generate
a struct with the following form:

    struct MyError: Error {
      @objc enum Code: RawRepresentable {
        case outOfMemory
        case fileNotFound
      }
      var userInfo: [NSObject: AnyObject] { get }
      static var outOfMemory: Code { get }
      static var fileNotFound: Code { get }
    }

where MyError.Code corresponds to the original MyError enum defined in
Objective-C. Until recently, both the enum and the synthesized struct
were marked as having the original enum as their "Clang node", but
that leads to problems: the struct isn't really ObjC-compatible, and
the two decls have the same USR. (The latter had already been worked
around.)

This commit changes the struct to be merely considered a synthesized
"external definition", with no associated Clang node. This meant
auditing everywhere that's looking for a Clang node and seeing which
ones applied to external definitions in general.

There is one regression in quality here: the generated struct is no
longer printed as part of the Swift interface for a header file, since
it's not actually a decl with a corresponding Clang node. The previous
change to AST printing mitigates this a little by at least indicating
that the enum has become a nested "Code" type.
2017-04-24 09:57:41 -07:00
swift-ci
cce9eb4f8d Merge remote-tracking branch 'origin/master' into master-next 2017-04-23 01:48:58 -07:00
John McCall
978f0e05fe Add unpaired access marker instructions and use them to implement
dynamic access tracking in materializeForSet.
2017-04-22 22:52:13 -04:00
swift-ci
4ef7b46971 Merge remote-tracking branch 'origin/master' into master-next 2017-04-21 18:08:32 -07:00
Joe Groff
3d178be169 Merge pull request #8875 from jckarter/keypaths
Keypaths
2017-04-21 17:51:17 -07:00
Arnold Schwaighofer
ba0299bf0c IRGen: Enums - Use memcpy for indirectly primitive copying fixed size types
There is no value in exploding the schema. Exploding the schema only increases
code size for large enums.

rdar://31685718
2017-04-21 16:56:53 -07:00
Joe Groff
d5cdf658da KeyPaths: Generate _kvcKeyPathString for ObjC-compatible keypaths. 2017-04-21 16:56:17 -07:00
Arnold Schwaighofer
5b80649dec IRGen: Use LLVM -Os mode to compile swift
We don't want LLVM aggresively inlining llvm.memcpy instructions and similar
aggressive optimizations to save code size.

For example the X86 target sets max stores per memset to 16 and max stores per
memcpy to 8 (vs 4).

Loop optimizations are also a lot more aggressive.

rdar://31691017
2017-04-20 07:59:39 -07:00
swift-ci
faa74d7167 Merge remote-tracking branch 'origin/master' into master-next 2017-04-20 01:48:41 -07:00
Slava Pestov
f4b91cd118 AST: Remove unused 'resolver' argument from TypeBase::getSuperclass() 2017-04-20 00:37:38 -07:00
Joe Groff
595e0e4ede Merge branch 'master' into keypaths 2017-04-19 18:38:24 -07:00
swift-ci
837f2573fa Merge remote-tracking branch 'origin/master' into master-next 2017-04-19 13:28:31 -07:00
Slava Pestov
53305f1e58 Merge pull request #8847 from slavapestov/subclass-existentials-clang-importer
ClangImporter: Support for subclass existentials
2017-04-19 13:27:02 -07:00
swift-ci
a38445389f Merge remote-tracking branch 'origin/master' into master-next 2017-04-19 00:08:33 -07:00
swift-ci
504b6f2a55 Merge pull request #8852 from DougGregor/protocol-conformance-cleanups 2017-04-19 00:05:06 -07:00
Joe Groff
a6cd471c2b IRGen/stdlib: Instantiate non-generic computed key path components. 2017-04-18 21:51:12 -07:00
Slava Pestov
2ec32c2d77 IRGen: Allow pure-ObjC refcounting class existentials
Class-constrained existentials usually have unknown
reference counting in Swift, because they can contain
either Objective-C or native Swift classes.

But if the class existential has a superclass bound
which is known to be an imported Objective-C class,
we can use Objective-C reference counting instead of
unknown reference counting.

This is tested with the next commit that adds
ClangImporter support.
2017-04-18 21:19:45 -07:00
adrian-prantl
1c59fc48c0 Merge pull request #8843 from adrian-prantl/31205000
Adopt to upstream changes.
2017-04-18 17:58:06 -07:00
Doug Gregor
ebdd56a1f0 [AST] Eliminate the "interface type" from protocol conformances.
We don't need this notion.
2017-04-18 17:15:15 -07:00
swift-ci
000387aa9e Merge remote-tracking branch 'origin/master' into master-next 2017-04-18 16:28:31 -07:00
practicalswift
56a9c88ca6 [gardening] Remove unused method getLoweredDynamicallyEnforcedAddress(SILValue) 2017-04-18 23:22:43 +02:00
Bob Wilson
df1b64eaa7 Update uses of DIBuilder.createPointerType to match LLVM r297320.
This function has a new argument to specify a DWARFAddressSpace value.
There is a default value but since it was not added as the last argument,
Swift needs to update calls that specify the optional pointer type name
argument.

(cherry picked from commit 21ddc5c087)
(cherry picked from commit 915cda6a05cf7c7eddbb79af14a023914cb9cea9)
2017-04-18 12:24:07 -07:00
Joe Groff
4522cd09aa SILGen: Tweak key path computed property lowering to produce a consistent runtime-callable ABI. 2017-04-18 11:44:39 -07:00
swift-ci
ae1eb1197c Merge remote-tracking branch 'origin/master' into master-next 2017-04-18 11:08:33 -07:00
Huon Wilson
53b4e7044f Merge pull request #8822 from huonw/symbol-list-5
Yet more TBDGen work: mostly classes.
2017-04-18 11:04:57 -07:00
John McCall
7a4c761426 Merge pull request #8821 from rjmccall/dynamic-enforcement-vol-1
Basic dynamic enforcement of exclusivity
2017-04-18 13:57:54 -04:00
swift-ci
3098fc666a Merge remote-tracking branch 'origin/master' into master-next 2017-04-18 10:28:41 -07:00
John McCall
6c16cfaa14 Implement a basic dynamic-enforcement runtime and teach IRGen to use it. 2017-04-18 11:23:43 -04:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02:00
swift-ci
81ac1eb04a Merge remote-tracking branch 'origin/master' into master-next 2017-04-18 02:28:31 -07:00
Slava Pestov
7e0e5f1754 IRGen: Clang type lowering for subclass existentials
It looks like this is really only used in one place, the
"extended encoding" for @objc protocol metadata.

If it wasn't for that, we could just lower all class and
existential types as 'id'.
2017-04-18 00:34:18 -07:00
Joe Groff
0bb83bb185 KeyPaths: Support out-of-place instantiation of generic key paths. 2017-04-17 22:36:26 -07:00
Joe Groff
aaddafa55b IRGen: Support for generic key path patterns. 2017-04-17 17:50:57 -07:00
Vedant Kumar
451faec864 [Coverage] Fix use-after-scope bug
Found by ASAN:
<rdar://problem/31670782>

Introduced while integrating an API update for getInstrProfSectionName.
2017-04-17 17:35:32 -07:00
swift-ci
05599208ee Merge remote-tracking branch 'origin/master' into master-next 2017-04-17 17:08:32 -07:00
Slava Pestov
497336c4bc IRGen: Use the right reference counting for subclass existentials 2017-04-17 17:22:28 -06:00