Commit Graph

4702 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
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
Doug Gregor
b12f3f8dea Add TypeBase::getWithoutParens(), which may be useful outside of diagnostics.
Swift SVN r17725
2014-05-08 23:20:46 +00:00
Dave Zarzycki
8b0c9d4e74 Heap: Let Instruments ensure that the heap is setup correctly at launch
Swift SVN r17723
2014-05-08 23:12:57 +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
Dave Abrahams
1e66774acd [stdlib] swift_isClassOrObjCExistentialImpl fix
If we're going to claim to check for ObjC existential-ness, we should
actually do so.

Swift SVN r17712
2014-05-08 20:31:07 +00:00
Dave Zarzycki
0a0dbdc36c Runtime: make the index <-> size functions easier to lookup dynamically
Swift SVN r17711
2014-05-08 19:25:29 +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
Manman Ren
c465dad297 Bump VERSION_MINOR for r17675.
Swift SVN r17702
2014-05-08 17:22:11 +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
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
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
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
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
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
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
fd0a78b301 [sil-combine] Canonicalize index_raw_addr byte indexing operations => index_addr object size indexing operations.
This should eliminate pointless operations that get added to our inline
cost itinerary.

rdar://15567647
rdar://16762768
rdar://16832529

Swift SVN r17644
2014-05-07 22:01:30 +00:00
Joe Pamer
2eedc06d66 Begin adding plumbing for the type checker to accept "forward" bridged array conversions. (rdar://problem/16540403)
Swift SVN r17640
2014-05-07 19:45:37 +00:00
Jordan Rose
5ceecb4337 [serialization] Add a special encoding for the imported header module.
This allows a loaded swiftmodule to refer to decls that come from a header
imported by the module itself. There's an unfortunate sharing of the
namespace here with any /other/ headers loaded by /other/ modules (including
the module currently being compiled), but that shouldn't be too much of an
issue in practice -- the declarations would need to be compatible anyway if
you were doing the same thing in Objective-C.

More of <rdar://problem/16702101>. This is possibly the end of the compiler
work, but I'd like to add more tests to make sure everything is working.

Swift SVN r17639
2014-05-07 19:03:22 +00:00
Jordan Rose
465b083ba9 [serialization] Serialize the header path used by -import-objc-header.
This doesn't handle cross-references to decls /loaded/ from the header
just yet, so all that's testable right now is whether the header's imports
are visible from the secondary target (after being imported in response
to loading the serialized module).

More of <rdar://problem/16702101>

Swift SVN r17638
2014-05-07 19:03:21 +00:00
Jordan Rose
a0de0e411d [serialization] Drop swift::serializeToStream and swift::serializeModuleDoc.
All serialization should go through serialize(). We don't currently support
serializing docs without serializing a module.

Also, tidy up how Serializer is used within Serialization.cpp.

Swift SVN r17637
2014-05-07 19:03:19 +00:00
Argyrios Kyrtzidis
1f430cb4b8 [Frontend] Simplify CompilerInstance::performParseOnly() by only supporting parsing a single file.
Swift SVN r17634
2014-05-07 17:55:19 +00:00
Ted Kremenek
0b2c23ffec Remove special printing of ImplicitlyUnwrappedOptional<T>.
Part of <rdar://problem/16836463>

Swift SVN r17610
2014-05-07 06:59:52 +00:00
Argyrios Kyrtzidis
17c3bae3cd [IDE] Enhance SourceEntityWalker to provide callbacks for the keyword arguments of
a call expression.

Swift SVN r17607
2014-05-07 06:10:03 +00:00
Chris Lattner
40a8fda572 inline hasExprCallSuffix into its two callers now that it is trivial. NFC.
Swift SVN r17605
2014-05-07 05:31:24 +00:00
Argyrios Kyrtzidis
9afa0333db [Frontend] Make sure we don't do any module imports during parse-only pass.
Fixes performance regression of rdar://16816861

Swift SVN r17600
2014-05-07 02:37:49 +00:00
Argyrios Kyrtzidis
796afac0af [Frontend] Rename CompilerInstance::performParse() -> performSema() to make it more clear that it is doing parsing + type checking.
Swift SVN r17597
2014-05-07 02:13:49 +00:00
Argyrios Kyrtzidis
136284430c [Frontend] Separate parse-only functionality into its own function, CompilerInstance::performParseOnly().
Parse-only is a hot path; keep the semantics for it separate from normal parsing, otherwise it is very
easy to introduce something expensive without checking for Invocation.getParseOnly().

Also cleans up a bit CompilerInstance::performParse() as well.

Swift SVN r17596
2014-05-07 02:13:48 +00:00
Jordan Rose
f4f8e7c127 [ClangImporter] Add a special case for AVVideoCompositionInstruction.
...which, like NSObject, is a protocol that has the same name as a class.

Doing this more generally is tracked in <rdar://problem/16206627>.

Swift SVN r17583
2014-05-06 23:34:42 +00:00
Jordan Rose
5e53c3afb6 Allow IBOutlet to appear on properties of array type.
...if the element type is an ObjC class or protocol type.

This currently only works if the element type is AnyObject;
that restriction will be lifted (on all @objc methods) once array bridging
is fully in place.

<rdar://problem/15607154>

Swift SVN r17574
2014-05-06 22:50:34 +00:00
Jordan Rose
76a27e16c5 Update a stray diagnostic that still included "unchecked".
Swift SVN r17573
2014-05-06 22:50:34 +00:00
Joe Pamer
edb4946f66 Begin updating type checking of array upcasts to conform with the new spec.
Also, call through DaveA's new entry point for upcasts on Array<T>.

Swift SVN r17564
2014-05-06 21:32:22 +00:00
Joe Groff
05c80a8fe9 AST: Avoid instantiating all members when implicit destructors are inserted into classes.
We were accidentally forcing all members of a class to be instantiated in two places:

- by trying to look up an existing destructor decl in the class, and
- by adding the implicit destructor to the class, because addMember needlessly called loadAllMembers.

Fix the former problem by adding a 'has destructor' bit to ClassDecl so we can track whether the implicit destructor needs to be added without querying its members. Fix the latter by making IterableDeclContext::addMember not call loadAllMembers, and making loadAllMembers not barf when it sees existing members in the context.

Together with Jordan and JoeP's changes, this makes many interpreter tests now compile 3-20x faster.

Swift SVN r17562
2014-05-06 20:30:08 +00:00
Joe Pamer
d22ffa8cb8 Re-lazify the addition of equatable conformances to imported enum types. (rdar://problem/16808612)
Rather than force conformances to Equatable to be added to all imported enumeration types outright, change them back to being lazily added. We can then handle situations where new overloads of '==' are introduced during constraint generation by re-writing the relevant overload disjunction constraint to include the newly forced declarations as bind options.

Swift SVN r17557
2014-05-06 19:56:29 +00:00
Jordan Rose
57e771ca38 [Parse] Make Token::isAny and Token::isNotAny variadic.
No functionality change.

Swift SVN r17519
2014-05-06 02:06:02 +00:00
Argyrios Kyrtzidis
717966f579 [Parser] Emit error + fixit if 'inout' appears after the parameter.
Swift SVN r17518
2014-05-06 01:39:35 +00:00
Michael Gottesman
b56c31dc5f [sil-combine] convert_function simplification.
convert_function works essentially as a bitcast on functions that
enables you to change address/ref type parameters. This commit enforces
that invariant in the verifier and teaches SILCombine how to simplify it
so we can use it in the devirtualizer.

Swift SVN r17516
2014-05-06 01:16:14 +00:00
Joe Groff
502a9b36e3 Move -print-clang-stats to the no-driver-option section.
Swift SVN r17515
2014-05-06 01:11:48 +00:00
Joe Groff
4a09c9f9dd Add a -print-clang-stats frontend flag.
Prints stats from the Clang importer's ASTReader.

Swift SVN r17512
2014-05-06 01:08:09 +00:00
Chris Lattner
fcb3b0e98c Rework capture list parsing and generalize it. Now the preparse is
much fuzzier, and the real parse is stricter.  Also, generalize this
to support the full "unowned name = expr" syntax in the capture list.

There is still a lot missing here.



Swift SVN r17499
2014-05-05 23:53:53 +00:00
Chris Lattner
0ceb7ab023 introduce new Token::isAny and Token::isNotAny methods which are
helper predicates to see if the token is any of a set.


Swift SVN r17498
2014-05-05 23:52:49 +00:00
Jordan Rose
0c46eb821e [ClangImporter] Handle decls declared in imported headers.
This improves the -import-objc-header option to read decls from the header
as well. Any declaration that is not from a module will be considered to be
part of the "header module". Conversely, forward-declarations appearing in
the header will be resolved by looking through all modules responsible for
importing a header.

More of <rdar://problem/16702101>

Swift SVN r17492
2014-05-05 22:52:17 +00:00
Arnold Schwaighofer
6234d10512 Change AssertConfig option name to assert-config
rdar://16805810

Swift SVN r17486
2014-05-05 20:31:31 +00:00
Arnold Schwaighofer
3ba7225aa3 Fix the driver's handling of the AssertConfig option
The driver was not passing the 'AssertConfig' option to the frontend.

rdar://16805810

Swift SVN r17472
2014-05-05 18:21:57 +00:00
Doug Gregor
3c71c4ee21 Compute useful effective full names for property accessors, too.
willSet/didSet and the synthesized getter they imply had keyword
arguments when they shouldn't have. Fix this.

Swift SVN r17459
2014-05-05 17:36:45 +00:00
Chris Lattner
d230228cdd store the capture list of a ClosureExpr in the AST and print it out
in the AST dumper.


Swift SVN r17451
2014-05-05 16:25:33 +00:00