Commit Graph

410 Commits

Author SHA1 Message Date
Jordan Rose
098a1c98f8 Stop importing SILModule.h in Frontend.h
...for no other reason than to slightly improve compile times
when something changes in SILModule.h or SILFunction.h.
2018-02-20 17:50:50 -08:00
David Ungar
488db9fb9b Fix ReferencedNameTracker in preparation for batch mode. 2018-02-16 22:28:10 -07:00
David Ungar
1f9a4f3591 Pass around arguments for primary-specific filenames.
Get rid of IRGenOpts attributes that won’t work for batch mode and also remove fakeNamesStub.
2018-02-15 15:34:55 -07:00
Xi Ge
37f352fe41 sourcekitd: build Swift syntax tree more lazily than collecting parsed tokens. (#14578)
Before this patch, we have one flag (KeepSyntaxInfo) to turn on two syntax
functionalities of parser: (1) collecting parsed tokens for coloring and
(2) building syntax trees. Since sourcekitd is the only consumer of either of these
functionalities, sourcekitd by default always enables such flag.
However, empirical results show (2) is both heavier and less-frequently
needed than (1). Therefore, separating the flag to two flags makes more
sense, where CollectParsedToken controls (1) and BuildSyntaxTree
controls (2).

CollectingParsedToken is always enabled by sourcekitd because
formatting and syntax-coloring need it; however BuildSyntaxTree should
be explicitly switched on by sourcekitd clients.

resolves: rdar://problem/37483076
2018-02-13 16:27:12 -08:00
David Ungar
ba4f2a84b4 Move supplementary outputs to SupplementaryOutputs in FrontendInputsAndOutputs. 2018-02-07 13:55:32 -08:00
David Ungar
c396a3a972 Don’t free the ASTContext if > 1 primary input. 2018-02-02 13:49:08 -08:00
David Ungar
a9819b6e60 Renaming FrontendInputs -> FrontendInputsAndOutputs
Fix comment in ArtsToFrontendOptionsConverter re getOutputFilenamesFromCommandLineOrFilelist
2018-01-30 18:54:38 -08:00
David Ungar
ec2a9573cc Rename FrontendInputs::AllFiles to AllInputs, getAllFiles to getAllInputs, etc. 2018-01-23 14:01:15 -08:00
David Ungar
1f8f9947fd Changed PrimarySourceFiles from a SetVector to an ArrayRef. 2018-01-17 12:20:52 -08:00
Graydon Hoare
b0e5726af9 [BatchMode] Change CompilerInstance::Primary{BufferID,SourceFile} to SetVectors. 2018-01-16 16:17:25 -08:00
David Ungar
00872b5d50 Removed another get(). 2017-12-12 13:07:09 -08:00
David Ungar
38ce2a14d1 Added a FIXME and removed a get per review suggestions. 2017-12-12 13:04:25 -08:00
David Ungar
9105284a06 Refactor setUpInputs in CompilerInstance. 2017-12-12 10:14:33 -08:00
David Ungar
c1f81867d7 Merge pull request #13268 from davidungar/PR3A-rb
FrontendInputs data structure redo, rebased.
2017-12-11 20:44:10 -08:00
David Ungar
724d1c36cd Last round of small changes 2017-12-11 17:19:06 -08:00
Slava Pestov
fc3cf2863a Sema: Infer default witnesses before finishing conformance checking
Otherwise, we'll never get a chance to drain the TypeChecker's
UsedConformances list.

Fixes <https://bugs.swift.org/browse/SR-6565>, <rdar://problem/35949729>.
2017-12-10 20:30:48 -08:00
David Ungar
60827b4be3 Rename accessors to InputFile data. 2017-12-08 12:57:32 -08:00
David Ungar
6e3829ec96 Rename isInMainMode to isInputSwift 2017-12-08 11:47:33 -08:00
David Ungar
ce56435a1a Remove needless conversion to unique pointer. 2017-12-08 11:45:33 -08:00
David Ungar
536300f018 Add assertions about re-setting Main and PrimaryBufferIDs 2017-12-08 11:43:38 -08:00
David Ungar
70e5981407 Remove spurious comment. 2017-12-06 15:29:32 -08:00
David Ungar
4c5d5faa63 Fix setup's. 2017-12-06 15:23:39 -08:00
David Ungar
28b206008f FrontendInputs data structure redo.
- Outlaw duplicate input files, fix driver, fix tests, and add test.
- Reflect that no buffer is present without a (possibly pseudo) named file.
- Reflect fact that every input has a (possible pseudo) name.
- Break up CompilerInstance::setup.

Don't bail on dups.
2017-12-05 17:28:03 -08:00
David Ungar
67fc5e32ce Simple changes to pave the way for the next PR.
- Moved getOutputFilenamesFromCommandLineOrFilelist & readOutputFileLIst to better places in the file.
- Capitalization changes.
- Make actionIsImmediate static.
- Add braces around sections of CompilerInstance::setup to clarify scopes of local variables.
2017-12-03 13:56:06 -08:00
David Ungar
6de07d050c Review fixes:
Rename isThereAPrimaryInputWithAFilenameAt to isInputPrimary.
Remove spurious delayed_function_body_parsing.
Simply return type of getOutputFilenamesFromCommandLineOrFilelist.
2017-11-30 17:28:15 -08:00
David Ungar
04c16cdebd Incorperate advice from review.
Change “have” routines to “has”.
Use more consistent casing.
Remove spurious “DelayedFunctionParsing” option.
Move debugFail routines to top lexical level.
Rename and reorder declaration of functions in FrontendArgsToOptionsConverter.
Move, reword, and doxygenate comments for some of those functions.
Fix casing on some more setUp* functions.
Return NoneAction instead of existing RequestedAction in FrontendArgsToOptionsConverter::determineRequestedAction.
Remove test names and put in FIXME’s.
Remove “Jordan” from comments & reword.
Reorder if-then arms of FrontendArgsToOptionsConverter::computeOutputFilenames for readability.
Test for empty string instead of equality with “”.
Use hasUnusedModuleDocOutputPath.
Remove optionality from return type of getOutputFilenamesFromCommandLineOrFilelist.
Rename isPrimaryInputAFileAt to isThereAPrimaryInputWithAFilenameAt.
Added a FIXME in doesActionProduceOutput to reflect that some actions actually do not produce output.
2017-11-30 17:28:15 -08:00
David Ungar
6d2e3f51e7 Break up ParseFrontendOptions and reorganize module and output files computations. 2017-11-30 17:28:14 -08:00
Arnold Schwaighofer
1a0443040e Revert "Merge pull request #12952 from davidungar/move-in-to-next"
This reverts commit 911140c7e1, reversing
changes made to 5590a2ff91.

This broke the incremental bot.

rdar://35746584
2017-11-29 08:09:42 -08:00
David Ungar
d16ae98e2a Review fixes:
Rename isThereAPrimaryInputWithAFilenameAt to isInputPrimary.
Remove spurious delayed_function_body_parsing.
Simply return type of getOutputFilenamesFromCommandLineOrFilelist.
2017-11-28 13:28:10 -08:00
David Ungar
b4681b154d Incorperate advice from review.
Change “have” routines to “has”.
Use more consistent casing.
Remove spurious “DelayedFunctionParsing” option.
Move debugFail routines to top lexical level.
Rename and reorder declaration of functions in FrontendArgsToOptionsConverter.
Move, reword, and doxygenate comments for some of those functions.
Fix casing on some more setUp* functions.
Return NoneAction instead of existing RequestedAction in FrontendArgsToOptionsConverter::determineRequestedAction.
Remove test names and put in FIXME’s.
Remove “Jordan” from comments & reword.
Reorder if-then arms of FrontendArgsToOptionsConverter::computeOutputFilenames for readability.
Test for empty string instead of equality with “”.
Use hasUnusedModuleDocOutputPath.
Remove optionality from return type of getOutputFilenamesFromCommandLineOrFilelist.
Rename isPrimaryInputAFileAt to isThereAPrimaryInputWithAFilenameAt.
Added a FIXME in doesActionProduceOutput to reflect that some actions actually do not produce output.
2017-11-28 09:21:35 -08:00
David Ungar
b37219f791 Break up ParseFrontendOptions and reorganize module and output files computations. 2017-11-27 20:52:25 -08:00
David Ungar
83ee8cb7f0 Merge pull request #12920 from davidungar/Move-input-conversion
Move input conversion
2017-11-27 17:13:48 -08:00
David Ungar
0b39a883c2 Fix capitalization of setUpForFileAt 2017-11-21 09:48:55 -08:00
Slava Pestov
076d5ee242 Frontend: Remove -delayed-function-body-parsing flag 2017-11-18 11:31:19 -05:00
Slava Pestov
957427fbfc Frontend: Rework delayed parsing mode a bit 2017-11-18 11:08:18 -05:00
David Ungar
3f3d784144 Factor code from tools & move input conversion. 2017-11-14 20:48:59 -08:00
Erik Eckstein
90c21be191 Unify the implementation of optimization mode in various option classes.
This commit is mostly refactoring.

*) Introduce a new OptimizationMode enum and use that in SILOptions and IRGenOptions
*) Allow the optimization mode also be specified for specific SILFunctions. This is not used in this commit yet and thus still a NFC.

