Commit Graph

716 Commits

Author SHA1 Message Date
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
b253b21014 [gardening] Make sure argument names in comments match the actual parameter names 2016-12-21 22:56:01 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Maxwell Swadling
4497083a0a Updated comment to clarify condition for free 2016-12-15 12:59:46 -08:00
Maxwell Swadling
5f0572ef53 Updated documentation for new less memory frontend 2016-12-15 11:11:06 -08:00
Maxwell Swadling
6af14c05d8 After performIRGeneration but before performLLVM delete the CompilerInstance if possible 2016-12-14 18:49:23 -08:00
Jordan Rose
41974682e6 [FrontendTool] Split out swiftdeps generation into its own file.
No intended functionality change.
2016-12-08 16:15:35 -08:00
Erik Eckstein
5ac0c5b9b7 Mangling: wire up the new mangling in various places in the compiler, but still use the old mangling.
The purpose of this change is to test if the new mangling is equivalent to the old mangling.
Both mangling strings are created, de-mangled and checked if the de-mangle trees are equivalent.
2016-12-05 14:07:05 -08:00
Erik Eckstein
684092d7d1 Mangling: mangler, demangler and remangler classes for the new mangling scheme.
Following classes provide symbol mangling for specific purposes:
*) Mangler: the base mangler class, just providing some basic utilities
*) ASTMangler: for mangling AST declarations
*) SpecializationMangler: to be used in the optimizer for mangling specialized function names
*) IRGenMangler: mangling all kind of symbols in IRGen

All those classes are not used yet, so it’s basically a NFC.

Another change is that some demangler node types are added (either because they were missing or the new demangler needs them).
Those new nodes also need to be handled in the old demangler, but this should also be a NFC as those nodes are not created by the old demangler.

My plan is to keep the old and new mangling implementation in parallel for some time. After that we can remove the old mangler.
Currently the new implementation is scoped in the NewMangling namespace. This namespace should be renamed after the old mangler is removed.
2016-12-02 15:55:30 -08:00
swift-ci
c13af38084 Merge pull request #6008 from nkcsgexi/edits-serialization 2016-12-01 13:29:57 -08:00
Xi Ge
7a58f00b6d [utils] Modify writeEdit() to take multiple edits instead of a single one to help preserve the correct json format. NFC 2016-12-01 12:47:09 -08:00
Roman Levenstein
409d146f17 Reduce memory usage by freeing memory occupied by SILModules after IRGen.
There is no need to keep SILModules around after IRGen has generated LLVM IR from them.
This reduces the compiler memory usage during LLVM code-generation and optimization phases roughly by 15%-20%.
2016-11-29 22:11:59 -08:00
David Farler
30dd1a9047 Merge pull request #5875 from bitjammer/parse-typecheck-flag
Parse typecheck flag
2016-11-28 15:06:50 -08:00
Xi Ge
f1113b2677 [Utils] Expose edit serialization utility for more clients. 2016-11-28 12:55:27 -08:00
David Farler
6d8514b2a3 Add back the -parse flag, which doesn't typecheck 2016-11-28 10:50:55 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Brian Gesiak
fc1c81f500 [Frontend] Preserve .swiftdeps files
The Swift compiler uses files with an extension of ".swiftdeps" to store
information about cross-file dependencies. These files are read in at the
start of compilation to compute a dependency graph, and updated as compilation
proceeds. However, because these files are updated on every build, an
issue with dependency analysis is hard to reproduce—the inputs have been
lost.

Address this by renaming swiftdeps files that are about to be
overwritten, to '.swiftdeps~'. This preserves dependency information
from the most recent compilation (but no further back).
2016-11-16 22:51:05 -05:00
Michael Gottesman
e173438d6b [semantic-arc] Even when we are not running diagnostics, run the sil ownership eliminator.
This only happens when we are testing deserialization.
2016-10-29 20:11:08 -07:00
Brian Gesiak
87df087a2d [Frontend] Remove TODO for diagnostics (NFC)
Addresses SR-2683.
2016-09-23 09:01:21 -04:00
Jordan Rose
fea7878806 Auto-apply the new generic parameter fix-it during migration.
Last bit of rdar://problem/27087345.
2016-09-21 18:04:14 -06:00
practicalswift
b19481f887 [gardening] Fix 67 recently introduced typos 2016-09-16 11:16:07 +02:00
Jordan Rose
5746671a19 Add -verify-apply-fixes to accompany -verify.
Enables Chris's auto-apply-fixes mode for -verify: if an expected-*
annotation has the wrong message, or if the expected fix-its are
incorrect, this option will **edit the original file** to update them.

