Commit Graph

179 Commits

Author SHA1 Message Date
David Ungar
c396a3a972 Don’t free the ASTContext if > 1 primary input. 2018-02-02 13:49:08 -08:00
David Ungar
354a76ac4e Merge pull request #14198 from davidungar/PR-18-3c-exp2
[Batch mode] Move frontend main output files to FrontendInputsAndOutputs. (1)
2018-02-01 16:42:10 -08:00
David Ungar
614006bc4f Move main outputs to FrontendInputsAndOutputs and InputFile 2018-02-01 11:55:08 -08:00
Rintaro Ishizaki
fced748790 [Syntax] Represent missing optioanl nodes as nullptr (#14300)
Allocating RawSyntax/SyntaxData for missing optional node is a waste of
resource.
2018-01-31 19:24:00 +09:00
David Ungar
e006825d88 Move convertBufferNameFromLLVM_getFileOrSTDIN_toSwiftConventions deeper in the call stack. 2018-01-30 18:55:02 -08:00
David Ungar
a9819b6e60 Renaming FrontendInputs -> FrontendInputsAndOutputs
Fix comment in ArtsToFrontendOptionsConverter re getOutputFilenamesFromCommandLineOrFilelist
2018-01-30 18:54:38 -08:00
Graydon Hoare
ff104e4f11 Merge pull request #14059 from graydon/count-stats-stacks
[Stats] Expand FrontendStatsTracer to trace multiple entity-types.
2018-01-24 17:30:26 -08:00
David Ungar
ec2a9573cc Rename FrontendInputs::AllFiles to AllInputs, getAllFiles to getAllInputs, etc. 2018-01-23 14:01:15 -08:00
Graydon Hoare
5f130a8d35 [Stats] Expand FrontendStatsTracer to trace multiple entity-types. 2018-01-21 23:37:54 -08:00
David Ungar
82d438663e Merge pull request #13982 from davidungar/PR-18-3
Preparing CompilerInstance for batch mode.
2018-01-17 17:34:38 -08:00
David Ungar
2d7607f3b8 Remove redundant test: PSGIs.empty() 2018-01-17 13:45:27 -08:00
David Ungar
b55ec29c7a Replaced !fileIsSIB test with true where it is applied to source files. 2018-01-17 12:33:07 -08:00
David Ungar
3c882f2841 Added else to: if (PSGIs.empty()) 2018-01-17 12:27:12 -08:00
David Ungar
6196ad7460 Capitalized astGuaranteedToCorrespondToSIL. 2018-01-17 12:21:00 -08:00
David Ungar
4a0a7f2e82 Fix for emit_reference_dependencies_without_primary_file warning required after changes to introduce multiple primary files to CompilerInstance.
Revealed by test Frontend/dependencies.swift.
2018-01-17 11:58:11 -08:00
Graydon Hoare
42c4a4d452 [BatchMode] Thread the ModuleOrSourceFile of each Post-SILGen run through. 2018-01-17 11:58:05 -08:00
Graydon Hoare
03c079121f [BatchMode] Split performCompile at SILGen, repeat remainder per-primary-input. 2018-01-17 11:57:25 -08:00
Graydon Hoare
2494b148f1 [BatchMode] Sink a bunch of FrontendTool uses of getPrimarySourceFile() 2018-01-17 11:57:13 -08:00
Xi Ge
71af76a87e libSyntax: optionally emit diagnostics for unknown expressions and declarations. (#13973)
With more syntax nodes being specialized, we'd like this
straight-forward way to pinpoint unknown entities. This diagnostics
is only issued in -emit-syntax frontend action and swift-syntax-test
invocation.
2018-01-16 16:14:57 -08:00
David Ungar
51d3165874 NFC: Clarifying uses of NumThreads.
Add hasMultipleGMs predicate to SILOptions.
Rename parameters to TBD file handling to better reflect abstraction boundary.

fix
2017-12-16 13:58:01 -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
Mark Lacey
d8f492e5d7 Squelch some warnings.
Fix up some dead code warnings as well as a warning for testing
whether an unsigned number is non-negative (which it always is).
2017-12-10 15:21:19 -08:00
David Ungar
068f5019b8 Relocate <stdin> correction to clarify why needed. 2017-12-08 13:16:49 -08:00
David Ungar
704d7258d1 Rename hasUniqueInput to hasSingleInput. 2017-12-06 15:25:16 -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
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
Harlan Haskins
9732442628 [Syntax] Remove LegacyASTTransformer
As it is no longer ever instantiated, and since Syntax nodes are being
plumbed through the parser, the LegacyASTTransformer no longer needs to
exist.
2017-11-29 17:51:57 -05: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
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
26537ea26c Address Jordan’s comments:
- Also be consistent about has vs have for Input predicates

Fix bug.
2017-11-18 14:00:32 -08: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
David Ungar
45bf920654 Formatted. 2017-11-13 15:03:52 -08:00
David Ungar
495aeeca3f Change enum ActionType to enum class ActionType. 2017-11-13 14:53:18 -08:00
Xi Ge
311a59db1c Front-end: EmitSyntax action should use the syntax tree generated from parser. (#12850) 2017-11-10 00:29:28 -08:00
Graydon Hoare
4c0856f629 Merge pull request #12836 from graydon/failure-counter
[Stats] Add a pair of counters to track failed processes.
2017-11-08 21:57:05 -08:00
Graydon Hoare
173e702da2 [Stats] Add a pair of counters to track failed processes. 2017-11-08 19:53:36 -08:00
Doug Gregor
5d5e6122f3 [GSB] Add verification of all generic signatures within a module.
Add a verification pass to ensure that all of the generic signatures in
a module are both minimal and canonical. The approach taken is quite
direct: for every (canonical) generic signature in the module, try
removing a single requirement and forming a new generic signature from
the result. If that new generic signature that provide the removed
requirement, then the original signature was not minimal.

Also canonicalize each resulting signature, to ensure that it meets the
requirements for a canonical signature.

Add a test to ensure that all of the generic signatures in the Swift
module are minimal and canonical, since they are ABI.
2017-11-07 15:20:38 -08:00
Graydon Hoare
a8f1b424a7 [NamedLazyMemberLoading] Unconditionally serialize declMemberNameTables. 2017-11-02 22:37:13 -07:00
Graydon Hoare
5eca5f5161 [NamedLazyMemberLoading] Write serialized decl member tables. 2017-11-01 17:35:46 -07:00
Adam Nemet
66085a8aef Save optimization remarks in an external YAML file
This brings the capability from clang to save remarks in an external YAML files.
YAML files can be viewed with tools like the opt-viewer.

Saving the remarks is activated with the new option -save-optimization-record.

Similarly to -emit-tbd, I've only added support for single-compile mode for now.
In this case the default filename is determined by
getOutputFilenameFromPathArgOrAsTopLevel, i.e. unless explicitly specified
with -save-optimization-record-path, the file is placed in the directory of the
main output file as <modulename>.opt.yaml.
2017-10-27 10:14:27 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
Roman Levenstein
882d72b0df Extend SILModule with an API to serialize its content
The `serialize` method can be called multiple times, but it will perform the actual serialization only the first time.
By means of this API we get the flexibility to serialize the SILModule not only after all the optimizations, but  e.g. at any time during optimizations.
2017-10-13 23:19:07 -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
Graydon Hoare
994ad7ad92 [stats] Add -trace-stats-events 2017-09-22 19:16:50 -04:00
Jordan Rose
1c651973c3 Excise "Accessibility" from the compiler (2/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the 'Accessibility' enum to be named 'AccessLevel'.
2017-08-28 11:34:44 -07:00
Jordan Rose
5f30eac288 Excise "Accessibility" from the compiler (1/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the names of methods, fields, a few local
variables, and even a swift-ide-test flag. The full list is below.

accessibilityForDiagnostics -> accessLevelForDiagnostics
checkAccessibility -> checkAccess
checkGenericParamAccessibility -> checkGenericParamAccess
checkTypeAccessibility -> checkTypeAccess
checkWitnessAccessibility -> checkWitnessAccessibility
computeAccessibility -> computeAccessLevel
computeDefaultAccessibility -> computeDefaultAccessLevel
fixItAccessibility -> fixItAccess
getAccessibilityString -> getAccessLevelString
getAccessibilityStrictly -> getAccessLevelStrictly
getAccessibilityUID -> getAccessLevelUID
getActualAccessibility -> getActualAccessLevel
getDefaultAccessibility -> getDefaultAccessLevel
getMaxAccessibility -> getMaxAccessLevel
getOverridableAccessibility -> getOverridableAccessLevel
getRawStableAccessibility -> getRawStableAccessLevel
getSetterAccessibility -> getSetterFormalAccess
hasAccessibility -> hasAccess
hasDefaultAccessibility -> hasDefaultAccessLevel
inferAccessibility -> inferAccessLevel
inferDefaultAccessibility -> inferDefaultAccessLevel
inferSetterAccessibility -> inferSetterAccessLevel
overwriteAccessibility -> overwriteAccess
overwriteSetterAccessibility -> overwriteSetterAccess
printAccessibility -> printAccess
requiredAccessibilityForDiagnostics -> requiredAccessForDiagnostics
resolveAccessibility -> resolveAccessControl
setAccessibility -> setAccess
setSetterAccessibility -> setSetterAccess
setDefaultAndMaxAccessibility -> setDefaultAndMaxAccess
validateAccessibility -> validateAccessControl

Accessibility -> AccessLevel
AccessibilityFilter -> AccessFilter
IgnoreAccessibility -> IgnoreAccessControl
NL_IgnoreAccessibility -> NL_IgnoreAccessControl
PrintAccessibility -> PrintAccess
PrintInternalAccessibilityKeyword -> PrintInternalAccessKeyword
SetterAccessibility -> SetterAccessLevel

setterAccessibility -> setterAccess
storedPropertyAccessibility -> storedPropertyAccess

-print-accessibility -> -print-access
2017-08-28 11:11:57 -07:00