Commit Graph

9699 Commits

Author SHA1 Message Date
Slava Pestov
aa747dcd81 Remove property behaviors 2018-12-07 20:38:33 -05:00
Slava Pestov
e160b85f8f Merge pull request #21117 from slavapestov/accessor-synthesis-cleanup
Accessor synthesis cleanup (NFC)
2018-12-07 19:53:26 -05:00
Harlan Haskins
c829506aca Merge pull request #21033 from harlanhaskins/trouble-at-the-roller-rink
[Sema] Diagnose internal(set) from @inlinable functions
2018-12-07 15:33:18 -08:00
Slava Pestov
6f243d4ab3 AST: Plumb a 'context' parameter through to AbstractFunctionBody's body synthesizer 2018-12-07 17:10:08 -05:00
Harlan Haskins
1abeeb8b92 [Sema] Diagnose internal(set) from @inlinable functions
This patch mainly consolidates the functions used to check accessors vs.
other decls, and makes sure we check setter access as well as regular
decl access.

rdar://45217648
2018-12-07 12:46:19 -08:00
Argyrios Kyrtzidis
d235fdc582 Merge pull request #21116 from akyrtzi/break-dependency-cycles
[AST] Break dependency cycles of swiftAST against swiftSema and swiftClangImporter
2018-12-07 12:06:07 -08:00
Argyrios Kyrtzidis
9405f1eb09 [AST] Break dependency cycle between swiftAST and swiftClangImporter
NormalProtocolConformance::isRetroactive() introduces dependency on swiftClangImporter by calling ClangModuleUnit::getAdapterModule().
Do some refactoring to break the cycle.
2018-12-06 22:54:33 -08:00
Argyrios Kyrtzidis
75ab0a5f36 [AST] Break dependency cycle between swiftAST and swiftSema
AST/LookupVisibleDecls.cpp has a dependency on swiftSema by having doGlobalExtensionLookup call into swift::isExtensionApplied,
and doGlobalExtensionLookup is ultimately used by the other global functions in that file.
Break the cycle by moving the file into the swiftSema library.
2018-12-06 22:52:38 -08:00
Jordan Rose
9536d40718 Merge pull request #21094 from jrose-apple/a-module-by-any-other-name
[ParseableInterface] Pass down the module name and import source loc
2018-12-06 18:44:01 -08:00
Harlan Haskins
2e50a431b1 Merge pull request #20986 from harlanhaskins/clogged-pipes
[SILOptimizer] Stop optimization after serialization if only emitting a module
2018-12-06 15:49:11 -08:00
Jordan Rose
a51f1dd3d2 [ParseableInterface] Pass down the module name and import source loc
- Use the name for the cached module, so that we don't end up with a
  zillion "x86_64-XXXXXXXX.swiftmodule" files in the cache when we're
  working with architecture-specific swiftmodules.

- Diagnose if the expected name is different from the name specified
  in the swiftinterface.

- Emit all diagnostics at the location of the import, instead of
  without any location at all.
2018-12-06 13:33:07 -08:00
Xi Ge
5da65ac704 Merge pull request #21013 from nkcsgexi/doc-support
Sourcekit/DocSupport: include fully annotated generic signatures for extension decls.
2018-12-05 18:31:29 -08:00
swift-ci
39161d5b36 Merge pull request #20600 from adrian-prantl/36032653 2018-12-05 17:01:58 -08:00
John McCall
8112f68b96 Merge pull request #20629 from rjmccall/error-self-conformance
Allow Error to conform to itself
2018-12-05 19:58:08 -05:00
Adrian Prantl
d63debeb60 Experimental: Extend ClangImporter to import clang modules from DWARF
When debugging Objective-C or C++ code on Darwin, the debug info
collected by dsymutil in the .dSYM bundle is entirely
self-contained. It is possible to debug a program, set breakpoints and
print variables even without having the complete original source code
or a matching SDK available. With Swift, this is currently not the
case. Even though .dSYM bundles contain the binary .swiftmodule for
all Swift modules, any Clang modules that the Swift modules depend on,
still need to be imported from source to even get basic LLDB
functionality to work. If ClangImporter fails to import a Clang
module, effectively the entire Swift module depending on it gets
poisoned.

This patch is addressing this issue by introducing a ModuleLoader that
can ask queries about Clang Decls to LLDB, since LLDB knows how to
reconstruct Clang decls from DWARF and clang -gmodules producxes full
debug info for Clang modules that is embedded into the .dSYM budle.

This initial version does not contain any advanced functionality at
all, it merely produces an empty ModuleDecl. Intertestingly, even this
is a considerable improvement over the status quo. LLDB can now print
Swift-only variables in modules with failing Clang depenecies, and
becuase of fallback mechanisms that were implemented earlier, it can
even display the contents of pure Objective-C objects that are
imported into Swift. C structs obviously don't work yet.

