Commit Graph

557 Commits

Author SHA1 Message Date
Jordan Rose
75c6ec9def Start tracking lookups on AnyObject/AnyClass.
These form dependencies as well. Part of rdar://problem/19270018.

Swift SVN r24049
2014-12-20 01:59:01 +00:00
Justin Bogner
efc8f11ffe Driver: Handle -help earlier in frontend_main
This makes ``swiftc -frontend -help`` print the help instead of
erroring out with "no frontend action was selected".

Swift SVN r23820
2014-12-09 23:50:12 +00:00
Dmitri Hrybenko
b11d050ff3 Driver: disable the compiler if COMPILER_DISABLE_SWIFT env var is
present

rdar://19161254

Swift SVN r23744
2014-12-05 22:41:49 +00:00
Michael Gottesman
123b8e6f61 Access SILOptions in SILPassManager via the SILModule now that we store the SILOptions in the SILPassManager.
Swift SVN r23651
2014-12-03 20:39:05 +00:00
Michael Gottesman
85e2502f96 Pass in SILOptions to SILModule.
This should have been done a long time ago since SILOptions are options that
should be able to effect everything SIL related. In this case I just want to
pass in a flag on the SILModule to enable +0 self. By putting it on the
SILModule I can conveniently check it in SILFunctionType without exposing any
internal state from SILFunctionType.cpp.

Swift SVN r23647
2014-12-03 07:43:52 +00:00
Adrian Prantl
41a30f5988 Support line table only DWARF for Swift. <rdar://problem/19106981>
The new option is called -gline-tables-only to mirror clang.

Swift SVN r23615
2014-12-02 17:44:23 +00:00
Jordan Rose
c712c51d4a Dependencies: start tracking whether a lookup is private to a file or not.
This is sort of two commits squashed into one: first, update
ReferencedNameTracker to record whether a name or type is non-private,
along with changing all clients to assume non-private; and second,
actually try to (conservatively) decide if a particular unqualified lookup can
be considered private.

What does "private" mean? That means that a dependency does not affect
"downstream" files. For example, if file A depends on B, and B depends on C,
then a change in C normally means A will get rebuilt. But if B's dependencies
on C are all private dependencies (e.g. lookups from within function bodies),
then A does not need to be rebuilt.

In practice there are several rules about when we can make this assumption,
and a few places where our current DeclContext model is not good enough to
distinguish private uses from non-private uses. In these cases we have to
be conservative and assume that the use is non-private (and thus that
downstream files will need to be rebuilt).

Part of rdar://problem/15353101

Swift SVN r23447
2014-11-19 22:28:30 +00:00
Joe Groff
ad7ffad07d Enable debug info in JIT mode.
Swift SVN r23318
2014-11-14 02:12:36 +00:00
Dmitri Hrybenko
a2faf6beb6 CMake: add a comment about linking the 'swift' binary
Swift SVN r23264
2014-11-12 08:02:27 +00:00
Dmitri Hrybenko
1347b446c9 Stop using the MODULES_SDK variable in -D flags for the C++ compiler
Swift SVN r23097
2014-11-04 05:44:12 +00:00
Dmitri Hrybenko
e954ac9534 CMake: normalize checks for Apple operating systems
Swift SVN r23056
2014-11-01 04:14:36 +00:00
Jordan Rose
2b47f3e7ec Emit the list of nominals declared or extended in the primary file.
This is part of the intra-module dependency tracking work to implement
incremental rebuilds.

Part of rdar://problem/15353101

Swift SVN r22930
2014-10-24 22:23:08 +00:00
Jordan Rose
e65478608b Change temporary "swiftdeps" format to be YAML-compatible.
No real functionality change. This just lets me play with the data in Ruby
more easily.

Swift SVN r22929
2014-10-24 22:23:07 +00:00
Jordan Rose
241a6277a9 The list of decls provided by a file should not include private decls.
Part of rdar://problem/15353101

Swift SVN r22928
2014-10-24 22:23:06 +00:00
Jordan Rose
ca6639cf97 Track types that we perform qualified lookup on from the primary file.
We need to do this mainly to figure out when extensions can affect this file.
This is part of the intra-module dependency tracking work to implement
incremental rebuilds.

