Commit Graph

162 Commits

Author SHA1 Message Date
Jordan Rose
a39afdc778 Merge pull request #18090 from jrose-apple/emit-interface-path
[Frontend] Add a new -emit-interface-path option
2018-07-24 12:49:27 -07:00
Jordan Rose
b9ae66d768 [Frontend] Add a new -emit-interface-path option
...but don't hook it up to anything yet.

This is the very very start of the module stability / textual
interfaces feature described at

  https://forums.swift.org/t/plan-for-module-stability/14551/

For now I've just made it a frontend option (not a driver option),
which is good enough for testing.
2018-07-20 16:40:51 -07:00
Robert Widmann
9ebb47430b [NFC] Correct a typo 2018-07-19 16:31:56 -07:00
Robert Widmann
d845112695 Add -track-system-dependencies Flag
Add a flag to configure the behavior of the Clang Importer's dependency tracker with respect to system dependencies.
2018-07-19 13:03:30 -07:00
Robert Widmann
2282065197 Rename "Name Binding" action to "Resolve Imports" 2018-07-13 11:00:48 -07:00
Robert Widmann
cb1e9dd821 Introduce Name Binding as a Frontend Action
Introduces the -name-bind frontend action that is intended as an intermediary between the parse-only actions and a full typechecking pass.  In this phase, module imports will be validated and resolved, making it possible to emit full make-style dependencies files among other things.

Note that all information available to a parse-only pass is available to name binding, but because it does not continue-on to typecheck input files, full semantic information is not.
2018-07-13 10:56:03 -07:00
Robert Widmann
c440b0ba5a Diagnose parse-only invocations trying to emit dependency information
Parse-only invocations do not support the proper creation of dependency files or reference dependency files because they have not yet run name binding.  Ban these invocations by diagnostic and add a new diagnostic specifically for reference dependencies.
2018-07-13 10:56:03 -07:00
Huon Wilson
0c4fe6cef2 Merge pull request #16838 from huonw/validate-tbd-by-default
[Frontend] Turn symbols-missing-from-TBD validation on by default in debug builds on Apple platforms.
2018-06-28 14:11:09 +10:00
Huon Wilson
caa3dd4d29 [Frontend] Turn symbols-missing-from-TBD validation on by default in debug builds on Apple platforms.
TBD validation is effectively an expensive assertion, and is currently only
tuned for Apple platforms. However, we don't want it to regress more, and it
would be nice to start getting validation from people using master
snapshots. Together, this means that turning it on by default for the cases
mentioned above is an appropriate course of action.

At the very least, this has the benefit of running validation across the stdlib,
the overlays and the whole testsuite on each build, so people making changes to
the compiler that change symbols are hopefully alerted.

One limitation here is that this is only validating that the TBD is a superset
of the true set of symbols: it could include spurious symbols that aren't
actually in the binary. This case is less problematic for Swift than symbols
missing from the TBD file, and so we've focused energy on this. Once we've fixed
the extra-symbols problems and are confident in it, this validation can be
upgraded to validate that too.

Half of rdar://problem/40431434.
2018-06-28 10:34:45 +10:00
Doug Gregor
b6c5830277 [Request-evaluator] Add GraphViz output option -output-request-graphviz.
Introduce a command-line option to visualize the complete set of output
request dependencies evaluated by a particular compile action. This is
exposing existing visualization facilities to the (-frontend) command line.
2018-06-21 00:23:50 -07:00
David Ungar
037a2c813b Add cutoff to limit time taking to check exhaustiveness of switch statement. 2018-05-03 10:30:15 -07:00
Huon Wilson
d4f49a1252 [IDE] std::function -> llvm::function_ref for some non-escaping params. 2018-05-01 08:29:06 +10:00
Slava Pestov
175b40919f AST: Fewer headers include Expr.h, Module.h, Stmt.h 2018-04-26 22:55:26 -07:00
Michael Gottesman
87d633b4cd [stringref-upgrade] Return a StringRef from suffixForPrincipalOutputFileForAction instead of a const char *.
This is in prepration for changing Strings.h to use StringLiteral.
2018-04-16 09:50:26 -07:00
Vedant Kumar
ca27e829ba Add a transform to help test lldb expression evaluation
The initial version of the debugger testing transform instruments
assignments in a way that allows the debugger to sanity-check its
expression evaluator.

