Also, restructure so that the option isn't declared in a random library file.
(And do the same with "-sil-link-all".)
Part of the migration to the new driver.
Swift SVN r13184
Previously, main() would always return 0 if a Compilation was not built. Now
that the driver is correctly emitting diagnostics, check for any errors to see
if it should return 1 instead.
Swift SVN r13176
Currently only inline functions referenced from Swift source files, or
from the REPL, will get IR generated for them. Inline functions
referenced by other inline functions will require additional effort to
generate properly.
With this change we use the clang::CodeGenerator-created llvm::Module
for all IR generation in Swift. This is perhaps undesirable, but
unavoidable given the interface the public Clang APIs expose, which do
not allow for building a ModuleBuilder that borrows an existing
llvm::Module.
Also unfortunate is the hack to generate a UsedAttr for each imported
inline function, but the public Clang APIs do not provide a way to only
emit deferred decls without emitting other things (e.g. module flags
that conflict with what the Swift IRGen emits). Note that we do not do
IRGen for every inline function in the module - only the ones that the
importer pulls in, which appears to be only those transitively
referenced from Swift code.
Swift SVN r13134
Previously it would create a new module if one was not passed in. There
are no uses where we do not or cannot provide a module, so it seems
reasonable to make the interface consistently require a module.
Swift SVN r13016
This pass attempts to remove alloc_ref and everything that uses the alloc_ref
if:
1. The alloc_ref has a destructor which we can very does not have escaping side
effects.
2. The alloc_ref does not have any non-trivial uses that are not stores.
It reduces ObjInst on my cpu from 10206922128 ns to 46 ns (i.e. nothing).
Swift SVN r12990
This tool implements support for running IR transformations; in particular, it
replaces the functionality supported by "swift -arc-optimize" and
"swift -arc-transform".
No tests yet, but this will be used by several tests once we complete the
transition to the new driver.
Swift SVN r12927
Currently when compiling with debug info, the AST gets serialized into the
.o file for use by the debugger. However, when we switch to one .o file
per .swift file, this won't really make sense any more. Instead, we should
collect all the ASTs at the end of the build and merge them together, then
write /that/ into the final binary.
This commit handles writing a serialized AST with an LLDB wrapper around it,
so that we can take a merged AST, write it out in the wrapper, and splice it
into the final binary using ld's -sectcreate option.
In the long run, we probably won't need the LLDB wrapper, but for now I'm
trying to disturb as little as possible. (It looks like the layout is
broken on 32-bit platforms, though...there was a problem with 64-bit
relocations in the existing SwiftASTStreamerPass, but nothing ever tried to
/read/ the new layout in 32 bits. I'm holding off on dealing with this
right now.)
Part of <rdar://problem/15786017>
Swift SVN r12667
Without build configurations we can't strip runtime checks from the SIL without also disable diagnostics for library users. We're going to try a different stopgap approach of not emitting the runtime checks in IRGen for the short term.
Swift SVN r12586
Updated frontend_main() and performCompile() to not reject
FrontendOptions::Immediate and instead call RunImmediately() with the correct
IRGenOptions.
Swift SVN r12522
Updated the swift_driver target so that it links against swiftImmediate and
CoreFoundation.
Updated frontend_main() and performCompile() to not reject FrontendOptions::REPL
and instead call REPLRunLoop().
Swift SVN r12520
In order to implement immediate and REPL modes in swift_driver, this functionality
needs to be in a library (instead of directly in the swift executable).
Swift SVN r12519
Thanks to the way we've set up our diagnostics engine, there's not actually
a reason for /everything/ to get rebuilt when /one/ diagnostic changes.
I've split them up into five categories for now: Parse, Sema, SIL, IRGen,
and Frontend, plus a set of "Common" diagnostics that are used in multiple
areas of the compiler. We can massage this later.
No functionality change, but should speed up compile times!
Swift SVN r12438
In the long term we want more detailed configurability of runtime checks, but for our short-term performance work we just want a blanket on/off switch. Add a StripRuntimeChecks SIL pass that, as a start, converts invocations of checked overflow builtins to the equivalent unchecked builtins and kills cond_fails. Expose it through the compiler with a -disable-all-runtime-checks switch.
NB: I haven't tested building the stdlib or running the tests with the switch thrown yet.
Swift SVN r12379
Added support for the -emit-module and -module-output-path options. -emit-module
and -module-output-path function similarly to -serialize-diagnostics and
-serialized-diagnostics-path: notably, -module-output-path implies -emit-module,
but -emit-module can be passed without -module-output-path and a default path
will be determined based on other inputs.
Added support for the -module-link-name option, which specifies the name of the
library to link against when importing the generated module.
Note that support for these options is only implemented in the integrated
frontend; driver-level support for these options is forthcoming.
Swift SVN r12301
For simplicity it currently only moves copy_values, strong_retains since we are
not doing the data flow analysis yet.
Even with its limitations (which are extreme), we are removing ~400
retain/release/copyvalue/destroyvalue pairs from the standard library.
Additionally we reduce the time RC4 takes from 7.5-5.5 (2 second delta).
Swift SVN r12264
Reworked the -serialize-diagnostics option, so that it is now just a flag
indicating that the frontend should generate serialized diagnostics. The path at
which the diagnostics will be serialized is now specified by the
-serialized-diagnostics-path option, which is a frontend-only option. (The
frontend treats -serialized-diagnostics-path as implying -serialize-diagnostics.)
If -serialize-diagnostics is passed but -serialized-diagnostics-path is not
passed, the frontend will choose an output path from a few default values:
- If the frontend has a non-stdout output path, replace that path's extension
with .dia.
- If there is a primary input filename, use that input's base name as the base
name for the serialized diagnostics file.
- Otherwise, use the module name as the base name for the serialized diagnostics
file.
Added support for setting up a serialized diagnostics DiagnosticConsumer in
frontend_main() if FrontendOptions::SerializedDiagnosticsPath is non-empty.
Swift SVN r12251
Yes, the current REPL is going away, but it will serve as a model for
the future replacement. The Swift grammar doesn't need this crutch and
the replacement shouldn't be tempted to replicate it.
Swift SVN r12205
Hitting 'up arrow' after an error does something far more reasonable now.
EXAMPLE:
(swift) struct Foo {
var a:
}
<REPL Input>:2:9: error: expected type
var a:
^
AFTER HITTING 'UP ARROW':
(swift) struct Foo {
var a:
}
Swift SVN r12203
...and then define SWIFT_METATYPE(X) as a macro for "Class", because
Objective-C doesn't have a way to constrain class types to a certain
hierarchy.
With this change, we should handle every type that makes it through the
@objc validator today.
Swift SVN r12190
C's wonderful declarator syntax makes this rather non-trivial. I've chosen
to implement this by pushing cleanups that will get called at the end of
a "full type", in reverse order.
With much thanks to cdecl.org (created by Peter Ammon from the AppKit team).
Swift SVN r12189
The @objc validator still rejects UnsafePointers of any non-mapped type,
so things like "NSRect *" and "MyClass **" get rejected, but this code
will do the right thing for those as well.
Swift SVN r12170
These get translated as "id <MyProto>" and "id <MyProto, OtherProto>",
of course. There's special handling for protocol metatypes so that we get
"Class <MyProto>". (Objective-C doesn't have any other way to specify what
operations are available on a particular Class, so this is pretty important!)
Swift SVN r12162
This just assumes the class has already been declared. The next step here
is to add something that walks all of the referenced types /before/ starting
to print the @interface, and makes sure they've been defined or at least
forward-declared.
Swift SVN r12087
We're still synthesizing external definitions too eagerly, and things
getting pulled in only through submodules aren't getting properly autolinked.
(That is, AppKit imports <QuartzCore/CIImage.h> but doesn't think that
QuartzCore is visible, because it isn't.)
The first right answer is to detect that a part of QuartzCore is visible even
though the whole thing isn't. The second right answer is to properly handle
Clang submodules as real modules---there are a lot of rough edges there.
<rdar://problem/13140302>. The third right answer is that we shouldn't even
emit references to these symbols until the /user/ needs them.
And what I'm doing now is just to attempt to link to every module that we've
synthesized thunks for.
<rdar://problem/15754311>
Swift SVN r12031