This is a tool for compiler developers only; it doesn't affect
normal diagnostic printing or normal fix-its.
2016-09-15 10:38:43 -07:00
adrian-prantl
d0f16bf9f9 Merge pull request #4697 from adrian-prantl/28231982
Bump the DWARF format to version 4 on Darwin.
2016-09-13 10:13:51 -07:00
Adrian Prantl
9f060dc5b7 Bump the DWARF format to version 4 on all platforms.
This unifies the output across all supported platforms and
brings swiftc in sync with clang.

<rdar://problem/28231982>
2016-09-12 09:31:38 -07:00
Michael Gottesman
b48b4d96fe Merge remote-tracking branch 'origin/master' into master-next 2016-09-07 15:35:07 -07:00
Doug Gregor
311fc55bdb [Scope map] Query the declarations introduced by a given AST scope.
Introduce an operation that produces the set of local declarations
that are newly introduced by a given AST scope. This is a building
block of unqualified name lookup, which walks upward in the tree
(e.g., from children to parents) looking for declarations that have
been made visible at each step.
2016-09-06 09:05:10 -07:00
Doug Gregor
c612f4feda [Scope map] Add support for querying the immediate and nearest enclosing DeclContexts of a scope. 2016-09-02 17:13:05 -07:00
Doug Gregor
412d1d5e1e [Scope map] Introduce an operation to find the innermost scope based on a given source location.
Given a source location, we can find the innermost enclosing scope
that describes that source location. Introduce this operation into the
scope map, then add a testing mode where we probe the scope map at
specifi locations to see what we find. Test for:

1) Finding the right innermost enclosing scope, and
2) That we're only expanding the part of the scope map that is needed
to identify that scope.
2016-09-02 17:13:05 -07:00
Doug Gregor
4e214687ca [WIP Name binding] Introduce a basic 'scope map' to model scopes in the AST.
The scope map models all of the name lookup scopes within a source
file. It can be queried by source location to find the innermost scope
that contains that source location. Then, one can follow the parent
pointers in the scope to enumerate the enclosing scopes.

The scope map itself is lazily constructed, only creating scope map
nodes when required implicitly (e.g, when searching for a particular
innermost scope) or forced for debugging purposes.

