Commit Graph

292 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
Greg Parker
485ed71b86 Rename SWIFT_SDK to MODULES_SDK in make to match cmake.
Swift SVN r8386
2013-09-18 02:26:18 +00:00
Greg Parker
8e13188209 Consolidate some build flags for .swift files. Add cross-compilation support.
Swift SVN r8181
2013-09-13 01:51:48 +00:00
Mark Lacey
a558acc86a Update the SIL stage at the end of the canonicalization phase.
Swift SVN r8067
2013-09-10 00:29:00 +00:00
Chris Lattner
dea8213ef9 remove the -enable-definite-init command line option. Definite init
seems to have stuck.


Swift SVN r7956
2013-09-05 20:37:41 +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
Michael Gottesman
b75d5003fa Fixed 2x instances where we were missing C++ editor identifiers on .h files and a mislabeled header file.
Swift SVN r7418
2013-08-21 19:28:45 +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
Stephen Lin
8d90466523 Reorganize SIL source tree: move lib/SIL/SILGen -> lib/SILGen, move lib/SIL/Passes -> lib/SILPasses, add lib/SILPasses/Utils
Swift SVN r7246
2013-08-14 23:47:29 +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
70f2b64ad9 Add CharSourceRange -- a half-open character range, which will be used in IDE
integration

Motivation: libIDE clients should be simple, and they should not have to
translate token-based SourceRanges to character locations.

This also allows us to remove the dependency of DiagnosticConsumer on the
Lexer.  Now the DiagnosticEngine translates the diagnostics to CharSourceRanges
and passes character-based ranges to the DiagnosticConsumer.


Swift SVN r7173
2013-08-12 20:15:51 +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
Dmitri Hrybenko
79d935f1ec Keep PersistentParserState while parsing a REPL line
Fixes 


Swift SVN r7116
2013-08-10 00:20:03 +00:00
Dmitri Hrybenko
9c57f8454c Do the final cleanups and make SourceLoc::Value private
Swift SVN r7115
2013-08-09 23:52:01 +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
Dmitri Hrybenko
5a88513e71 Don't link to curses library explicitly
LLVM build system has been fixed to pass down this linker flag automatically.


Swift SVN r7048
2013-08-08 17:46:52 +00:00
Doug Gregor
3de1f5a9b5 More attempts at fixing the CMake build
Swift SVN r6988
2013-08-07 18:22:47 +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
Dmitri Hrybenko
38652f514c Simplify code with the new Token::isKeyword() function
Swift SVN r6757
2013-07-30 22:41:51 +00:00
Dmitri Hrybenko
e8a894ba16 Simplify code per review comment
Swift SVN r6754
2013-07-30 22:20:12 +00:00
Dmitri Hrybenko
9f6d987624 Code completion: add a workaround for rdar://14592634
This allows us to do code completion inside incomplete function bodies in REPL.
This workaround was added because the bug it fixes is a regression from the
previous code completion engine.


Swift SVN r6746
2013-07-30 18:22:00 +00:00
Dmitri Hrybenko
5aef7a6c60 Fix REPL code completion after r6714
Swift SVN r6722
2013-07-29 22:57:03 +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
John McCall
51063b9a03 Fix Makefile build: swift now depends on libswiftIDE.
Swift SVN r6652
2013-07-26 21:09:06 +00:00
Dmitri Hrybenko
c2e05bfcb9 REPL: use new code completion engine from libIDE
Swift SVN r6641
2013-07-26 04:05:28 +00:00
Dmitri Hrybenko
535f97f96d tools/swift/Completion.h: include Basic/LLVM.h and cleanup unneeded llvm::
qualifications


Swift SVN r6627
2013-07-26 00:16:58 +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
Dmitri Hrybenko
dcd26e8a1f Code completion: implement completion of imported Clang declarations by first
importing them

Because going through the import for every code completion request is slow,
Clang code completion results are cached in the CodeCompletionContext.  The
cache needs to be invalidated whenever a new Clang module is loaded.  In order
to implement this, ModuleLoadListener class was added.


Swift SVN r6505
2013-07-23 18:12:58 +00:00
Argyrios Kyrtzidis
778e6fae6e [CMake] Utilize the SWIFT_MODULE_CACHE_PATH variable as the default value for a clang::CompilerInvocation.
Swift SVN r6475
2013-07-22 21:39:07 +00:00
Dmitri Hrybenko
0fc469e80a lookupVisibleDecls(): now we don't find references to generic types outside of
the containing DeclContext

Fixes a few FIXMEs in code completion where we were providing results that
refer to generic arguments outside of their scope.


Swift SVN r6370
2013-07-19 01:46:30 +00:00
Dmitri Hrybenko
e4b44a6bbb Add a 'current module' parameter to lookupVisibleDecls() so that it can do what
is documented: look up members of a type that are visible from a specific
module.  It does not matter much now, but when we have access control, it will.

Before this change, lookupVisibleDecls() tried to guess the *defining* module
of the type, and gave up if it could not.  It forced us to duplicate some
lookup logic for some types (archetypes and protocol compositions).  Also add a
test that lookup finds members of archetype's superclass, which the original
(duplicated) code did not handle.


Swift SVN r6363
2013-07-18 23:32:16 +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
Chris Lattner
1277ac7e04 Carve out a new lib/SIL/Passes directory to hold future SIL optimizations
and dataflow warnings.  Add a skeletal MemoryPromotion entrypoint as the first
exemplar.


Swift SVN r6247
2013-07-15 14:51:37 +00:00
Joe Groff
b9aca28a27 REPL: Outdent 'case' labels on entry.
Swift SVN r6165
2013-07-11 18:32:28 +00:00
Dmitri Hrybenko
e62a251701 Move PrintingDiagnosticConsumer to libFrontend so that it can be resued in
swift-ide-test.


Swift SVN r6120
2013-07-10 18:20:41 +00:00