Commit Graph

4049 Commits

Author SHA1 Message Date
Michael Gottesman
11ad8ff531 [enum-simplification] Make enum simplification global and teach it how to infer enum case from switch_enum.
With this change we now simplify 2192 retain, release operations on
enums an increase of ~56% over the previous stat, 1403 retain, release
operations.

The next step is to implement switch_enum simplification and pushing
releases on enums into switch regions (the real purpose of this pass).

rdar://17139960

Swift SVN r18740
2014-06-09 00:07:00 +00:00
Michael Gottesman
a301dbe548 Add in PreallocatedArray, PreallocatedMap data structures.
These arrays are meant to be used in situations where you want to allocate a
potentially large amount of default constructible items for a collection of
fixed size.

An example of such a use case is for data flow algorithms which need a
one to one mapping from BB -> StateObject. In such a case, if the state
object is default constructible, we can allocate all of the structures
first, initialize them for each BB, and then process as we normally
would. Thus we eliminate overhead due to memory allocation.

Since the data structures take an allocator it also enables one to use it in
cases where one allocates memory from an allocator and references it via an
ArrayRef. We do this in swift when storing data into certain instructions.

Another benefit over using DenseMaps in such cases is that a DenseMap (unless
you preallocate) can cause all sorts of invalidation issues as new states are
added.

I am planning on using this in my Enum Simplification work and changing
the Global ARC Optimizer to use this.

Swift SVN r18739
2014-06-08 22:52:12 +00:00
Michael Gottesman
125c206d3b Move BlotMapVector -> include/swift/Basic/BlotMapVector so it can be used in SILAnalysis and SILPasses. NFC.
Swift SVN r18736
2014-06-07 22:20:26 +00:00
Jordan Rose
7cd4341cd6 Force color diagnostics when using the driver from the command line.
Previously, the frontend detected that its output was being piped into the
driver and buffered, and decided that that wasn't a color-friendly output
stream. Now, the driver passes -color-diagnostics to the frontend to force
color output if the driver itself is in a color-output context.

<rdar://problem/16697713>

Swift SVN r18506
2014-05-21 19:45:47 +00:00
Doug Gregor
ad18ed81fb Start importing NSArray* as (AnyObject[])! by default <rdar://problem/16535097>.
Swift SVN r18157
2014-05-16 01:10:13 +00:00
Ted Kremenek
7da31bdfdd Disable parsing of single quoted character literals, enabling under a flag.
I didn't want to rip this logic out wholesale.  There is a possibility
the character lexing can be reborn/revisited later, and
disabling it in the parser was easy.

Swift SVN r18102
2014-05-15 07:05:59 +00:00
Adrian Prantl
932d08d89b [update LLVM+LLDB] Switch to the custom DW_LANG_Swift specifier.
Retire DW_TAG_restrict in favor of DW_TAG_APPLE_metatype.

<rdar://problem/16513629> Cleanup DWARF output for WWDC

Swift SVN r17949
2014-05-12 19:17:54 +00:00
Doug Gregor
77ca640d42 Add -objc-bridge-array option to import NSArray* as (AnyObject[])!
This should be the last of the compiler-side functionality for
<rdar://problem/16535097>; we lack any real testing of this.


Swift SVN r17871
2014-05-11 06:29:13 +00:00
Jordan Rose
db872f666e [Frontend] Make CompilerInvocation::parseArgs additive.
No options should be changed because of the absence of a flag. This is
necessary for clients like LLDB which may have an initial set of options
that differs from the usual set.

Part of <rdar://problem/16776705>

Swift SVN r17819
2014-05-10 01:17:36 +00:00
Doug Gregor
59d545d6e8 Add frontend option -objc-bridge-dictionary.
Swift SVN r17804
2014-05-09 21:36:58 +00:00
Doug Gregor
d1e8be50be Turn -implicit-objc-with on by default <rdar://problem/16795899>.
Swift SVN r17796
2014-05-09 20:17:42 +00:00
Joe Groff
6607f6c235 Demangler: Demangle Unicode symbol names.
Implement the decoding half of RFC 3492 so we can demangle our Punycode-encoded Unicode symbol names.

