Commit Graph

234 Commits

Author SHA1 Message Date
omochimetaru
a07b35ab03 [Diagnostics] Improve {{none}} fix-it verifier (#30791)
* [Diagnostics] Improve {{none}} fix-it verifier

* split two conditions

* define "none" constant

* support plural

* use Twine and add comment for replacement range

* check if {{none}} is at the end

* use noneMarkerStartLoc

* update second {{none}} error message

Co-Authored-By: Owen Voorhees <owenvoorhees@gmail.com>

* update test case for second {{none}}

* fix test case for new {{none}} check

* Use named struct

* set const

Co-authored-by: Owen Voorhees <owenvoorhees@gmail.com>
2020-04-09 15:32:14 -07:00
Owen Voorhees
2c2850d7eb Merge branch 'master' into verifier-wording-fix 2020-04-01 17:05:24 -05:00
Owen Voorhees
768c4385cf [DiagnosticVerifier] More accurate wording when printing diagnostics from external sources 2020-03-21 15:11:46 -07:00
Slava Pestov
9ec80df97e SIL: Remove curried SILDeclRefs 2020-03-19 02:20:21 -04:00
Ben Langmuir
63963ab6fe [test] Update uses of llvm-objdump to --long options
Adapt to llvm upstream commit 5c3ec7dc41f3e15c39a193b45f3cf23255de00a2
to fix the master-next tests.
2020-03-16 11:57:08 -07:00
Martin Boehme
f81ef9cf1e Prepend "diagnostic produced by Clang:" to Clang diagnostics. 2020-03-02 14:56:42 +01:00
Martin Boehme
323721b5d1 Fix verify-broken-c-module to work on macOS.
Shorten expected error message so that it doesn't expect "C module" (and
breaks if presented with "Objective-C module").
2020-03-02 14:56:42 +01:00
Martin Boehme
f51f632c43 Use "not" instead of "set +o pipefail"; improve "broken" header.
A header shouldn't contain a function body unless the function is
inline. Following gribozavr's suggestion, I'm using the easier solution
of omitting the semicolon from the function prototype.

(In response to review comments.)
2020-03-02 14:56:42 +01:00
Martin Boehme
ca9df83fef Add tests for -verify mode. 2020-03-02 14:56:42 +01:00
David Ungar
72032493f9 Fix and test for extension body 2020-02-29 23:19:09 -08:00
David Ungar
fb2e0e7d13 Add class, enum, protocol tests for type-fingerprints and put in separate directory 2020-02-29 10:52:20 -08:00
David Ungar
d09c906553 Fix overly conservative fingerprint bug & fix tests. 2020-02-27 23:38:03 -08:00
Joe Groff
dcd432a1bc Turn on substituted SILFunctionTypes by default 2020-02-24 12:14:21 -08:00
David Ungar
0440e91451 Try setting mod times explicitly to fix unreproducible ci failure. 2020-01-29 10:54:18 -08:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
David Ungar
ec4f8de3b9 Fix tests for fine-grained dependencies 2020-01-16 13:20:49 -08:00
Slava Pestov
1df3d1a33c Frontend: Don't interleave parsing and typechecking for the main file
SIL files still require this behavior; if we cleaned that up we
could simplify a fair bit of code here.

Fixes <https://bugs.swift.org/browse/SR-284>,
<https://bugs.swift.org/browse/SR-4426>.
2019-12-05 08:45:55 -05:00
Daniel Rodríguez Troitiño
e7b3163646 [test] Redirect stderr to a different file to avoid mixing with stdout.
In Windows stdout and stderr are not line buffered, so the output of
stderr can be intermixed with the stdout, which will break the test when
checking with CHECK-NEXT and similar. Additionally it seems that stderr
always contains at least one new line.

Redirecting stderr to a file removes the problems with the mixing, and
since the stderr is not checked for this test, should not change
anything.
2019-12-03 17:46:55 -08:00
Saleem Abdulrasool
0de6e736ba test: repair Android builds
This test requires execution, which the android CI currently does not support.
Mark the test as executable to fix the CI.
2019-12-02 09:20:35 -08:00
Tapan Thaker
322ad482b6 [FrondEnd] Wrap RunInmediately() in a pretty stack trace indicating we are running user code 2019-11-30 12:33:28 -08:00
Daniel Rodríguez Troitiño
b17788f862 [test] Use -emit-sorted-sil and reorder CHECKs to match output.
In some cases (Android ARMv7) the SIL output wasn't following the output
of the source code, and the test failed. Use -emit-sorted-sil to use a
stable sorting for the SIL, and reorder the source to match the SIL
output.

