Commit Graph

10555 Commits

Author SHA1 Message Date
Jordan Rose
41700b03da Add a new (hidden) option -autolink-force-load.
This option puts a special symbol into the generated object files that other
object files can reference to force the library to be loaded.

The next commit will modify the way we serialize autolinking information so
that importers of this module will always emit a reference to this symbol.
This means the library will be linked into the final binary even if no other
symbols are used (which happens for some of our overlays that just add
category methods to Objective-C classes).

Part of <rdar://problem/16829587>

Swift SVN r17750
2014-05-09 01:07:07 +00:00
Adrian Prantl
e02f42a460 Debug info: make sure we're using the internal DW_LANG_Swift enum for now.
Swift SVN r17748
2014-05-09 00:55:28 +00:00
Sean Callanan
e3d2c7c079 Handle implicit conversions in the playground
transform, so that assignments to properties of
superclasses are logged properly.

<rdar://problem/16789091>


Swift SVN r17747
2014-05-09 00:52:41 +00:00
Michael Gottesman
aa70a16d7e [load-store-opts] Track, perform load forwarding, and eliminate multiple stores.
rdar://16703656

Swift SVN r17746
2014-05-09 00:44:28 +00:00
Doug Gregor
6deba37f0a Enable strict keyword argument checking by default <rdar://problem/14462349>.
Swift SVN r17743
2014-05-09 00:20:47 +00:00
Doug Gregor
a23bafccb6 Introduce -no-strict-keyword-options in the frontend "just in case".
Swift SVN r17742
2014-05-09 00:20:46 +00:00
Joe Groff
fcd0816179 SILGen: Emit witness function refs through 'emitGlobalFunctionRef'.
This ensures that if the witness is a foreign-to-native, curry, or other lazily-generated thunk, that the thunk gets generated. This fixes natively-ObjC witnesses to Swift protocols.

Swift SVN r17739
2014-05-09 00:14:43 +00:00
Michael Gottesman
9fee32d515 [load-store-opts] Do not invalidate stores if AA says that an instruction does not alias the store's destination conservatively.
Swift SVN r17738
2014-05-09 00:00:21 +00:00
Michael Gottesman
02c42cd0a4 [load-store-opts] Refactor out special cases for strong_retain, cond-fail, and dealloc_stack into a helper function call isLSForwardingInertInstruction.
Swift SVN r17735
2014-05-08 23:34:22 +00:00
Doug Gregor
05a283a58c When dealing with argument tuple conversions, keep the parentheses around
This is fairly ugly, because we're halfway between a-function-type-takes-a-tuple and a-function-type-takes-a-set-of-parameters. However, it's another step toward -strict-keyword-arguments.

Swift SVN r17727
2014-05-08 23:20:47 +00:00
Doug Gregor
bbf15afb29 Clean up our handling of arguments and types in the REPL under -strict-keyword-arguments.
We were inserting ParenType that we didn't need, which showed up in the output.

Swift SVN r17726
2014-05-08 23:20:47 +00:00
Doug Gregor
b12f3f8dea Add TypeBase::getWithoutParens(), which may be useful outside of diagnostics.
Swift SVN r17725
2014-05-08 23:20:46 +00:00
Joe Groff
1dce36edd2 Make 'T.self is U.Type' work.
Fix up all of type-checking, SILGen, IRGen, and the runtime to support checked casts of metatypes. <rdar://problem/16847453>

Swift SVN r17719
2014-05-08 22:55:14 +00:00
Michael Gottesman
f18dbbe9e8 [load-store-opts] Refactor load forwarding into its own method LSBBForwarder::tryToForwardLoad.
Now the main optimize method of load store forwarding is ~60 lines and
is significantly more readable.

Swift SVN r17718
2014-05-08 22:42:16 +00:00
Michael Gottesman
df441227f1 [load-store-opts] Refactor out dead store elimination into LSBBForwarder::tryToEliminateDeadStore.
Swift SVN r17717
2014-05-08 22:42:16 +00:00
Michael Gottesman
d4698e3beb [load-store-opts] Move invalidateAliasingLoads onto LSBBForwarder and remove unneeded arguments.
Swift SVN r17716
2014-05-08 22:42:16 +00:00
Michael Gottesman
f510d16666 [load-store-opts] Refactor out call to recursivelyDeleteTriviallyDeadInstructions -> LSBBForwarder::deleteInstruction.
Swift SVN r17715
2014-05-08 22:42:15 +00:00
Michael Gottesman
328dd3cf52 [load-store-opts] Refactor/Simplify LoadStoreOpts by including a BBState structure.
This makes the main method able to be broken down into simpler pieces
without the need to pass as many things around.