Part of rdar://problem/15353101

Swift SVN r22927
2014-10-24 22:23:05 +00:00
Jordan Rose
9afdd1bc2f Print the top-level names "provided" by a file along with its references.
Every name a file declares is something that another file in the same module
might depend on. The driver will need this information too to correctly
decide what files need to be rebuilt. This is part of the intra-module
dependency tracking work to implement incremental rebuilds.

This doesn't handle extensions yet, which are a bit trickier. Need to
figure out how to handle the interaction between extensions and typealiases.

Part of rdar://problem/15353101

Swift SVN r22926
2014-10-24 22:23:04 +00:00
Jordan Rose
fc09bd4585 Add basic reference tracking based on name lookups.
This tracks top-level qualified and unqualified lookups in the primary
source file, meaning we see all top-level names used in the file. This
is part of the intra-module dependency tracking work that can enable
incremental rebuilds.

This doesn't quite cover all of a file's dependencies. In particular, it
misses cases involving extensions  defined in terms of typealiases, and
it doesn't yet track operator lookups. The whole scheme is also very
dependent on being used to track file-level dependencies; if C is a subclass
of B and B is a subclass of A, C doesn't appear to depend on A. It only
works because changing A will mark B as dirty.

Part of rdar://problem/15353101

Swift SVN r22925
2014-10-24 22:23:03 +00:00
Connor Wakamo
d3d031c0e3 [CMake] Set SWIFT_REPL_ARCLITE based on SWIFT_DEPLOYMENT_OS instead of hard-coding "macosx".
Swift SVN r22896
2014-10-23 20:43:40 +00:00
Erik Eckstein
d6861570db Enable whole-module-optimizations for the stdlib and for tests.
This gives about 7% code size reduction in Swift.o



Swift SVN r22659
2014-10-10 09:54:53 +00:00
Erik Eckstein
43f68b6974 Enable dead function removal for internal function in whole-module compilation.
This is controlled by a new isWholeModule() attribute in SILModule.

It gives about 9% code size reduction on the benchmark executables.
For test-suite reasons it is currently not done for the stdlib.



Swift SVN r22491
2014-10-03 14:14:23 +00:00
Jordan Rose
042569a3be Optional: Replace uses of Nothing with None.
llvm::Optional (like Swift.Optional!) uses None as its placeholder value,
not Nothing.

Swift SVN r22476
2014-10-02 18:51:42 +00:00
Graham Batty
5f1fb56d66 Change order of dependencies to fix link error
The other way around causes link errors on linux for some reason.

Swift SVN r22359
2014-09-29 19:02:32 +00:00
Dmitri Hrybenko
932953eacb Allow CMake to succeed on non-Darwin systems
Swift SVN r22312
2014-09-27 21:56:41 +00:00
Doug Gregor
e0afb13abb Remove the APINotes library; it lives in Clang, now.
Swift SVN r22286
2014-09-25 18:48:43 +00:00
Doug Gregor
6559392293 Start re-namespacing APINotes and its dependencies.
FixNum.h and BCRecordLayout.h will move down into LLVM, APINotes
will move into Clang. Get the namespaces right before we start to move
files around.

Swift SVN r22218
2014-09-23 17:52:17 +00:00
Erik Eckstein
c16c510167 Set SILLinkage according to visibility.
Now the SILLinkage for functions and global variables is according to the swift visibility (private, internal or public).

In addition, the fact whether a function or global variable is considered as fragile, is kept in a separate flag at SIL level.
Previously the linkage was used for this (e.g. no inlining of less visible functions to more visible functions). But it had no effect,
because everything was public anyway.

For now this isFragile-flag is set for public transparent functions and for everything if a module is compiled with -sil-serialize-all,
i.e. for the stdlib.

For details see <rdar://problem/18201785> Set SILLinkage correctly and better handling of fragile functions.

The benefits of this change are:
*) Enable to eliminate unused private and internal functions
*) It should be possible now to use private in the stdlib
*) The symbol linkage is as one would expect (previously almost all symbols were public).

More details:

Specializations from fragile functions (e.g. from the stdlib) now get linkonce_odr,default
linkage instead of linkonce_odr,hidden, i.e. they have public visibility.
The reason is: if such a function is called from another fragile function (in the same module),
then it has to be visible from a third module, in case the fragile caller is inlined but not
the specialized function.

I had to update lots of test files, because many CHECK-LABEL lines include the linkage, which has changed.

The -sil-serialize-all option is now handled at SILGen and not at the Serializer.
This means that test files in sil format which are compiled with -sil-serialize-all
must have the [fragile] attribute set for all functions and globals.

The -disable-access-control option doesn't help anymore if the accessed module is not compiled
with -sil-serialize-all, because the linker will complain about unresolved symbols.

A final note: I tried to consider all the implications of this change, but it's not a low-risk change.
If you have any comments, please let me know.



Swift SVN r22215
2014-09-23 12:33:18 +00:00
Lang Hames
3af1bd5079 Remove the dependence on the old JIT - it has been removed from master.
See <rdar://problem/16525932>.


Swift SVN r22193
2014-09-23 01:02:30 +00:00
Ben Langmuir
13b44b7814 Revert "Suppress CrashTracer aggregation for crashes in non-production compilers."
This is failing to build in Jenkins

This reverts commit r22058

Swift SVN r22075
2014-09-18 15:43:12 +00:00
Greg Parker
5b22baffcd Suppress CrashTracer aggregation for crashes in non-production compilers.
rdar://18177298


Swift SVN r22058
2014-09-18 03:17:46 +00:00
Adrian Prantl
72a6261f68 Emit discriminators *only* for multi-file projects.
Swift SVN r21917
2014-09-12 18:50:23 +00:00
Adrian Prantl
0cd5cee972 Slightly improve the private discriminators to also handle the primary
source file of a multi-file project.

Swift SVN r21916
2014-09-12 18:41:12 +00:00
Adrian Prantl
90d0d69dcb Store the main SourceFile's private discriminator in the DWARF debug flags.
<rdar://problem/18297696> Store a SourceFile's discriminator somewhere in the debug info

Swift SVN r21912
2014-09-12 18:16:20 +00:00
Jordan Rose
b5f3d66621 More fixes to handle paths-to-Xcode containing spaces.
No functionality change.

Swift SVN r21756
2014-09-06 00:18:06 +00:00
Jordan Rose
adc25c8b9f Staging: Guard private discriminators under -enable-primary-discriminators.
...rather than let this series of out-of-tree commits get any bigger.

Swift SVN r21601
2014-08-30 00:17:23 +00:00
Argyrios Kyrtzidis
628567bfe5 [Frontend] Make it erroneous if no frontend action is specified when invoking the frontend, and update tests.
Swift SVN r21584
2014-08-29 19:17:37 +00:00
Argyrios Kyrtzidis
0de5a66345 [Frontend] Introduce FrontendOptions::NoneAction, when the client wants custom control on how to handle an invocation.
This fixes SourceKit tests after r21537.

Swift SVN r21564
2014-08-29 04:58:37 +00:00
Jordan Rose
422565100e [Serialization] Keep track of whether a module has an underlying Clang module.
Previously, we depended on whether or not a serialized module was located
within a framework bundle to consider whether or not it may have a "Clang
half". However, LLDB loads serialized modules from dSYM bundles. Rather
than try to figure out if such a module is "really" a framework, just track
whether the original module was built with -import-underlying-module. If so,
consider the underlying Clang module to be re-exported.

rdar://problem/18099523

Swift SVN r21544
2014-08-28 21:36:02 +00:00
Jordan Rose
90c76906bd [Serialization] Wrap up serialization options into a class.
No functionality change.

Swift SVN r21542
2014-08-28 21:35:57 +00:00
Andrew Trick
9ce5894db1 Fix raw_fd_ostream calls for ToT constructor changes
Swift SVN r21447
2014-08-25 23:29:36 +00:00
Connor Wakamo
6e6e20ab4b [test] Added an integrated "-test-createCompilerInvocation" tool to swift-ide-test.
This is very basic: it just sees whether, given a set of driver arguments, the
swift::driver::createCompilerInvocation API returns a non-null
CompilerInvocation.

