Commit Graph

1537 Commits

Author SHA1 Message Date
Slava Pestov
ba82fab4b2 AST: Remove last usages of getEffectiveAccess() from AST 2017-06-08 22:32:04 -07:00
swift-ci
9a1c2f49ca Merge remote-tracking branch 'origin/master' into master-next 2017-06-05 20:08:35 -07:00
Jordan Rose
f0aca936c7 Allow '@objc(RuntimeName)' on classes with generic ancestry.
This is accomplished by recognizing this specific situation and
replacing the 'objc' attribute with a hidden '_objcRuntimeName'
attribute. This /only/ applies to classes that are themselves
non-generic (including any enclosing generic context) but that have
generic ancestry, and thus cannot be exposed directly to Objective-C.

This commit also eliminates '@NSKeyedArchiverClassName'. It was
decided that the distinction between '@NSKeyedArchiverClassName' and
'@objc' was too subtle to be worth explaining to developers, and that
any case where you'd use '@NSKeyedArchiverClassName' was already a
place where the ObjC name wasn't visible at compile time.

This commit does not update diagnostics to reflect this change; we're
going to change them anyway.

rdar://problem/32414557
2017-06-05 17:32:25 -07:00
swift-ci
dc6e1cf329 Merge remote-tracking branch 'origin/master' into master-next 2017-05-15 12:29:07 -07:00
Doug Gregor
7955aa13e6 Rename @NSKeyedArchive* attributes.
@NSKeyedArchiveLegacy -> @NSKeyedArchiverClassName
@NSKeyedArchiveSubclassesOnly -> @NSKeyedArchiverEncodeNonGenericSubclassesOnly