Swift SVN r17759
2014-05-09 05:00:54 +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
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
Joe Pamer
006158ff56 Always emit detailed type check diagnostics, update unit tests to reflect this.
Swift SVN r17334
2014-05-03 23:03:47 +00:00
Doug Gregor
4996efbfba Implement support for making "with" implicit on the first argument of an initializer.
When importing an Objective-C init method or factory method into an
initializer, if the first camelCase word of the first argument name
starts with "with", drop the "with". This means that

  -initWithRed:green:blue:alpha:

will get imported into Swift as

  init(red:green:blue:alpha:)

as will

  +colorWithRed:green:blue:alpha:

This is <rdar://problem/16795899>, hidden behind the
-implicit-objc-with flag.

Swift SVN r17271
2014-05-02 21:13:04 +00:00
Doug Gregor
8324dc92e1 Introduce and use camel_case::appendSentenceCase().
Swift SVN r17260
2014-05-02 17:43:00 +00:00
John McCall
0bc8309ff6 Add a -import-cf-types frontend option to enable
the CF type-import logic.

Swift SVN r17205
2014-05-01 23:29:23 +00:00
Doug Gregor
667d90c1f4 Start diagnosing scalar-to-tuple conversions that are missing a keyword argument.
Another baby step toward <rdar://problem/14462349>, made even more
tepid by the fact that I've quarantined this behind a new flag,
-strict-keyword-arguments. Enforcing this breaks a lot of code, so I'd
like to bring up the new model on the side (with good diagnostics that
include Fix-Its) before trolling through the entire standard library
and testsuite to fix violations of these new rules.


Swift SVN r17143
2014-05-01 06:15:30 +00:00
Argyrios Kyrtzidis
9418fb9948 [DiagnosticEngine] Mark module import diagnostic errors as 'fatal' errors, and supress subsequent diagnostics
to avoid a cascade of errors that drown out the original failure.

Swift SVN r17141
2014-05-01 05:24:48 +00:00
Joe Groff
f7c3331c0e Demangle objc-to-native thunks.
Somehow the demangling for these thunks slipped through the cracks.

Swift SVN r17107
2014-04-30 19:57:42 +00:00
Joe Pamer
47628dbfb6 A couple more simple tweaks to improve type-check error reporting.
Swift SVN r17099
2014-04-30 17:54:56 +00:00
Dmitri Hrybenko
669f633070 Add "single extended grapheme cluster" literals (SEGCL) -- a subset of
double-quoted string literals that contain a single extended grapheme cluster

SEGCL by default infer type String, but you can ask to infer Character
for them.

Single quoted literals continue to infer Character.

Actual extended grapheme cluster segmentation is not implemented yet,
<rdar://problem/16755123> Implement extended grapheme cluster
segmentation in libSwiftBasic

This is part of
<rdar://problem/16363872> Remove single quoted characters

Swift SVN r17034
2014-04-29 14:08:16 +00:00
Jordan Rose
84f4d3b9fa Sink some triple predicates into swiftBasic.
getPlatformNameForTriple isn't currently being used anywhere elsee, but
this seems more consistent.

No functionality change.

Swift SVN r17002
2014-04-28 23:39:15 +00:00
Chris Lattner
a7012f23ef Remove swift::ArrayType. It is dead and vestigial code for supporting fixed size
arrays, which never got baked.  Remove it until we have time to do things right.


Swift SVN r16995
2014-04-28 21:18:27 +00:00
Joe Pamer
4cae5e82e8 Add a "detailed-diagnostics" flag to control emission of more detailed diagnostics for expression type-check failures.
Swift SVN r16988
2014-04-28 19:13:07 +00:00
Dmitri Hrybenko
00722d4c2e Comment parsing: extract parameter name from the text in :param: field
Swift SVN r16750
2014-04-24 09:13:42 +00:00
Adrian Prantl
23f47790e5 Debug info: Retire DW_TAG_meta_type now and use a proper mangled name
instead.
<rdar://problem/16439075> LLDB is trying to print type metadata as an instance

Swift SVN r16710
2014-04-23 19:52:19 +00:00
John McCall
b38a63950d Implement @unowned(unsafe).
This was part of the original weak design that
there was never any particular reason to rush the
implementation for.  It's convenient to do this now
so that we can use it to implement Unmanaged<T> for
importing CF types.

Swift SVN r16693
2014-04-23 08:51:23 +00:00
John McCall
8c4b7f6e21 Remove dependence on llvm::ReferenceAdder, which no longer
exists.

