Commit Graph

178 Commits

Author SHA1 Message Date
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
Chris Lattner
b503206bec 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 r4970
2013-04-29 05:42:59 +00:00
Doug Gregor
6ad8dfd230 <rdar://problem/13698402> Use raw_ostream::has_colors rather than is_displayed
to determine whether we should display colors.


Swift SVN r4832
2013-04-20 06:55:12 +00:00
Joe Groff
dc1fe2f8e2 Recursively SILGen modules before irgenning them.
Fixes <rdar://problem/13670581>.

Swift SVN r4777
2013-04-17 15:48:30 +00:00
Chris Lattner
2144140168 really use SIL IRGen for all recursive compilations as well, this exposes a symbol
redefinition (or linkage type) bug that causes two tests to fail.  I filed 
rdar://13670581 to track this and am plowing forward, since they seem minor.


Swift SVN r4761
2013-04-17 03:46:40 +00:00
Joe Groff
ad1c30539b Remove -no-sil-irgen option.
Swift SVN r4760
2013-04-17 00:48:36 +00:00
Chris Lattner
aa5a195477 Fix the repl when stdout is redirected.
The repl is sometimes failing to write anything to stdout when it is
being redirected to a file (as in test/Interpreter/repl.swift).  it
looks like an editline bug on 10.8.  explicitly fflushing stdout
seems to help.


Swift SVN r4669
2013-04-10 23:32:27 +00:00
Dave Abrahams
ad12dd6f9e Style fix: Use prevailing const& placement
Swift SVN r4627
2013-04-07 01:35:24 +00:00
Chris Lattner
db522fe7db thoroughly rework how the REPL synthesizes code to print values. This centralizes the
logic in Sema (previously, some of it was in tools/Swift/Frontend.cpp) and eliminates
redundancy between expr and pattern printing.  This also eliminates most of the invalid
ASTs that the repl was producing (there is still one left).

This commit reenables the disabled REPL testcase from my last big change.



Swift SVN r4622
2013-04-06 20:05:46 +00:00
Dave Abrahams
3ec813c71b Explicitly pass an argv to LLVM's execution engine
This commit touches many more interfaces than you might expect.  Tant pis.

Swift SVN r4618
2013-04-06 03:40:32 +00:00
Dave Abrahams
19a590617a Add a "--" option that allows arguments to be passed to scripts
Swift SVN r4565
2013-04-01 22:47:24 +00:00
Joe Groff
1a8b35d383 REPL: Support -sil-irgen.
Add a 'startElem' option to SILModule::constructSIL so that it can be used with REPL input.

Swift SVN r4519
2013-03-28 18:38:29 +00:00