The output is now the same order not depending on the value of
StripOwnershipAfterSerialization.
2019-11-18 15:15:39 -08:00
Michael Gottesman
269762eee3 [ownership] Enable ownership lowering /after/ the diagnostic passes.
I also updated the last group of straggling tests.
2019-11-17 11:34:43 -08:00
Robert Widmann
c75af38a7a Drop ConformanceContexts out of the TypeChecker 2019-11-06 11:41:03 -08:00
Daniel Rodríguez Troitiño
70b1d91315 [windows] Allow EXE and exe capitalizations in tests.
Clang 8 or 9 seems to have changed from EXE to exe. Allow both
capitalizations (which is not important in Windows) as a workaround.

Maybe in the future we can remove the uppercase option.
2019-10-03 11:09:03 -07:00
swift-ci
349d6b073e Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-26 12:44:18 -07:00
Harlan Haskins
b904133c42 [Modules] Add flag to skip non-inlinable function bodies
This flag, currently staged in as `-experimental-skip-non-inlinable-function-bodies`, will cause the typechecker to skip typechecking bodies of functions that will not be serialized in the resulting `.swiftmodule`. This patch also includes a SIL verifier that ensures that we don’t accidentally include a body that we should have skipped.

There is still some work left to make sure the emitted .swiftmodule is exactly the same as what’s emitted without the flag, which is what’s causing the benchmark noise above. I’ll be committing follow-up patches to address those, but for now I’m going to land the implementation behind a flag.
2019-09-26 10:40:11 -07:00
swift-ci
a9e39bdb21 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-09-13 21:03:33 -07:00
Harlan Haskins
d3b8ce7ae2 [test] Update ParseableInterface to ModuleInterface
Also remove uses of -emit-parseable-module-interface from tests
2019-09-13 14:55:48 -07:00
swift-ci
f00c8fc8a3 Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-29 14:44:20 -07:00
Jordan Rose
9bc5a55ca4 Merge pull request #26685 from jrose-apple/po-tay-toes
Use a better hash seed when doing string hashing in the compiler
2019-08-29 14:26:08 -07:00
swift-ci
1a7fb00deb Merge remote-tracking branch 'origin/master' into master-rebranch 2019-08-29 11:24:13 -07:00
Jordan Rose
c06e105bd0 [Serialization] Switch to a better hash seed for lookup tables
...fulfilling the promised audit from 0747d9a339. No intended
functionality change /other/ than the order of already-unsorted lists.
This affected a number of SIL tests that relied on deserialization
order matching the original source order; I have no idea why the old
hash logic would make that the case. If we think that's a valuable
property, we should serialize a list of functions in addition to the
iterable table. (Maybe just in SIB mode?)
2019-08-29 09:20:18 -07:00
Daniel Rodríguez Troitiño
a7888f0720 [test] Remove redirection stderr->out that corrupted output.
The RUN line was redirecting stderr to stdout, but nothing in the test
was checking for the stderr output.

However, the last line of stderr was an empty newline, which was printed
(in my machine) in the middle of the dump from the AST, breaking the
test.

If we ever need to check the stderr, it should be redirected to a file,
and the file should be passed to FileCheck independently, to avoid
concurrent uses of the output buffer.
2019-08-28 14:13:30 -07:00
Jonas Devlieghere
5c5041235b Merge Swift & Clang VFS in the ClangImporter
The clang importer has to deal with two virtual file systems, one coming
from clang, and one coming from swift. Currently, if both are set, we
emit a diagnostic that we'll pick the swift one.

This commit changes that, by merging the two virtual file systems. The
motivation for this change is the reproducer infrastructure in LLDB,
which adds a third virtual file system to the mix.

(cherry picked from commit 94ef5431ff)
2019-08-19 16:53:03 -07:00
Varun Gandhi
c85eae1efb Get rid of the second call to setType() in validateExtension().
This means that we no longer have the invariant that the extendedType always
contains the generic parameters. So we need to fix the assertions/test cases
for it.
2019-08-19 11:37:18 -07:00
Owen Voorhees
e7a1a1cc3d Add -debug-diagnostic-names frontend flag
This flag adds diagnostic names to the end of their messages, e.g. 'error: cannot convert value of type '[Any]' to specified type '[Int]' [cannot_convert_initializer_value]'. It's intended to be used for debugging purposes when working on the compiler.
2019-08-05 18:54:21 -07:00
Jonas Devlieghere
fe2ad03f93 Revert "[ClangImporter] Merge Swift & Clang VFS" 2019-07-05 15:30:43 -07:00
Jonas Devlieghere
f359cef5d0 [ClangImporter] Merge Swift & Clang VFS
The clang importer has to deal with two virtual file systems, one coming
from clang, and one coming from swift. Currently, if both are set, we
emit a diagnostic that we'll pick the swift one.

