Commit Graph

189 Commits

Author SHA1 Message Date
Chris Lattner
d5314e7d28 rearrange REPL's SIL/IRGen path so that sil diagnostics are recovered from
the same way as sema diagnostics.  This fixes:
<rdar://problem/15000923> REPL exits if you declare something without initializing it


Swift SVN r8548
2013-09-21 21:54:55 +00:00
Jordan Rose
eef39ff914 Add a :print_module directive to the REPL.
This is basically the same as doing a :print_decl on every decl in the module,
except that it does not print extensions that come from other modules, and
/does/ print extensions and operators that come from this module.

Does not yet work for Clang modules or the Builtin module.

Swift SVN r7601
2013-08-26 23:07:51 +00:00
Jordan Rose
3e992a64fa Use -module-link-name to encode library names in standard library modules.
...which allows us to drop the hardcoded logic to load specific libraries
in immediate modes.

Swift SVN r7585
2013-08-26 18:57:50 +00:00
Jordan Rose
920253877c Fix autolinking for libraries in immediate modes.
...and fall back to looking in the Swift runtime directory if dyld's
default lookup fails.

Swift SVN r7584
2013-08-26 18:57:49 +00:00
Chris Lattner
80cb2021d2 teach the repl to run SIL diagnostic passes too, which is required for correctness
with the new definite init model (well, it always is, but not IRGen explodes if
they aren't run instead of just producing broken code).

This is also a step towards rdar://14819740


Swift SVN r7575
2013-08-26 16:48:31 +00:00
Chris Lattner
af1a8205b8 rename tools/swift/Frontend.{h|cpp} -> Helpers.{h|cpp} to avoid hopelessly
confusing me with the Frontend library.  Add some more include guards around
the real Frontend.h header.


Swift SVN r7570
2013-08-26 16:08:34 +00:00
Chris Lattner
0c8deef48a move the list of sil diagnostic passes out to a "runSILDiagnosticPasses"
helper function which is shared by the compiler and the immediate mode
stuff.  This way, diagnostic passes are run on modules imported by "-i".

Also add include guards and clean up headers a lot.


Swift SVN r7568
2013-08-26 16:06:37 +00:00
Chris Lattner
41ea6ac780 refactor the interface to RunImmediately to pass down the CompilerInstance,
instead of a few parts of it.  No functionality change.


Swift SVN r7567
2013-08-26 15:50:31 +00:00
Jordan Rose
7d6d336983 Add autolinking infrastructure to Module and ClangImporter.
...and use it to load frameworks and libraries in immediate modes (-i and
the REPL), replacing a walk of visible modules that checked if any imported
modules were Clang modules.

Swift SVN r7488
2013-08-22 23:20:23 +00:00
Jordan Rose
b1ef55936b Use Module::forAllVisibleModules to decide what libraries we need to link in.
This ensures that libSwiftAppKit.dylib gets loaded if we import Cocoa.
It's not perfect because we really should process /all/ modules, not just
visible modules...but it does fix <rdar://problem/14716017>. The long-term
fix is proper autolinking.

Swift SVN r7304
2013-08-16 23:32:50 +00:00
Doug Gregor
3c4fc9e34a Fix REPL commands (e.g., :print_decl), which were totally broken.
Swift SVN r7215
2013-08-13 23:37:15 +00:00
Dmitri Hrybenko
0761a2ebd7 REPL: pass all unprocessed lines to code completion
This enables us to do code completion in function bodies and resolve local
variables.


Swift SVN r7118
2013-08-10 01:18:43 +00:00
Doug Gregor
b6cb0d0d48 Remove some outdated help from the REPL
Swift SVN r7078
2013-08-09 17:38:41 +00:00
Jordan Rose
a35f7cbd4b Thread [exported] through TranslationUnit and the Serialization library.
This still doesn't do anything yet.

Swift SVN r7051
2013-08-08 19:09:21 +00:00
Argyrios Kyrtzidis
4908da8361 [Lexer] Remove the public Lexer constructor that accepts a StringRef.
Replace uses of it with the newly introduced constructor that accepts a buffer ID.
The StringRef constructor was rather unsafe since it had the implicit requirement that the StringRef
was null-terminated.

Swift SVN r6942
2013-08-06 14:59:03 +00:00
Chris Lattner
8956e856c6 remove the old AST capture analysis pass completely. The primary IR
gen pass has had it disabled for some time, so snip the last few uses
in the REPL and zap it.

Goodbye old friend, you were a very useful stopgap.


Swift SVN r6885
2013-08-05 14:14:17 +00:00
Dmitri Hrybenko
5cea4ebf41 Code completion: put CodeCompletionOffset on SourceManager instead of passing
around everywhere

Fixes:
rdar://14585108 Code completion does not work at the beginning of the file
rdar://14592634 Code completion returns zero results at EOF in a function
                without a closing brace


Swift SVN r6820
2013-08-01 22:08:58 +00:00
Dmitri Hrybenko
e1c4ae3174 Wrap llvm::SourceMgr in swift::SourceManager so that we can add new members
to the source manager.


Swift SVN r6815
2013-08-01 20:39:22 +00:00
Dmitri Hrybenko
9856263a61 Revert r6789 based on a review comment
Original commit message:
REPL: bind ESC to code completion. This is consistent with Xcode.


Swift SVN r6792
2013-08-01 00:38:54 +00:00
Dmitri Hrybenko
fb3e2be31a REPL: bind ESC to code completion. This is consistent with Xcode.
Swift SVN r6791
2013-08-01 00:27:46 +00:00
Dmitri Hrybenko
f92237b12a tools/swift: Refactor REPLEnvironment so that it uses libFrontend to create
the TranslationUnit


Swift SVN r6789
2013-08-01 00:03:36 +00:00
Dmitri Hrybenko
9d832569bd Move REPL code completion wrapper to libIDE so that it can be reused and we can
add tests for it


Swift SVN r6763
2013-07-30 22:54:00 +00:00
Jordan Rose
d9b7c8ad5a Move ClangModule into the ClangImporter library.
This makes it very clear who is depending on special behavior at the
module level. Doing isa<ClangModule> now requires a header import; anything
more requires actually linking against the ClangImporter library.

If the current source file really can't import ClangModule.h, it can
still fall back to checking against the DeclContext's getContextKind()
(and indeed AST currently does in a few places).

Swift SVN r6695
2013-07-29 18:56:35 +00:00
Dmitri Hrybenko
c2e05bfcb9 REPL: use new code completion engine from libIDE
Swift SVN r6641
2013-07-26 04:05:28 +00:00
Chris Lattner
11f5b48a27 Fix a -Wdocumentation warning, and hack out NoFramePointerElimNonLeaf to
fix the build.  This isn't a proper fix (we should start putting out new attributes
on llvm::Function's, but getting the build working again seems important.


Swift SVN r6584
2013-07-25 03:41:57 +00:00
Jordan Rose
9156e805f5 Don't crash when looking for imports in a loaded module.
At some point this will change because of re-exported modules, but for now
just don't crash when performing unqualified lookup on a loaded module.

Also, auto-load our adapter libraries for loaded modules, not just TUs.
Include "POSIX" in this list. (We really need autolinking.)

Swift SVN r6303
2013-07-16 23:10:49 +00:00
Joe Groff
b9aca28a27 REPL: Outdent 'case' labels on entry.
Swift SVN r6165
2013-07-11 18:32:28 +00:00
Dmitri Hrybenko
cb98234d67 Allow the parser to persist after parseIntoTranslationUnit() returns
Swift SVN r6102
2013-07-10 00:25:37 +00:00
Joe Groff
aa19b4297e frontend: Perform capture analysis before SILGen in -i mode.
Doing it after SILGen is useless, and worse, it causes -i to act on different IR from -emit- modes, making debugging harder.

Swift SVN r6002
2013-07-05 06:25:52 +00:00
Adrian Prantl
17827e9121 Disable debug information by default when in REPL mode.
Swift SVN r5981
2013-07-03 23:15:03 +00:00
Doug Gregor
90ddbfd46a Complain if we can't dlopen() a library in immediate mode
Swift SVN r5970
2013-07-03 17:16:11 +00:00
Dave Abrahams
096ffc6eaf Silence warnings in the release build
Swift SVN r5950
2013-07-01 21:42:16 +00:00
Dmitri Hrybenko
2d9233862a Splitting the standard library: rename swift_stdlib.dylib ->
swift_stdlib_core.dylib according to the directory name.


Swift SVN r5881
2013-06-28 21:47:12 +00:00
Dmitri Hrybenko
c103a6122f Use multiple argument form of sys::path::append()
Swift SVN r5870
2013-06-28 17:17:38 +00:00
Dmitri Hrybenko
cb8a9f9954 Fix handling of unmatched right parens in the REPL
Fixes rdar://14247238 Interpreter hangs and consumes memory on an unmatched right paren


Swift SVN r5849
2013-06-27 22:32:07 +00:00
Dmitri Hrybenko
27abcf4311 Don't use PathV1.h in swift! It is gone in LLVM now.
Swift SVN r5816
2013-06-26 18:02:20 +00:00
Chris Lattner
1040bfec6a In the REPL, allow access to the Builtin module if explicitly imported,
there is no reason to deny it and it could be theoretically useful.


Swift SVN r5779
2013-06-24 16:07:56 +00:00
Chris Lattner
e8bf1dd6f5 expand the TranslationUnit kind to handle "standard library", and
plumb it through the compiler a bit.  This simplifies some code
in the driver, but should not induce any behavior change (yet).


Swift SVN r5740
2013-06-21 17:42:37 +00:00
Dmitri Hrybenko
f7cc014820 Explicitly include PathV1.h where it is used
Swift SVN r5577
2013-06-13 22:16:30 +00:00
Joe Groff
49dfa58f37 REPL: Create a new MemoryBuffer for each input.
Instead of reusing a fixed-size buffer, which causes problems when error messages refer back to previous inputs and corrupts AST references in *LiteralExpr that point back into source buffers, allocate each REPL input into its own buffer with its own SourceMgr entry. Fixes <rdar://problem/13387167>, crashes when using :dump_ast on expressions containing integer/float literal expr nodes, and hopefully sporadic buildbot failures running the Interpreter/repl test.

Swift SVN r5470
2013-06-04 18:02:44 +00:00
Doug Gregor
17e788e04f Open literal types as binding types, to provide [] sugar for arrays.
Swift SVN r5436
2013-06-03 19:43:02 +00:00
Joe Groff
ccc28d3253 Add some more DEBUG() noise to -i mode.
Dump the module IR just prior to instantiating the execution engine, and log the start of module initializers, static constructors, and main().

Swift SVN r5430
2013-06-01 00:40:38 +00:00
Doug Gregor
c038ab92e6 Remove -no-constraint-checker/-constraint-checker and the corresponding language option.
Swift SVN r5387
2013-05-29 22:16:34 +00:00
Jordan Rose
878cc5f0e1 Hack: ignore loaded modules in immediate mode SILGen/IRGen.
This matches the behavior for compilation, and lets us test modules that
don't need any extra codegen.

With this, typealiases of builtins can be used end-to-end in modules!

Swift SVN r5326
2013-05-25 01:34:59 +00:00
Chris Lattner
f2e3af3cf6 Eliminate the "global" list of unresolved identifier types maintained
by TranslationUnit.  This list existed solely to allow name lookup of
an unbound IdentifierType to know its DeclContext.  Instead of indirecting
through this list, just store the DeclContext in the IdentifierType in its
uninitialized state.

This eliminates a really terrible performance fixme about scanning the list,
eliminates the management fiddling around with this list in the parser, and
is generally much cleaner.


Swift SVN r5246
2013-05-21 05:27:37 +00:00
Doug Gregor
dbdc9db90a Keep track of the extensions associated with a nominal type declaration.
Switch the REPL's printing of extensions to use this mechanism, mostly
as a sanity check.



Swift SVN r5221
2013-05-20 15:23:16 +00:00
Jordan Rose
77ce3f31cb Add a DeclContextKind for Swift modules.
Swift SVN r5095
2013-05-08 18:33:34 +00:00
Joe Groff
a2341a4cde Add Unicode symbol characters to operator charset.
Remove '@' from the operator character set, but add the math, symbol, punctuation, arrow, and line- and box-drawing characters. Also allow operators to contain (but not start with) combining characters--this should be safe, because identifiers can't start with combining characters either, and we don't allow them anywhere else.

Swift SVN r5019
2013-05-01 23:13:48 +00:00
Chris Lattner
5b4c31dc94 reland r4968, with a bugfix to avoid breaking the lexer measuring token lengths.
Original message:
SIL Parsing: add plumbing to know when we're parsing a .sil file
Enhance the lexer to lex "sil" as a keyword in sil mode.


Swift SVN r4988
2013-04-30 00:28:37 +00:00
Chris Lattner
aafe3bdbdc revert r4968, it apparently breaks the world. I'll recommit it when I have time to investigate.
Swift SVN r4971
2013-04-29 16:58:43 +00:00