Commit Graph

1584 Commits

Author SHA1 Message Date
Doug Gregor
c62cd12da3 [Clang importer] Lazily synthesize union field getter/setter bodies 2019-07-11 22:21:10 -07:00
Doug Gregor
8efe352bfd [Clang importer] Lazily synthesize imported anonymous field getters/setters 2019-07-11 22:04:35 -07:00
Doug Gregor
dd42423343 [Clang importer] Delay synthesis of imported struct rawValue getter body 2019-07-11 21:31:22 -07:00
Doug Gregor
ab52bb50f4 [Clang importer] Lazily synthesize enum rawValue getter bodies. 2019-07-11 21:31:21 -07:00
Doug Gregor
dd812496ac [Clang importer] Lazily synthesize enum rawValue constructor bodies. 2019-07-11 21:31:21 -07:00
Doug Gregor
37b93a7a02 [Clang importer] Lazily synthesize imported constant getters. 2019-07-11 21:31:21 -07:00
Doug Gregor
8117849d46 [AST] Make function body synthesizers less stateful.
Instead of requiring that function body synthesizers will always call
setBody(), which is annoyingly stateful, have function body synthesizers
always return the synthesized brace statement along with a bit that
indicates whether the body was already type-checked. This takes us a
step closer to centralizing the mutation of the body of a function.
2019-07-11 21:31:21 -07:00
pschuh
4fd0671e54 Merge pull request #25870 from pschuh/cpp-1
Add -enable-cxx-interop flag and support for extern "C" {}
2019-07-09 11:37:31 -07:00
Parker Schuh
fa69a73ee4 Add -enable-cxx-interop flag and support for extern "C" {} 2019-07-08 11:43:35 -07:00
Slava Pestov
4c499fd4ac AST: Stop passing around LazyResolvers in various places 2019-07-06 00:43:22 -04:00
Slava Pestov
df8689128d AST: Move ClangImporter's finishSignatureConformances() to a method on NormalProtocolConformance
Also generalize the algorithm slightly to handle the full generality of
non-imported conformances.
2019-07-06 00:11:17 -04:00
Slava Pestov
337edbe3a1 ClangImporter: Don't wrap protocol Self return in DynamicSelfType 2019-06-26 01:12:27 -04:00
Slava Pestov
8518fc2e4e AST: Remove FuncDecl::hasDynamicSelf() 2019-06-26 01:12:27 -04:00
Slava Pestov
7913d30236 Sema: Use a request to compute FuncDecl::getSelfAccessKind() 2019-06-19 14:38:43 -04:00
swift-ci
6eccff6f78 Merge remote-tracking branch 'origin/master' into master-next 2019-06-10 20:10:39 -07:00
Christopher Rogers
0b27345d68 Swift should complain about weak references to classes that don't support them
Resolves SR-6706
2019-06-10 19:20:28 -04:00
swift-ci
93e08a6674 Merge remote-tracking branch 'origin/master' into master-next 2019-06-06 11:29:01 -07:00
Puyan Lotfi
9f1204d817 Fixing build break due to MemberExpr new -> create changes.
Hash c32ef4bc0b17f79d96b672143d5e5fba9e39ea8d (llvm monorepo) changed the
allocation interface from new to create.

(cherry picked from commit 0e4add8510)
2019-06-04 20:24:27 -07:00
mishal_shah
1e38fc3030 Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs 2019-06-03 22:50:02 -07:00
swift-ci
cc51d8f1c4 Merge remote-tracking branch 'origin/master' into master-next 2019-05-30 18:09:30 -07:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Karoy Lorentey
d8aa67bb90 Merge branch 'master' into master-next
# Conflicts:
#	utils/build-script-impl
2019-05-29 13:09:01 -07:00
Slava Pestov
3e0cd2341a ClangImporter: Remove dead code for 'finishing' inherited conformances
This was added before we had 'associated conformances', which superceded
the inherited conformances concept, so it's been dead for a while.
2019-05-28 22:08:38 -04:00
Slava Pestov
c947eda18f AST: Use ProtocolDecl::getAssociatedTypeMembers() where possible 2019-05-28 22:08:31 -04:00
Slava Pestov
ec1b1a390a AST: Remove ASTContext::ExternalDefinitions
Anything added here has a type checked body now, so it no longer
serves any purpose.
2019-05-28 22:08:30 -04:00
Davide Italiano
32e7f386ab [ClangImporter] Update now that APValue::Uninitialized was split.
The two new states are None & Indeterminate.
The former means "no such object", and "indeterminate" represents
an uninitialized object.

As the clang importer was using these only to cover a switch of
unhandled case, this should be functionally equivalent to what
was there before.
2019-05-23 16:58:36 -07:00
swift-ci
b345524b53 Merge remote-tracking branch 'origin/master' into master-next 2019-05-23 11:10:22 -07:00
Slava Pestov
8075b09b9b ClangImporter: Set the 'throws' bit on a few CallExprs
This allows Sema to skip checking external definitions altogether.
2019-05-23 10:40:34 -04:00
Slava Pestov
57254cb6e3 ClangImporter: Build type-checked AST for constants 2019-05-23 10:40:34 -04:00
Slava Pestov
7a630f40c4 ClangImporter: Track raw types of imported struct and enum wrappers
These will be used shortly to avoid name lookups into the imported type.
2019-05-23 10:40:34 -04:00
Slava Pestov
95843e372c ClangImporter: Remove ConstantConvertKind::{Coerce,Downcast} 2019-05-23 10:40:34 -04:00
swift-ci
5fd0964904 Merge remote-tracking branch 'origin/master' into master-next 2019-05-10 08:49:05 -07:00
Alexis Laferrière
3dd54c24d1 Remove explicit calls to computeRequirementSignature
We can rely on lazy calls to getRequirementSignature instead.
2019-05-08 14:28:35 -07:00
swift-ci
0d1a3391b8 Merge remote-tracking branch 'origin/master' into master-next 2019-05-08 05:30:15 -07:00
Slava Pestov
3371080b9f ClangImporter: Built type-checked expressions in union and indirect field accessors
When we remove Sema's UsedConformances list, conformances to _BridgedStoredNSError
are checked from SILGen, where its too late to check function bodies of synthesized
functions.