Also, fixes a minor bug: we didn’t run mandatory IRGen passes for functions with @_semantics("optimize.sil.never")
2017-11-14 11:25:02 -08:00
Xi Ge
6af5d3c0bf libSyntax: rename KeepTokensInSourceFile to KeepSyntaxInfoInSourceFile. 2017-11-03 18:39:01 -07:00
David Ungar
7d637c856c Merge pull request #12335 from davidungar/primaryFilesMode-Inputs-rebased
NFC: First step (refactoring) towards speeding up compilation w/ >1 primary file
2017-10-10 12:55:55 -07:00
David Ungar
47ee930a50 git-clang-format'ed 2017-10-08 23:56:03 -07:00
David Ungar
c1821755de NFC: First step (refactoring) towards speeding up compilation by having multiple primary files: Creates new class, FrontendInputs, to encapsulate InputFilenames, InputBuffers, and PrimaryInput, which were formerly in FrontendOptions. Add new instance variable, Inputs, to FrontendOptions in order to hold FrontendInputs.
Encapsulate uses of the variables in FrontendInputs with intention-describing functions. Move some code that sets these variables into FrontendInputs and FrontendOptions classes.

Create new FrontendInputs class to encapsulate InputFilenames, InputBuffers and PrimaryInput, which were formerly in Frontend.