Swift SVN r17714
2014-05-08 22:42:14 +00:00
Manman Ren
1bca09fe25 Remove FIXMEs that are already done.
Swift SVN r17709
2014-05-08 19:01:07 +00:00
Ted Kremenek
453532ca21 Import 'NSError**' in parameters as typealias 'NSErrorResult'.
Previously 'NSError**' was imported directly as
ObjCMutablePointer<NSError?>, which is verbose and quite ugly
in the synthesized interfaces and overrides.  This remapping
is semantically equivalent by syntactically prettier.

This name needs to go through API review.

The test uses the actual SDK; the clang-importer-sdk didn't work
because the dump of the Foundation module only shows the pieces
from the Swift files, and the Objective-C pieces are just shown
as re-exported modules.  Testing the actual SDK provides good
fidelity anyway.

Swift SVN r17707
2014-05-08 18:46:27 +00:00
Ted Kremenek
3a513a6412 Add 'getFoundationModule()' to ClangImporter::Implementation.
Swift SVN r17706
2014-05-08 18:46:26 +00:00
Joe Pamer
a17cec6cb2 Some test and diagnostic cleanup:
- Mine conjunction constraints for constraint failure data. (rdar://problem/16833763)
- Rather than crash, add a diagnostic to signify a missing user constraint. (rdar://problem/16747055) I don't have a deterministic repro for this to include as a test, but users hit it from time to time, I'd like to address this issue holistically, and we're hoping that the new diagnostic will help us collect isolated repros.
- As promised, remove the temporary "compiler_submit_version" build configuration predicate in time for WWDC. (rdar://problem/16380797)

Swift SVN r17705
2014-05-08 18:46:08 +00:00
Adrian Prantl
6389760e26 Debug info: Support DynamicSelf type.
Swift SVN r17704
2014-05-08 17:49:59 +00:00
Arnold Schwaighofer
ce0e6698c5 Add _isFast predicate that is true at Ofast
We want to support three configurations:

* Debug (-Onone, -O0): user assertions, library precondition checks, runtime
  checks enabled and verbose.

* Release (-O): library precondition checks, runtime checks enabled but succinct
  (trap).

* Fast (-Ofast): all checks off.

The _isFast predicate will allow to write standard library functions to support
this plan. This commit changes fatal() to differentiate between the three modes.

Support for rdar://16477198

Swift SVN r17697
2014-05-08 15:30:29 +00:00
Argyrios Kyrtzidis
7de8d31c7a [IDE] Syntax color operator decls.
rdar://16530692

Swift SVN r17692
2014-05-08 08:11:38 +00:00
Argyrios Kyrtzidis
1784315096 [AST/IDE] Keep track of semantic info of imports (resolved module and decls) and report module/decl references via
the SourceEntityWalker.

Swift SVN r17689
2014-05-08 07:10:06 +00:00
Argyrios Kyrtzidis
ccc23b60b0 [IDE] Report module references in type contexts.
Swift SVN r17688
2014-05-08 07:10:05 +00:00
Manman Ren
1f280bba73 [SILPasses] limit number of iterations to 20.
This prevents us going in an infinite optimization loop. According to Michael,
we need at least 15 for performance.

The fix at r17635 does not handle the case where the recursive function calls
itself only once.

rdar://16761933


Swift SVN r17686
2014-05-08 05:40:58 +00:00
Chris Lattner
c8003816ad change this to isa<> since we're using a bool return.
Swift SVN r17684
2014-05-08 05:14:10 +00:00
Chris Lattner
e489a7024a Switch array default construction to its canonical type sugar form
of T[]() instead of Array<T>().

I didn't do this in the guts of Array.swift because the abstraction
is harmful in the implementation of Array itself.

NFC.



Swift SVN r17683
2014-05-08 05:13:08 +00:00
Doug Gregor
98da27fcd9 Strip extraneous parentheses from diagnostic output.
They're excessive, silly, and tend to differ under -strict-keyword-arguments.


Swift SVN r17681
2014-05-08 04:48:35 +00:00
Argyrios Kyrtzidis
16d4b98b83 [ASTPrinter] Add more printing options, SkipAttributes/SkipIntroducerKeywords/ArgAndParamPrintingMode.
Swift SVN r17677
2014-05-08 04:17:40 +00:00
Manman Ren
a842fff29f [Serializer] serialize the parent module of NormalProtocolConformance.
We used to just use FileContext at deserialization time. That causes
multiple NormalProtocolConformances with the same protocol and type,
but from different modules. And we will have issues at IRGen.

With this commit, we serialize the parent module and deserialize the parent
module, and we are not going to have multiple NormalProtocolConformances with
the same protocol and type.

rdar://16809311


Swift SVN r17675
2014-05-08 03:40:47 +00:00
Michael Gottesman
bd62e9d9e7 [load-store-opts] Keeping performing load store optimizations on a basic block until we no longer eliminate anything.
Swift SVN r17670
2014-05-08 02:33:35 +00:00
Joe Pamer
f3e6b31887 Fix a problem with the type checker trying to create user conversion expressions out of like-types. (rdar://problem/16837295)
Swift SVN r17669
2014-05-08 02:07:53 +00:00
Jordan Rose
017f7e0ce2 Revert "Emit an error when the user tries to import a submodule."
Even though declarations end up in the top-level module, this can still
/expose/ them if the submodule is explicit. I'll have to think more about
this.

This reverts r17656 / <rdar://problem/16818519>

Swift SVN r17668
2014-05-08 01:45:13 +00:00
John McCall
03d3cf9c40 Import the formal type of a property as audited if the
corresponding getter method is audited.

There are a host of other potential consistency problems
here, but this should fix a particular egregious one
that was preventing use of NSColor's CGColor property.

rdar://16846555

Swift SVN r17667
2014-05-08 01:32:25 +00:00
Michael Gottesman
c923ae25c4 [sil-combine] Eliminate dead thin_to_thick function.
Eliminate:

(strong_release (thin_to_thuck_function f))

rdar://16848107

Swift SVN r17663
2014-05-08 01:11:26 +00:00
Chris Lattner
d500e40dc7 Fix <rdar://problem/16843747> Disallow a single semicolon to be used as the only statement within a switch case
go back to disallowing ; in switch statements, people should use break
for empty statements.  It is much more explicit and obvious what you mean.




Swift SVN r17662
2014-05-08 01:08:51 +00:00
Joe Pamer
709da29301 Implement checks for conditionally bridged types when performing a bridged conversion between array types. (rdar://problem/16540403)
Swift SVN r17660
2014-05-08 00:58:30 +00:00
John McCall
c03b705dd0 Recognize CF "subclasses" and require CFTypeRef to specifically
be 'const void *', not just any 'void*'.

Swift SVN r17659
2014-05-08 00:51:27 +00:00
John McCall
e880aac1e0 Add a convenience routine for searching for a complete
word within a camelCase identifier.

Basically StringRef::find but requiring the next character
to not be lowercase.

Swift SVN r17658
2014-05-08 00:51:25 +00:00
Jordan Rose
ac59e5772a Emit an error when the user tries to import a submodule.
<rdar://problem/16818519>

Swift SVN r17656
2014-05-08 00:12:59 +00:00
Doug Gregor
60c08a2f11 Under -strict-keyword-arguments, teach the REPL to create well-formed call expressions.
The REPL was being rather cavalier about keyword arguments and call
expressions.

This fixes the last of the crashes under
-strict-keyword-arguments. There are still ~54 failing tests that need
to be audited or fixed.

Swift SVN r17655
2014-05-08 00:02:35 +00:00
Michael Gottesman
d26f235b22 [sil-combine] Eliminate unused unchecked_take_enum_addr_inst.
While they do "write" to memory in terms of invalidating enums, that is
not a required operation, so it is ok to remove it.

rdar://16752890

Swift SVN r17654
2014-05-08 00:02:35 +00:00
Doug Gregor
9aa6ec5f96 Be explicit in our use of StringRefs to avoid use-after freed during diagnostic emission.
Swift SVN r17652
2014-05-08 00:02:34 +00:00
Doug Gregor
d8831ecd59 Print fixes are part of the dump() for a solution to a constraint system.
Swift SVN r17651
2014-05-08 00:02:32 +00:00
Jordan Rose
4e7cee3932 Show notes immediately following a fatal diagnostic, but nothing else.
<rdar://problem/16844281>

Swift SVN r17650
2014-05-07 23:52:14 +00:00
Michael Gottesman
617da22507 [constant-propagation] An indexing inst that indexes by 0 is a no-op. Teach constant propagation to simplify it.
rdar://16832529

Swift SVN r17649
2014-05-07 22:45:59 +00:00
Doug Gregor
36cbcccbe9 Generalize constraint application under -strict-keyword-arguments.
Introduce a new locator kind for argument/parameter comparisons that
tracks both the argument and the parameter, which we will eventually
use in diagnostics more regularly. For now, this helps us smooth over
scalar-to-tuple/tuple-to-tuple/tuple-to-scalar nonsense when dealing
with calls.

Fix a pile of fallout from this change.

Swift SVN r17648
2014-05-07 22:36:49 +00:00