rdar://problem/36032653
2018-12-05 13:54:13 -08:00
Karoy Lorentey
e0495a7e0b [Sema] Emit a deprecation warning when hashValue is provided by hash(into:) isn’t
SE-206 deprecated hashValue as a protocol requirement. We should gently encourage people to migrate to hash(into:), for its more secure, easier and faster hashing.

Emit a compiler warning whenever hashValue has an explicit implementation, but hash(into:) doesn’t.
2018-12-05 18:01:20 +00:00
Harlan Haskins
b137928ff5 [SILOptimizer] Add flag to stop optimization after serialization 2018-12-04 16:44:01 -08:00
Adrian Prantl
ff63eaea6f Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

      for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done
2018-12-04 15:45:04 -08:00
Jordan Rose
b3ca05708d Merge pull request #21006 from jrose-apple/intrinsick-day
Cache LLVM attributes for intrinsics
2018-12-04 15:34:05 -08:00
Xi Ge
d620dfae5e Sourcekit/DocSupport: include fully annotated generic signatures for extension decls. rdar://40906297 2018-12-04 14:29:28 -08:00
Slava Pestov
a5ebaab325 AST: Fix a misleading comment
Fixes <https://bugs.swift.org/browse/SR-9403>.
2018-12-04 16:58:03 -05:00
Doug Gregor
2c5ecb477a Merge pull request #20858 from DougGregor/mangled-base-protocol-witnesses
[ABI] Use mangled names for base protocol witnesses.
2018-12-04 11:28:27 -08:00
Jordan Rose
e786431a3b Use proper type for getLLVMIntrinsicID
At one point we were probably trying to avoid including
llvm/IR/Intrinsics.h in Builtins.h but that ship has sailed.

No functionality change.
2018-12-04 11:22:38 -08:00
Jordan Rose
805ae332e1 Cache LLVM attributes for intrinsics
Looking these up is slow because the attribute lists get rebuilt and
reuniqued in the LLVM context each time. Saving them is a single
pointer per IntrinsicInfo and IntrinsicInfos are already cached in
each SILModule.

