Commit Graph

6605 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
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
Chris Lattner
1d05280a2a Fix -verify mode in sil-opt to not capture diagnostics produced while
*parsing* the .sil file.  If any errors happen while parsing the sil
file, report them immediately and return with an error.



Swift SVN r7005
2013-08-07 21:51:14 +00:00
Doug Gregor
3de1f5a9b5 More attempts at fixing the CMake build
Swift SVN r6988
2013-08-07 18:22:47 +00:00
Chris Lattner
8b56b861b5 give sil-opt a -verify mode. Not particularly useful yet, since all source
locations for sil instructions have no location.


Swift SVN r6987
2013-08-07 18:20:31 +00:00
Doug Gregor
7148cf6d8f Try to link swift-demangle against curses. Strange that we have a difference between the Xcode project and the makefile project
Swift SVN r6982
2013-08-07 17:10:30 +00:00
Doug Gregor
b6000d9a76 We don't need to explicitly link against curses.
Swift SVN r6979
2013-08-07 16:49:40 +00:00
Chris Lattner
1e00af609c attempt to unbreak jenkins
Swift SVN r6976
2013-08-07 15:17:51 +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
b3fadfc31b Add the outline of a new SIL memory promotion pass. This is what will handle
definite initialization, promoting boxes to stack, building ssa, and doing definite
initialization.

I'll build this in place, then kill off the other two passes when this subsumes them.


Swift SVN r6903
2013-08-05 16:39:26 +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
Chris Lattner
ad2d69b8dc fix sil-opt to stop running if it sees a parse error.
Swift SVN r6876
2013-08-03 04:26:15 +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
Chris Lattner
85bcc23504 trim sil-opt linkage dependencies. It doesn't use the repl, so it
doesn't need libedit or CF.


Swift SVN r6737
2013-07-30 04:43:59 +00:00
Dmitri Hrybenko
5aef7a6c60 Fix REPL code completion after r6714
Swift SVN r6722
2013-07-29 22:57:03 +00:00
Chris Lattner
b7a6cbc638 fix the makefiles to only include swiftBasic in this.
Swift SVN r6719
2013-07-29 22:49:29 +00:00
Anna Zaks
64693183da [DCE] Add a very primitive dead code elimination pass
DCE is added as a separate SIL pass with it's own entry point.

For now, detect and simplify the branch instructions with constant
conditions and delete unreachable basic blocks (for now, we do not even
pay any regards to the basic block arguments).

Swift SVN r6713
2013-07-29 21:55:05 +00:00
Jordan Rose
50ac51b36e Autoconf: Fix dependencies for sil-opt and swift-demangle.
Swift SVN r6703
2013-07-29 20:21:35 +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
Enrico Granata
c75fe924a1 Moving the Swift demangler from libSIL to libBasic
Plus, a couple of minor cosmetic changes that I had held off for a couple days now



Swift SVN r6691
2013-07-29 17:42:57 +00:00
John McCall
5d1920e3eb The demangler doesn't actually require the serialization library.
Swift SVN r6689
2013-07-29 17:18:38 +00:00
John McCall
a7b8254210 More Makefile support for swift-demangle.
Swift SVN r6669
2013-07-27 00:42:26 +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
Enrico Granata
efcd17f604 This commit implements the Demangler API in C++ and de facto deprecates the existing Demangle.swift
The new demangler is in the "swift/SIL/Demangle.{h|cpp}" files, and in the swift::Demangle namespace, which has two public entry points:

std::string demangleSymbol(llvm::StringRef mangled);
std::string demangleType(llvm::StringRef mangled);

This was necessary to support the need for LLDB to demangle Swift symbol (and type) names

Test case is included



Swift SVN r6547
2013-07-24 17:52:27 +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
5536e61e59 [Frontend] Keep a list of input files in CompilerInvocation and create input buffer IDs as part of CompilerInstance::setup().
Swift SVN r6497
2013-07-23 14:49:31 +00:00
Argyrios Kyrtzidis
200e64d8c2 [Frontend] Refactor CompilerInvocation to be a pure settings object.
This mainly removes the extraneous DiagnosticEngine and SourceMgr from CompilerInvocation.
Instances of these can be found via the CompilerInstance object.

Swift SVN r6496
2013-07-23 14:49:29 +00:00
Chris Lattner
1a75f7c5a3 more renaming to make things consistent-er
Swift SVN r6481
2013-07-22 21:42:25 +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
Chris Lattner
ef75f4f4e1 tidy this up.
Swift SVN r6471
2013-07-22 21:19:08 +00:00
Chris Lattner
e0dbcc40de split memorypromotion into two different passes, split its testcases
in half, and switch them to use sil-opt to test with.


Swift SVN r6469
2013-07-22 20:59:28 +00:00
Chris Lattner
e0f19cfb4e Feedback from Dmitri
Swift SVN r6466
2013-07-22 20:42:11 +00:00
Dmitri Hrybenko
29496e3d9a Fix CMake build
Swift SVN r6465
2013-07-22 20:34:26 +00:00
Chris Lattner
988e3b1842 Add a new sil-opt tool, which will be the SIL analog to the LLVM 'opt' tool.
Swift SVN r6463
2013-07-22 19:56:03 +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