Swift SVN r16624
2014-04-21 21:24:44 +00:00
Doug Gregor
0043652979 NFC: Replace DeclFilterRange with an elaborate set of iterator and range adaptors.
We're going to want these various adaptors, and helpers built on top
of them, when we replace the array-based storage of members in nominal
types and extensions with something more sane.


Swift SVN r16569
2014-04-19 18:19:59 +00:00
Dmitri Hrybenko
3ac95bd0e3 swift-ide-test: add -parse-rest mode to allow one quickly check how a given
ReST document parses


Swift SVN r16518
2014-04-18 11:36:08 +00:00
Joe Groff
85ab7ed9e1 Remove mangling and demangling for block shims.
Swift SVN r16488
2014-04-18 02:36:54 +00:00
Joe Groff
b256ccf467 Switch to native blocks codegen.
Swift SVN r16484
2014-04-18 01:07:12 +00:00
John McCall
4e49b17930 I'm not sure how this compiles for anyone else.
Swift SVN r16373
2014-04-15 18:31:59 +00:00
Joe Groff
920aa60570 Add a frontend option -enable-native-blocks to stage native block generation.
Swift SVN r16372
2014-04-15 17:51:08 +00:00
Argyrios Kyrtzidis
a9ea63a7f7 [IDE/ModuleInterface] Adjust the indentation of regular comments to match the current indentation level.
Swift SVN r16362
2014-04-15 06:27:40 +00:00
Doug Gregor
2d28d70bf8 Remove the language/driver/frontend options to enable/disable mangled names for the ObjC runtime.
Burn the bridges!


Swift SVN r16277
2014-04-13 05:36:08 +00:00
Doug Gregor
8d4964bc98 Turn on namespacing of Objective-C class names.
The actual logic to do this is simple; the vast majority of this
commit is just a pile of changes to test cases to reflect the fact
that Objective-C metadata now includes the module name for each class
and the mangling of Swift-defined @objc classes no longer goes into
the "So" namespace for Objective-C classes. Finishes
<rdar://problem/15506580>.


Swift SVN r16274
2014-04-13 04:48:53 +00:00
Doug Gregor
9d7f0b6211 Rework the selector-splitting heuristics.
This makes a number of changes to the selector-splitting
heuristics. Specifically:

  - Eliminate last-word splitting, and with it the notion of
    multi-words. We only split at prepositions now.
  - Introduce the notion of "linking verbs" such as "will" or
    "should"; when these show up, we refuse to split a selector, which
    helps with delegates.
  - Eliminate the special case for "get" and "set". It wasn't
    helping.
  




Swift SVN r16265
2014-04-12 20:32:16 +00:00
Joe Groff
42a942925b Enable block bridging.
Swift SVN r16248
2014-04-12 05:13:45 +00:00
Dmitri Hrybenko
fbfed25468 Qualify call to make_range to avoid ambiguity between {swift,llvm}::make_range
Swift SVN r16204
2014-04-11 09:06:54 +00:00
Ted Kremenek
2d4342b87a Give an error if “@obj” is used without importing ObjectiveC.
The standard library is exemptmpt (-parse-stdlib) from this checking.

Implements <rdar://problem/16559137>.

Swift SVN r16155
2014-04-10 09:08:09 +00:00
Doug Gregor
5d20720e87 Some more camelCase string utilities.
Swift SVN r16053
2014-04-08 15:13:18 +00:00
Joe Groff
4e789a09f7 Add an -enable-block-bridging frontend option we can hide disruptive changes to block bridging behind.
Swift SVN r16043
2014-04-08 02:43:19 +00:00
Doug Gregor
49387beb25 Selector splitting: don't split selectors in the middle of whitelisted "multi-words".
Swift SVN r16016
2014-04-07 19:17:23 +00:00
Jordan Rose
aa6aa72ba1 Add lazy conformances to nominals and extensions.
...and deserialize conformances lazily.

No intended user-visible change.

Swift SVN r15911
2014-04-04 01:17:54 +00:00
Doug Gregor
12d0eeb324 Move more of the Clang importer's camelCase logic to the new utilities.
Swift SVN r15843
2014-04-02 23:06:22 +00:00
Argyrios Kyrtzidis
b941c8640f [Basic] Introduce LangOptions::getTargetConfigOptions().
Swift SVN r15841
2014-04-02 22:55:05 +00:00
Doug Gregor
6496d69cb8 Simplify down to a single command-line option for preposition splitting.
Swift SVN r15835
2014-04-02 21:44:19 +00:00