Includes one change in SwiftEditor.cpp to resolve a merge conflict.
2017-10-08 10:20:37 -07:00
Roman Levenstein
5e67f755e0 Remove the -sil-serialize-all option 2017-10-04 14:20:53 -07:00
David Ungar
4ca60fe6d5 Back off the WholeModule change to CompilerInstance::createSILModule()
(May be needed in this form for sil-opt.)
2017-09-22 16:51:49 -07:00
David Ungar
097dd71ffe Simple fixes per Jordan's comments:
- Use isWholeModuleCompilation in CompilerInstance::createSILModule
- Remove some unneeded timers
- Improve the comment in CompilerInstance::parseAndCheckTypes
- Remove needless const ref to an llvm::function_ref parameter in forEachSourceFileIn
- Remove "OfFile" from "finishTypeCheckingOfFile"
2017-09-21 20:18:34 -07:00
David Ungar
edac126f93 git-clang-format 2017-09-19 17:00:04 -07:00
David Ungar
42b04a8a9b Merged checkTypesWhileParsingMain into its caller. 2017-09-19 16:57:45 -07:00
David Ungar
fef5551fdb Added consts to implicitImports refs & fixed dangling new in computeDelayedParsingCallback.
# Conflicts:
#	lib/Frontend/Frontend.cpp
2017-09-19 16:57:45 -07:00
David Ungar
3d2484af28 git-clang-format
# Conflicts:
#	lib/Frontend/Frontend.cpp
2017-09-18 14:02:50 -07:00
David Ungar
0df6ade475 Emission of error_doing_code_completion up to caller 2017-09-18 14:01:58 -07:00
David Ungar
673af9be21 Moved forEachSourceFile out of module to Frontend.cpp 2017-09-18 14:01:57 -07:00