Given an assignment expression of the form:

```
  a = b
```

The transform rewrites the relevant bits of the AST to look like this:

```
  { () -> () in
    a = b
    checkExpect("a", stringForPrintObject(a))
  }()
```

The purpose of the rewrite is to make it easier to exercise the
debugger's expression evaluator in new contexts. This can be automated
by having the debugger set a breakpoint on checkExpect, running `expr
$Varname`, and comparing the result to the expected value generated by
the runtime.

While the initial version of this testing transform only supports
instrumenting assignments, it should be simple to teach it to do more
interesting rewrites.

There's a driver script available in SWIFT_BIN_DIR/lldb-check-expect to
simplfiy the process of launching and testing instrumented programs.

rdar://36032055
2018-03-30 16:50:31 -07:00
Jordan Rose
41286bc676 Make JSON fix-it outputs be per-primary in batch mode. (#14995)
This means moving the output path into SupplementaryOutputPaths, and
using the same sort of diagnostic dispatching that serialized
diagnostics use. This is part of what's needed to run the migrator
in batch mode.
2018-03-09 11:58:54 -08:00
David Ungar
4866df6dfd Move SupplementaryOutputs into each InputFile. 2018-02-28 09:41:49 -08:00
Graydon Hoare
628c446fe3 [Stats] Add -profile-stats-{events,entities} 2018-02-21 16:22:48 -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
David Ungar
ba4f2a84b4 Move supplementary outputs to SupplementaryOutputs in FrontendInputsAndOutputs. 2018-02-07 13:55:32 -08:00
David Ungar
4821e15795 Extract shouldActionOnlyParse. 2018-02-02 20:25:05 -08:00
David Ungar
614006bc4f Move main outputs to FrontendInputsAndOutputs and InputFile 2018-02-01 11:55: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
a70ba0a6cd Split out ArgsToFrontenfOptionsConverter. 2018-01-19 09:51:30 -08:00
David Ungar
361ff7244c Move FrontendInputs into separate .h and .cpp files. 2018-01-18 18:34:57 -08:00
David Ungar
4ac390d24d Move InputFile into a dedicated header. 2018-01-18 14:57:27 -08:00
David Ungar
9ad0189c43 Remove redundant assertion. 2018-01-16 16:17:25 -08:00
David Ungar
c0b0b5c5da Eliminate InputFile::setBuffer by having SwiftASTManager create new InputFile's with the buffer set or not as needed. 2017-12-12 15:06:26 -08:00
David Ungar
a2dca04092 Trivial changes 2017-12-11 22:58:57 -08:00
David Ungar
08e0d11ce3 Add filename non-empty assertions. 2017-12-08 15:03:27 -08:00
David Ungar
068f5019b8 Relocate <stdin> correction to clarify why needed. 2017-12-08 13:16:49 -08:00
David Ungar
60827b4be3 Rename accessors to InputFile data. 2017-12-08 12:57:32 -08:00
David Ungar
fb93cfd389 Remove defaultable move constructor. 2017-12-06 15:30:03 -08:00
David Ungar
e85bb9a1ab Use llvm_unreachable. 2017-12-06 15:28:52 -08:00
David Ungar
4806c94a6d Rename argument of numberOfPrimaryInputsEndingWith to extension. 2017-12-06 15:28:27 -08:00
David Ungar
995a6c1b2a Rename doAllNonPrimariesEndWIthSIB to areAllNonPrimariesSIB. 2017-12-06 15:27:50 -08:00
David Ungar
d16c91c623 Remove const from return StringRef value. 2017-12-06 15:26:41 -08:00
David Ungar
f8f2f72679 Remove reference for const auto ... begin() 2017-12-06 15:26:00 -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
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
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
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