We could solve this by adding a callback to type check a synthesized function's
body, but in fact all synthesized functions are rather trivial so it's better to
build their bodies fully type checked.

Start by building fully checked expressions for various accessors in ClangImporter.
2019-05-08 01:09:33 -04:00
swift-ci
599abafa17 Merge remote-tracking branch 'origin/master' into master-next 2019-05-03 11:30:29 -07:00
Jordan Rose
517f5d6b6a [ClangImporter] Retire the term "adapter" in favor of "overlay" (#24427)
Way back in Swift 1 I was trying to draw a distinction between
"overlays", separate libraries that added Swift content to an existing
Objective-C framework, and "the Swift part of a mixed-source
framework", even though they're implemented in almost exactly the same
way. "Adapter module" was the term that covered both of those. In
practice, however, no one knew what "adapter" meant. Bring an end to
this confusion by just using "overlay" within the compiler even for
the mixed-source framework case.

No intended functionality change.
2019-05-03 11:11:58 -07:00
Bob Wilson
33d9e52e72 Merge remote-tracking branch 'origin/master' into master-next 2019-05-01 09:33:08 -07:00
Saleem Abdulrasool
83b290438c Windows: bridge BOOL to Bool
This allows the conversion of the Windows `BOOL` type to be converted to
`Bool` implicitly.  The implicit bridging allows for a more ergonomic
use of the native Windows APIs in Swift.

Due to the ambiguity between the Objective C `BOOL` and the Windows
`BOOL`, we must manually map the `BOOL` type to the appropriate type.
This required lifting the mapping entry for `ObjCBool` from the mapped
types XMACRO definition into the inline definition in the importer.

Take the opportunity to simplify the mapping code.

Adjust the standard library usage of the `BOOL` type which is now
eclipsed by the new `WindowsBool` type, preferring to use `Bool`
whenever possible.

Thanks to Jordan Rose for the suggestion to do this and a couple of
hints along the way.
2019-04-25 17:52:08 -07:00
swift-ci
1154846a32 Merge remote-tracking branch 'origin/master' into master-next 2019-04-02 17:29:21 -07:00
Brent Royal-Gordon
972eda2316 [NFC] AST-level support for static subscripts
* Moves the IsStatic flag from VarDecl to AbstractStorageDecl.
* Adds a StaticSubscriptKind to SubscriptDecl.
* Updates serialization for these changes.
* Updates SubscriptDecl constructor call sites for these changes.
2019-04-01 18:04:00 -07:00
swift-ci
c869cb9468 Merge remote-tracking branch 'origin/master' into master-next 2019-03-05 14:29:14 -08:00
Devin Coughlin
8b14600372 [ClangImporter] Refactor availability attribute importing logic. NFC.
Refactor the PlatformAvailability logic for determining
which Clang availability attributes are relevant when importing. The goal
is to separate the logic for attribute relevance for a given platform from
the logic to determine whether a deprecated attribute should be imported as
unavailable in Swift.

This also makes it possible for the "deprecated-as-unavailable" logic to
refer to the underlying Clang declaration, which is functionality that will
be used in a later commit.

This commit has no intended functional change.

Part of rdar://problem/48348822
2019-03-03 14:29:50 -08:00
Bob Wilson
213efe089c Merge commit '06120c9d9d1a28275a0ecd7466775b1d71716be7' into stable-update-5.1 2019-02-17 10:20:59 -08:00
Bob Wilson
69cbd56873 Merge remote-tracking branch 'origin/master' into master-next 2019-02-09 16:01:45 -08:00
Saleem Abdulrasool
8719f5276c ClangImporter: adjust for SVN r349901
The constructor for `DeclRefExpr` now takes a `Context` parameter to avoid the
call to `getASTContext`.  Adjust the invocation accordingly.
2019-02-08 14:22:57 -08:00
Saleem Abdulrasool
db1c894aa0 ClangImporter: update for SVN r345605
Update for API changes in clang SVN r345605.
2019-02-08 14:22:56 -08:00
Slava Pestov
dffa29fd0d AST: Remove a few uses of FunctionType::Param::getOldType() 2019-02-07 23:46:31 -05:00
Bob Wilson
b0dd41b8ab [master-next] Use the new AST getBeginLoc API instead of getLocStart
The getLocStart API is deprecated and slated for removal from LLVM
very soon. Switch to use getBeginLoc instead. I did not see any uses
of the corresponding getLocEnd API.
2019-02-07 16:53:03 -08:00
Saleem Abdulrasool
39b564b774 ClangImporter: adjust for SVN r351368
SVN r351368 added FixedPoint to APValue.  Enumerate that for `-Wcovered-switch`
errors.
2019-01-17 09:17:51 -08:00