This commit changes that, by merging the two virtual file systems into a
single overlay file system, and using that. To make this possible, we
always initialize the file manager with an overlay file system. In the
clang importer, we then create a new overlay file system, starting with
the one coming from clang, and adding overlays from swift on top.

The motivation for this change is the reproducer infrastructure in LLDB,
which adds a third virtual file system to the mix.
2019-07-03 17:40:31 -07:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Jordan Rose
f4487881e4 Add PrettyStackTraceSwiftVersion, and use it in the swiftc executable (#24235)
As pointed out on a recent JIRA, crash traces don't mention what
version of Swift you were running. Usually that can be gleaned from
the path, but not always.
2019-04-24 15:53:56 -07:00
Harlan Haskins
6d72977642 [test] [ModuleInterfaces] Get tests passing with new diagnostics 2019-04-11 18:05:09 -07:00
Saleem Abdulrasool
c683b4985a test: make Frontend.vfs pass on Windows
Ensure that we convert the path to the correct separator for the mapping
to take effect.  This makes the last Frontend test pass on Windows.
2019-04-07 16:32:15 -07:00
Saleem Abdulrasool
cd7946d413 test: make Frontend.dependencies pass on Windows
Windows absolute paths contain [A-Z]:.  Filter out the explicit ' : '
separator that we were trying to check for to allow the test to pass on
Windows as well.
2019-03-27 14:36:14 -07:00
Slava Pestov
1159af50d9 Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
2019-03-14 22:24:26 -04:00
David Ungar
46ec774731 Added test. 2019-03-05 17:54:44 -08:00
Jason Mittertreiner
2680c34a15 Implement SeparateErrors on Windows
To display stack traces from child processes, the driver combines stdout
and stderror together on Unix. This makes the Basic implementation also
do that.
2019-02-27 14:39:50 -08:00
Saleem Abdulrasool
f272e03ccc test: loosen -Xllvm version string matching
If the LLVM/clang is built with release mode and PACKAGE_VENDOR set, it
will not print the same string but rather the version number.  Permit
either string.
2019-02-26 19:48:18 -08:00
Jordan Rose
43feb9cbe1 On Apple platforms, use swiftmodule directories for the stdlib (#21797)
This changes the Swift resource directory from looking like

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          x86_64/
            Swift.swiftmodule
            Swift.swiftdoc
            Darwin.swiftmodule
            Darwin.swiftdoc

to

    lib/
      swift/
        macosx/
          libswiftCore.dylib
          libswiftDarwin.dylib
          Swift.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc
          Darwin.swiftmodule/
            x86_64.swiftmodule
            x86_64.swiftdoc

matching the layout we use for multi-architecture swiftmodules
everywhere else (particularly frameworks).

There's no change in this commit to how Linux swiftmodules are
packaged. There's been past interest in going the /opposite/ direction
for Linux, since there's not standard support for fat
(multi-architecture) .so libraries. Moving the .so search path /down/
to an architecture-specific directory on Linux would allow the same
resource directory to be used for both host-compiling and
cross-compiling.

rdar://problem/43545560
2019-02-19 14:47:21 -08:00
Parker Schuh
b12fcb50db IntegerLiteralExpr now is lowered directly into SIL.
For context, String, Nil, and Bool already behave this way.

Note: Before it used to construct (call, ... (integer_literal)), and the
call would be made explicit / implicit based on if you did eg: Int(3) or
just 3. This however did not translate to the new world so this PR adds
a IsExplicitConversion bit to NumberLiteralExpr. Some side results of
all this are that some warnings changed a little and some instructions are
emitted in a different order.
2019-02-14 11:54:16 -08:00
Rintaro Ishizaki
6aee036812 Merge pull request #22214 from bannzai/syntax/add/function/make_ellipsis_token
[SwiftSyntax] Add SyntaxFactory.makeEllipsisToken function.
2019-02-11 16:27:37 -08:00