using a lazily-constructed tree that can be searched by source
location. A search within a particular source location will
2016-09-02 17:13:05 -07:00
Michael Gottesman
fa1bb95923 Merge remote-tracking branch 'origin/master' into master-next 2016-08-30 19:50:12 -07:00
Jordan Rose
3d005f3ad9 [Parse] Add fix-its for empty Swift 2 operator decl braces. (#4309)
And improve the error message for non-empty braces; if we're going to
ignore the contents, we should at least point you in the right
direction for Swift 3.

rdar://problem/27576922
2016-08-15 14:43:09 -07:00
Argyrios Kyrtzidis
895dc90513 [FixCode] Disable a migrating fixit that interacts badly with the migrator.
For such code:
  func test(p: Int, _: String) {}
  test(0, "")

the compiler bizarrely suggests to change order of arguments in the call site.
2016-08-12 13:33:46 -07:00
Argyrios Kyrtzidis
0cd8ca56dc [FixCode] Accept the fixit for the warning that @warn_unused_result is the default now.
rdar://27516354
2016-08-12 11:47:14 -07:00
Ben Langmuir
8b42212543 Merge remote-tracking branch 'benlangmuir/fixit-protocol-comp'
Conflicts:
	lib/FrontendTool/FrontendTool.cpp
	test/FixCode/fixits-apply.swift
	test/FixCode/fixits-apply.swift.result
2016-08-11 12:55:21 -07:00
Ben Langmuir
ec539d6abf [fixcode] Enabled protocol<...> fixits
The old syntax is deprecated in swift 3, and these fixits seem quite
safe, so apply them for migration.

rdar://problem/27794981
2016-08-11 10:28:18 -07:00
Ben Langmuir
454ee8a8d9 [fixcode] Add ( as AnyObject) fixit to the whitelist
This fixit comes from a note, but is very useful for migration of code
that has changed from AnyObject to Any but wants to do AnyObject
dispatch.

rdar://problem/27793389
2016-08-10 14:51:59 -07:00
Xi Ge
398f483557 [FixCode] Blacklist the fixit for enum case renames to avoid reverting migrator's change. rdar://27776887 (#4199)
We added the fixit to help users manually migrate enum case references after the declaration
has been renamed; however, when interacting with the migrator, the fixit may revert migrator's
correct changes, when the migrator updates references before updating the declaration. This patch
blacklists the fixit in migrator's pass, so we leave it to users' manually application if necessary.
2016-08-10 13:52:25 -07:00
Michael Ilseman
a29700ee74 [noescape by default] Migration should apply @noescape deprecation fixits 2016-08-04 16:33:14 -07:00
Jordan Rose
91be25ffb4 Dependency analysis: treat member operators as top-level "provides". (#3986)
We still do a global lookup for operators even though they are
syntactically declared within types now, so for dependency-tracking
purposes continue to treat that as declared at the top level.

This isn't where we actually want to be---ideally we can use the types
of the arguments to limit the dependencies to a member lookup (or pair
of member lookups)---but since the operator overloads /themselves/
participate in type-checking an expression, I'm not sure that's 100%
correct. For now, it's better to be conservative. (This means
dependency analysis for operators remains as lousy as it was in Swift
2, but it's not a regression.)

rdar://problem/27659972
2016-08-04 08:40:26 -07:00
Argyrios Kyrtzidis
92c0980a88 [FixCode] Make sure to accept the fixit in warning about 'where' syntax change. 2016-08-02 13:00:45 -07:00
Argyrios Kyrtzidis
c04aadb1a8 [FixCode] Make sure to accept the fixit in note about adding '@escaping'. 2016-08-02 10:04:40 -07:00
Robert Widmann
80fb5c1c5a Remove usage of getMetatypeLoc() 2016-07-29 16:59:14 -07:00
John McCall
c8c41b385c Implement SE-0077: precedence group declarations.
What I've implemented here deviates from the current proposal text
in the following ways:

- I had to introduce a FunctionArrowPrecedence to capture the parsing
  of -> in expression contexts.

- I found it convenient to continue to model the assignment property
  explicitly.

- The comparison and casting operators have historically been
  non-associative; I have chosen to preserve that, since I don't
  think this proposal intended to change it.

- This uses the precedence group names and higherThan/lowerThan
  as agreed in discussion.
2016-07-26 14:04:57 -07:00
Jordan Rose
508e825ff2 Split 'fileprivate' and 'private', but give them the same behavior.
'fileprivate' is considered a broader level of access than 'private',
but for now both of them are still available to the entire file. This
is intended as a migration aid.

One interesting fallout of the "access scope" model described in
758cf64 is that something declared 'private' at file scope is actually
treated as 'fileprivate' for diagnostic purposes. This is something
we can fix later, once the full model is in place. (It's not really
/wrong/ in that they have identical behavior, but diagnostics still
shouldn't refer to a type explicitly declared 'private' as
'fileprivate'.)

As a note, ValueDecl::getEffectiveAccess will always return 'FilePrivate'
rather than 'Private'; for purposes of optimization and code generation,
we should never try to distinguish these two cases.

This should have essentially no effect on code that's /not/ using
'fileprivate' other than altered diagnostics.

Progress on SE-0025 ('fileprivate' and 'private')
2016-07-25 13:13:35 -07:00
Mark Lacey
1c00ac4c6d Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	lib/IRGen/IRGen.cpp
	test/DebugInfo/parent-scope.swift
2016-07-15 19:23:53 -07:00
Ben Langmuir
e50c232f4b [FixCode] Add another case of inserting ';' to the ban list
We missed one of the fixits that insert ; separators.

rdar://problem/26681061
2016-07-06 17:08:08 -07:00
Ben Langmuir
cb4b1b601b [FixCode] Apply #selector fixits
These are very useful fixits for migration. Note: this applies the
fixits for selectors that are actually found, but not the one that wraps
an arbitrary string literal in Selector(...), because that one indicates
a possibly missing selector that the user should review.

rdar://problem/26678232
2016-07-05 10:50:39 -07:00
Ben Langmuir
3f026bea27 [FixCode] Don't add .dynamicType
Adding .dynamicType interacts poorly with the swift migrator by
invalidating some inits with type errors.

rdar://problem/26642062
2016-07-05 09:46:38 -07:00
Ben Langmuir
d5d48f38b6 [FixCode] Apply @* is now an attribute on a parameter type fixits 2016-07-05 09:46:38 -07:00