Unlike other modes of swift-ide-test, this mode requires that
"-test-createCompilerInvocation" be the first argument passed to swift-ide-test.
This is because it is handled separately from llvm::cl::ParseCommandLineOptions
so the remaining arguments can be passed through directly to
swift::driver::createCompilerInvocation without any interference from that
parser.

Additionally, added a test which uses this tool to try to create a
CompilerInvocation for a handful of basic driver commands.

Swift SVN r20973
2014-08-03 19:04:27 +00:00
Ben Langmuir
07a3c7cbd5 Switch to the new swift/swiftc commmand line interface
This makes the command line interface to 'swift' the same as what was
previously in 'swifti', and removes the staging symlink.

For posterity, the command line behaviour for 'swift' is now:
* `swift` -> start the repl
* `swift script.swift` -> run script.swift (the old -i mode)
* Any arguments after the input file are forwarded to the script as
  Process.arguments
* A shebang line is something like #!/usr/bin/xcrun swift

The batch compiler 'swiftc' behaves much like the old 'swift'
executable, but without the interactive bits now in 'swifti'.

<rdar://problem/17710788>

Swift SVN r20540
2014-07-25 13:28:21 +00:00
Anna Zaks
39eb145c10 APINotes: Teach the YAML converter about OS availability.
The converter silently drops the API which are available only on a OS different from the specified "target".

I've restructured the code so that we would not have to pass the parameters around.

TODO:
 - Make the traget argument required.
 - Use it in the build system when building swift
 - Add a test case for when the whole framework is missing. (Tested manually.)

Swift SVN r20464
2014-07-24 03:16:58 +00:00
Jordan Rose
b6818046a8 Eliminate optimization levels 0-3 in favor of -Onone/-O/-Ofast.
We were already effectively doing this everywhere /except/ when building
the standard library (which used -O2), so just use the model we want going
forward.

Swift SVN r20455
2014-07-24 01:12:59 +00:00
Ben Langmuir
a96009c52f Add a 'swifti' symlink to stage in the upcoming driver changes
For now, keep 'swift' the same and put all the interactive driver
changes under 'swifti'. When these are in good shape, I will remove
swifti and make 'swift' the interactive driver as discussed.

Swift SVN r20359
2014-07-23 02:30:39 +00:00
Doug Gregor
f48829c7a7 API notes: add the ability to translate a binary API notes file (.apinotesc) into YAML
Swift SVN r20333
2014-07-22 21:15:11 +00:00
Anna Zaks
0af674ccec API Notes: Add YAML to binary conversion.
Test that we are on par with known methods for Foundation and NotificationCenter.

Swift SVN r20328
2014-07-22 20:34:10 +00:00
Anna Zaks
59ba50d01a Pass reference to content to the YAML parser, instead of filename.
This also makes sure that the input buffer lives long enough.

Swift SVN r20266
2014-07-21 18:46:59 +00:00
Ben Langmuir
9c267d5dc7 Add some missing cmake dependencies
The only interesting bit is that for stdlib/objc to build reliably, its
.o files all need to depend on the generated swiftmodule files for any
of its library dependencies.  It looks like cmake treats
target_link_libraries as only implying a dependency between the
resulting libraries, and not the objects.  For now, I've achieved this
by making the objects depend on the whole target (which includes
linking), but only the swiftmodule is actually necessary.

Swift SVN r20240
2014-07-21 04:07:50 +00:00
Anna Zaks
993b822280 API Notes: complete parsing of the YAML format
This parses all the fields we are interested in.

Also, add the up-to-date spec of the YAML format in the comments.

Swift SVN r20205
2014-07-19 02:46:00 +00:00
Anna Zaks
ae3e822c2c Add a skeleton for API Notes YAML-to-binary conversion
Reapplies r20137 with most comments addressed.

Parses a YAML file (but not the final/full format yet).

Adds an entry to the driver for the apinotes "tool". We want the tool
to be visible to the user so it has to go to the driver.

Very limited testing as of now.

Swift SVN r20173
2014-07-18 19:54:11 +00:00