Fixes rdar://problem/32178796.
2017-05-15 11:02:31 -07:00
Max Moiseev
614bb13cbf Merge remote-tracking branch 'origin/master' into master-next 2017-05-11 11:29:22 -07:00
Jordan Rose
4cdb597b23 Rename VTablePlaceholderDecl to MissingMemberDecl.
As such, we no longer insert two placeholders for initializers that
need two vtable slots; instead we record that in the
MissingMemberDecl. I can see MissingMemberDecl growing to be something
we'd actually show to users, that can be used for other kinds of
declarations that don't have vtable entries, but for now I'm not going
to worry about any of that.
2017-05-10 11:55:55 -06:00
Jordan Rose
82930033d2 Add VTablePlaceholderDecl (but don't hook it up to anything yet). 2017-05-10 11:55:54 -06:00
swift-ci
4ebe4afe2a Merge remote-tracking branch 'origin/master' into master-next 2017-05-09 13:28:49 -07:00
Slava Pestov
59ed555b09 SIL: Simplify SILDeclRef constructor usages 2017-05-09 00:16:47 -07:00
Bob Wilson
45317fc03e Merge branch 'master' into master-next 2017-05-08 23:44:23 -07:00
Erik Eckstein
b1d5c77cec Runtime support for the NSArchiver class attributes.
Register class names for NSKeyedArchiver and NSKeyedUnarchiver based on the @NSKeyedArchiveLegacy and @_staticInitializeObjCMetadata class attributes.

@NSKeyedArchiveLegacy registers a class name translation.
@_staticInitializeObjCMetadata just makes sure that the metadata of a class is instantiated.

This registration code is executed as a static initializer, like a C++ global constructor.
2017-05-08 14:00:03 -07:00
Bob Wilson
8d61e93e81 Adapt to LLVM r301812 rename of WeakVH to WeakTrackingVH 2017-05-07 22:25:49 -07:00
Bob Wilson
e24a6f1d30 Adjust addAttributes calls for LLVM r301981
These now take an AttrBuilder argument instead of an AttributeList.
2017-05-06 21:37:22 -07:00
swift-ci
502bda365b Merge remote-tracking branch 'origin/master' into master-next 2017-05-05 13:48:34 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
swift-ci
c5c4728427 Merge remote-tracking branch 'origin/master' into master-next 2017-05-04 09:08:33 -07:00
Arnold Schwaighofer
e0e355550b IRGen: Use link_once instead of external for private decls
We can get duplicate symbols for accessors IRGen creates per IGM instance e.g
for lazy protocol witness table accessors.

(A better but more risky fix is to hoist the caching of the accessors to
IRGenerator so that we only generate them once per module to begin with)

Yes I owe a test case here ...

rdar://31988578
2017-05-04 08:08:12 -07:00
swift-ci
2776eff8f4 Merge remote-tracking branch 'origin/master' into master-next 2017-05-02 22:08:33 -07:00
Slava Pestov
b5721e8d8e AST: Remove AnyObject protocol 2017-05-02 19:45:00 -07:00
swift-ci
1378be1c6d Merge remote-tracking branch 'origin/master' into master-next 2017-05-01 15:55:31 -07:00
Joe Shajrawi
0d0cac357a retain_value_addr and release_value_addr SIL instructions: take as an input an address, load the value inside it and call retain_value and release_value respectively 2017-04-30 10:23:55 -07:00
swift-ci
cdde06ac25 Merge remote-tracking branch 'origin/master' into master-next 2017-04-27 15:56:02 -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
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
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
swift-ci
3098fc666a Merge remote-tracking branch 'origin/master' into master-next 2017-04-18 10:28:41 -07:00
practicalswift
7eb7d5b109 [gardening] Fix 100 typos. 2017-04-18 17:01:42 +02: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
Huon Wilson
d26c9791e5 [AST] Classes know their appropriate metaclass. 2017-04-17 11:28:55 -07:00
swift-ci
0142fa1f13 Merge remote-tracking branch 'origin/master' into master-next 2017-04-15 10:08:32 -07:00
practicalswift
40cf4d183d [gardening] Use consistent spacing after if, for and while 2017-04-14 17:35:36 +02:00
swift-ci
05aff8998a Merge remote-tracking branch 'origin/master' into master-next 2017-04-13 14:28:31 -07:00
Huon Wilson
22c9e20a9d [IRGen] Completely remove witness table offsets.
These are unused.
2017-04-13 11:44:01 -07:00
Bob Wilson
55568155cb Merge pull request #8697 from compnerd/alloca
Adjust for SVN r299888
2017-04-11 17:41:23 -07:00
Saleem Abdulrasool
7b85ec80e6 Adjust for SVN r299888 2017-04-11 10:27:49 -07:00
swift-ci
5ba89103a7 Merge remote-tracking branch 'origin/master' into master-next 2017-04-11 09:28:31 -07:00
Arnold Schwaighofer
b167b4475d Add SIL and IRGen support for a ConstantStringLiteral instruction
This supports a utf8 or utf16 encoding.

rdar://30545013
2017-04-11 08:43:47 -07:00
Bob Wilson
0cb50e1031 Merge remote-tracking branch 'origin/master' into master-next 2017-04-07 16:35:57 -07:00
Huon Wilson
9e9a0a0436 Merge pull request #8596 from huonw/symbol-list-3
Use IRGen's LinkInfo in TBDGen.
2017-04-07 16:23:51 -07:00
Huon Wilson
4e263a29d5 [IRGen] Compute conformance fragility based on containing module.
Previously this would be using the current module's resilience strategy,
rather than that of the one that contains the conformance.
2017-04-06 17:29:42 -07:00
Bob Wilson
c6e37c1f0a Merge remote-tracking branch 'origin/master' into master-next 2017-04-05 17:26:52 -07:00
Huon Wilson
31b92b1b46 Merge pull request #8473 from huonw/symbol-list-2
Remove dependency on IRGenModule of some linkage computations
2017-04-05 16:39:04 -07:00
Huon Wilson
0776b19958 [IRGen] Compute LinkInfo without an IGM. 2017-04-05 09:54:20 -07:00
Huon Wilson
65c6bdca90 [IRGen] Remove IGM argument, factor out conformance fragility logic. 2017-04-05 09:54:19 -07:00
Huon Wilson
3105c6ed00 [IRGen] Expose LinkInfo publicly, like LinkEntity. 2017-04-05 09:54:19 -07:00
Huon Wilson
19301e984f [IRGen] Remove unnecessary IRGenModule arguments. 2017-04-05 09:54:19 -07:00