This shaves about 4s off optimizing the standard library (72s out of a
3:00+ build), and probably has much less effect anywhere else. That
is, it's not /really/ important after all, but it was an easy bit of
the profile to hammer down.
2018-12-04 11:22:37 -08:00
Pavel Yaskevich
5e4053d441 Merge pull request #21001 from xedin/re-remove-obsolete-builtins
(un-revert) Remove apparently obsolete builtin functions (#20947)
2018-12-04 10:13:51 -08:00
Jordan Rose
bcc4ba9e66 Request Evaluator: save malloc traffic by canonicalizing AnyRequests (#20999)
Use the Dependencies map to standardize on a single allocation for
any particular Request. We could probably go all the way to unique
ownership here, but I didn't want to rock the boat.

Results in minor speedups compiling the stdlib. (I was experimenting
with using a new, auto-cached Request for a hot lookup path, which may
or may not turn out to be worth it, but even without that we can take
this.)
2018-12-04 08:14:39 -08:00
Brent Royal-Gordon
facaad1873 A diagnosis from the argument clinic (#20997)
[Parse] Warn if the same argument is specified more than once in @available
2018-12-04 01:05:09 -08:00
Doug Gregor
e6620b055d [Mangling] Separate out base conformance descriptors.
Separate the mangling of base conformance descriptors from that of
associated conformance descriptors, and simplify it.
2018-12-04 00:13:54 -08:00
Carl Peto
db24809cc1 Remove apparently obsolete builtin functions (#20947)
* Remove apparently obsolete builtin functions.

- Remove s_to_u_checked_conversion and u_to_s_checked_conversion functions from builtin AST parsing, SIL/IR generation and from SIL optimisations.

* Remove apparently obsolete builtin functions - unit tests.

- Remove unit tests for SIL transformations relating to s_to_u_checked_conversion and u_to_s_checked_conversion builtin functions.
2018-12-03 23:44:27 -08:00
Slava Pestov
60e3373636 Merge pull request #20987 from slavapestov/backward-deployment
Backward deployment fixes and tests
2018-12-03 21:49:00 -05:00
Slava Pestov
f871b0e661 Merge pull request #20948 from Azoy/remove-_getBool
[SILGen][stdlib] Remove _getBool
2018-12-03 21:00:31 -05:00
Slava Pestov
cc3730f410 AST: A conformance is weak-linked if its protocol, conforming type or extension is @_weakLinked
Fixes <rdar://problem/46316197>.
2018-12-03 20:36:03 -05:00
Slava Pestov
473a2cb38c AST: Members of @_weakLinked types are implicitly @_weakLinked 2018-12-03 20:36:03 -05:00
Stephen Canon
a5c38d099c Revert "Remove apparently obsolete builtin functions (#20947)" (#20975)
This reverts commit b914464712, which passed the public CI bots, but broke some tests on watchOS.
2018-12-03 17:48:24 -05:00
Carl Peto
b914464712 Remove apparently obsolete builtin functions (#20947)
* Remove apparently obsolete builtin functions.

- Remove s_to_u_checked_conversion and u_to_s_checked_conversion functions from builtin AST parsing, SIL/IR generation and from SIL optimisations.

* Remove apparently obsolete builtin functions - unit tests.

- Remove unit tests for SIL transformations relating to s_to_u_checked_conversion and u_to_s_checked_conversion builtin functions.
2018-12-03 07:07:34 -05:00
Azoy
65217a71de Cache bool builtin init
remove newline
2018-12-02 22:38:24 -06:00
Slava Pestov
fc8f122336 AST: Remove FuncDecl::getReturnTypeLoc() 2018-12-02 18:41:39 -05:00
Azoy
a2dafc3d26 Remove _getBool 2018-12-01 18:51:25 -06:00
John McCall
d767b2529e Merge pull request #20905 from rjmccall/sil-type-bridging-reversal-bridgeability
Don't map Bool back to ObjCBool for SIL types in unbridged contexts
2018-11-30 18:33:21 -05:00
John McCall
95297f6988 Don't map Bool back to ObjCBool for SIL types in unbridged contexts.
When the Clang importer imports the components of a C function pointer
type, it generally translates foreign types into their native equivalents,
just for the convenience of Swift code working with those functions.
However, this translation must be unambiguously reversible, so (among
other things) it cannot do this when the native type is also a valid
foreign type.  Specifically, this means that the Clang importer cannot
import ObjCBool as Swift.Bool in these positions because Swift.Bool
corresponds directly to the C type _Bool.

SIL type lowering manually reverses the type-import process using
a combination of duplicated logic and an abstraction pattern which
includes information about the original Clang type that was imported.
This abstraction pattern is generally able to tell SIL type lowering
exactly what type to reverse to.  However, @convention(c) function
types may appear in positions from which it is impossible to recover
the original Clang function type; therefore the reversal must be
faithful to the proper rules.  To do this we must propagate
bridgeability just as the imported would.

This reversal system is absolutely crazy, and we should really just
- record an unbridged function type for imported declarations and
- record an unbridged function type and Clang function type for
  @convention (c) function types whenever we create them.
But for now, it's what we've got.

rdar://43656704
2018-11-30 15:23:00 -05:00
Slava Pestov
4289f76064 AST: Introduce ClassDecl::hasResilientMetadata() 2018-11-29 23:20:02 -05:00
swift-ci
2ef35ac80e Merge pull request #19655 from apple/marcrasi-const-evaluator-part-1 2018-11-29 19:25:14 -08:00
Jordan Rose
ea059e9709 Merge pull request #20852 from jrose-apple/text-interface-to-module
[ModuleInterface] <rdar://46081260> Fallback behaviour and testing env vars
2018-11-29 16:28:51 -08:00
Joe Groff
1532355b91 Merge pull request #20528 from theblixguy/fix/SR-8435
[SILGen] Insert an unreachable if a function declaration's parameter is uninhabited
2018-11-29 13:07:56 -08:00
Graydon Hoare
f7200e87bd [ModuleInterface] <rdar://46081260> Fallback behaviour and testing env vars. 2018-11-28 18:34:41 -08:00
Pavel Yaskevich
8a79fa1a9f [TypeChecker] Improve error about mutating self capture by escaping closure
Closures can't explicitly capture a mutating self parameter, so
let's re-word diagnostic to point what what actual problem here
is, and add a note about ways to fix the code.

Thanks to Cory Benfield for message suggestion.

Resolves: [SR-9314](https://bugs.swift.org/browse/SR-9314)
Resolves: rdar://problem/46322943
2018-11-28 16:22:05 -08:00
Slava Pestov
f250a3c193 Merge pull request #20821 from slavapestov/more-evolution-tests
More evolution tests
2018-11-28 14:05:33 -05:00
Slava Pestov
b7914532be Sema: More consistent @_fixed_layout diagnostics 2018-11-28 12:39:04 -05:00
Saleem Abdulrasool
51a236bc6d AST: simplify AKAFormatString
Remove the unnecessary use of the positional arguments in the diagnostic
formatting.  This is not portable as it is a SUS extension and the Microsoft C
runtime does not support this extension.
2018-11-28 08:07:43 -08:00
Marc Rasi
390daeaeea address comments 2018-11-26 17:25:21 -08:00