Commit Graph

87 Commits

Author SHA1 Message Date
David Ungar
df21c6c266 Taking Jordan's suggestions. 2017-12-01 17:39:08 -08:00
David Ungar
ccb73783dc Bug fixes & module name cleanup.
Unify actionHasOutput w/ doesActionProduceOutput & correct both.
Do not set an output filename if there is no output.
Add test to ensure no output is created in immediate mode.

Restore NFC module name computation.
2017-12-01 12:44:32 -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
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
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
David Ungar
495aeeca3f Change enum ActionType to enum class ActionType. 2017-11-13 14:53:18 -08: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
Huon Wilson
374826c960 Merge pull request #11219 from huonw/tbd-is-not-a-main-product
[Frontend] Emit tbd as an extra output, not a frontend action.
2017-07-31 18:46:02 -07:00
Huon Wilson
dfa8501e59 [Frontend] Emit tbd as an extra output, not a frontend action.
This means it can be emitted during an -emit-module frontend job, which is the
most common place it will be used, so reusing work like this is important for
performance.

For now, this has to happen as part of a single frontend invocation, i.e. -wmo
or -force-single-frontend-invocation.
2017-07-31 11:05:29 -07:00
John McCall
dda3a3827c [SR-3063] Suppress SIL transforms when merging modules. 2017-07-27 10:21:02 -04:00
Harlan
37f88e7372 Add frontend flag to serialize Syntax tree (#11095)
* Add frontend flag to serialize Syntax tree

* Rename dump-serialized-syntax-tree to emit-syntax
2017-07-21 14:23:50 -07:00
David Farler
63776b507b When converting some of the old Migrator automation to the new Migrator,
I had set up the driver to invoke a separate frontend invocation with
the "update code" mode. We sort of did this last release, except we
forked to the swift-update binary instead. This is causing problems with
testing in Xcode.

Instead, let's perform a single compile and add the remap file as an
additional output during normal compiles. The driver, seeing
-update-code, will add -emit-remap-file-path $PATH to the -c frontend
invocation.

rdar://problem/31857580
2017-04-27 01:03:00 -07:00
David Farler
303a3e5824 Start the Migrator library
The Swift 4 Migrator is invoked through either the driver and frontend
with the -update-code flag.

The basic pipeline in the frontend is:

- Perform some list of syntactic fixes (there are currently none).
- Perform N rounds of sema fix-its on the primary input file, currently
  set to 7 based on prior migrator seasons.  Right now, this is just set
  to take any fix-it suggested by the compiler.
- Emit a replacement map file, a JSON file describing replacements to a
  file that Xcode knows how to understand.

Currently, the Migrator maintains a history of migration states along
the way for debugging purposes.

- Add -emit-remap frontend option
  This will indicate the EmitRemap frontend action.
- Don't fork to a separte swift-update binary.
  This is going to be a mode of the compiler, invoked by the same flags.
- Add -disable-migrator-fixits option
  Useful for debugging, this skips the phase in the Migrator that
  automatically applies fix-its suggested by the compiler.
- Add -emit-migrated-file-path option
  This is used for testing/debugging scenarios. This takes the final
  migration state's output text and writes it to the file specified
  by this option.
- Add -dump-migration-states-dir

  This dumps all of the migration states encountered during a migration
  run for a file to the given directory. For example, the compiler
  fix-it migration pass dumps the input file, the output file, and the
  remap file between the two.

  State output has the following naming convention:
  ${Index}-${MigrationPassName}-${What}.${extension}, such as:
  1-FixitMigrationState-Input.swift

rdar://problem/30926261
2017-04-17 16:25:02 -07:00
Huon Wilson
4eff6f1374 [FrontendTool] -emit-tbd and -validate-tbd-against-ir flags.
These, respectively, write a list of symbols to a file, and compare what
that list would be against the "true" list (the symbol names in the IR).
2017-03-28 16:31:09 -07:00
Huon Wilson
55b2ba2524 [Frontend] Add -emit-imported-modules: listing modules imported by the current one.
This is purely designed to cheaply compute dependency graphs between
modules, and thus only lists the top-level names (i.e. not submodules)
and doesn't do any form of semantic analysis.
2017-03-17 18:44:03 -07:00
Graydon Hoare
a95f5da86d [Bridging PCH] Add -emit-pch to Frontend; call emitBridgingPCH. 2017-01-13 15:18:39 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
David Farler
6d8514b2a3 Add back the -parse flag, which doesn't typecheck 2016-11-28 10:50:55 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Doug Gregor
4e214687ca [WIP Name binding] Introduce a basic 'scope map' to model scopes in the AST.
The scope map models all of the name lookup scopes within a source
file. It can be queried by source location to find the innermost scope
that contains that source location. Then, one can follow the parent
pointers in the scope to enumerate the enclosing scopes.

The scope map itself is lazily constructed, only creating scope map
nodes when required implicitly (e.g, when searching for a particular
innermost scope) or forced for debugging purposes.

using a lazily-constructed tree that can be searched by source
location. A search within a particular source location will
2016-09-02 17:13:05 -07:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
fbb8d3f9a8 Add "interface hash" for improved incremental builds.
Compute the hash of all interface tokens when parsing; write the
interface hash to the swiftdeps file, or if the -dump-interface-hash
option is passed to the frontend. This hash will be used in incremental
mode to determine whether a file's interface has changed, and therefore
whether dependent files need to be rebuilt in response to the change.

Committed on ChrisW's behalf while he gets his setup unborked.

rdar://problem/15352929

Swift SVN r30477
2015-07-22 00:13:54 +00:00
Devin Coughlin
ea18bc0c0b Rename -dump-trc option to -dump-type-refinement-contexts
As Jordan notes, 'TRC' is not a commonly-known acronym for most Swift compiler developers.

Swift SVN r30414
2015-07-20 21:47:49 +00:00
Devin Coughlin
b427975c39 Add a -dump-trc frontend option to print the type refinement context hierarchy
This is useful for debugging and testing.

Swift SVN r30383
2015-07-19 05:53:27 +00:00
Luqman Aden
0c6464aec7 [driver] Add -emit-sibgen option.
Swift SVN r25936
2015-03-10 18:31:08 +00:00
Erik Eckstein
460eea3b95 Let the frontend options handle multiple output files.
This will be needed for split-llvm code generation.
If multiple -o options are specified and only a single output file is needed
(currently always), the last one wins. This is NFC.



Swift SVN r25884
2015-03-09 16:24:52 +00:00
Luqman Aden
34b74cfa1c [driver] Add -emit-sib primary action.
Swift SVN r25783
2015-03-05 19:15:07 +00:00
Argyrios Kyrtzidis
0de5a66345 [Frontend] Introduce FrontendOptions::NoneAction, when the client wants custom control on how to handle an invocation.
This fixes SourceKit tests after r21537.

Swift SVN r21564
2014-08-29 04:58:37 +00:00
Jordan Rose
2877bd0854 Add support for dependency file generation with -emit-dependencies.
This performs very conservative dependency generation for each compile task
within a full compilation. Any source file, swiftmodule, or Objective-C
header file that is /touched/ gets added to the dependencies list, which
is written out on a per-input basis at the end of compilation.

This does /not/ handle dependencies for the aggregated swiftmodule, swiftdoc,
generated header, or linked binary. This is just the minimum needed to get
Xcode to recognize what needs to be rebuilt when a header or Swift source
file changes. We can revisit this later.

This finishes <rdar://problem/14899639> for now.

Swift SVN r18045
2014-05-14 00:34:11 +00:00
Jordan Rose
12fb34d60f Eliminate "Immediate" flag from CompilerInvocation.
This adds some ugliness in the current swift binary because we weren't
bothering to set a requested action before, but it keeps things simpler
elsewhere. (Thanks, Connor.)

Swift SVN r13067
2014-01-28 22:20:13 +00:00
Connor Wakamo
9861019cc5 [frontend] Add a member function to FrontendOptions which returns whether or not the RequestedAction has output.
Swift SVN r11393
2013-12-17 21:34:24 +00:00