Commit Graph

109590 Commits

Author SHA1 Message Date
Michael Gottesman
ce298e94de [opt-remark] Print out the type when we retain/release.
This can be useful if we can't recognize a retain/release and one needs to
reason about what is being retained/released.
2020-07-28 18:35:34 -07:00
Doug Gregor
73f07a6f0f Merge pull request #33092 from DougGregor/forward-trailing-closure-matching-sourcecompat-backward-bias
[SE-0286] Forward matching of trailing closure arguments
2020-07-28 14:11:15 -07:00
tbkka
6187697a6c [Python3] Fix test failures in update_checkout (#33141)
Use correct relative import for Python 2&3

Remove unused variable

Fix import ordering per python_lint
2020-07-28 11:47:55 -07:00
tbkka
421ebd2788 [Python3] Fix "undefined symbol 'unicode'" from python_lint (#33146)
* [Python3] Fix "undefined symbol 'unicode'" from python_lint

This is a little tricky.

Python 2 "unicode" was renamed to "str" in Python 3.

For Python 2 compatibility, we need to use "unicode" in a couple
of places, but that's not defined on Python 3, which causes
python_lint errors (even if the reference is never actually executed).

To workaround this, when running in Python 3, define "unicode"
as a synonym for "str".  This defines the symbol (avoiding the
"undefined symbol" error from python lint) while preserving
the correct functionality on both Python 2 and Python 3.

When we drop Python 2 support (which we should do as soon as
possible), we can drop this workaround and globally replace
"unicode" with "str" to get the right Python 3-only functionality.
2020-07-28 11:47:25 -07:00
Suyash Srijan
d3b5996b05 [Sema] Diagnose explicit access to a lazy variable's underlying storage (#33144) 2020-07-28 19:12:53 +01:00
Pavel Yaskevich
b378baa535 Merge pull request #33145 from xedin/rdar-65704049
[AST] Mark repr invalid only if `@autoclosure` parameter doesn't poin…
2020-07-28 11:09:35 -07:00
Saleem Abdulrasool
483f55bf90 Merge pull request #33156 from compnerd/swift-apis
build: remove tensorflow-swift-apis from the master branch
2020-07-28 11:04:10 -07:00
Nate Cook
6d534ecb09 Fix swift_reflectionMirror_recursive* when called on pure ObjC classes. (#33143) 2020-07-28 12:13:43 -05:00
Saleem Abdulrasool
3a68e4f041 Merge pull request #33064 from compnerd/coroutine-lowering
IRGen: always execute the coroutine lowering pass
2020-07-28 09:16:28 -07:00
Nate Cook
498969f64e XFAIL SILOptimizer/large_string_array.swift.gyb (#33157) 2020-07-28 11:09:57 -05:00
Saleem Abdulrasool
2bf0ee413f build: remove tensorflow-swift-apis from the master branch
Remove the ability to build this dependency.
2020-07-28 08:27:24 -07:00
Suyash Srijan
db53fc7eb8 [Sema] Diagnose wrapped property if its projected value property conflicts with lazy variable storage property (#33152) 2020-07-28 15:39:49 +01:00
eeckstein
5fffeb81fb Merge pull request #33128 from eeckstein/string-optimization
SIL optimizer: Add a new string optimization
2020-07-28 10:17:28 +02:00
Dmitri Gribenko
1465ee6b29 Merge pull request #33150 from zoecarver/cxx/fix/struct-with-subobject-destructor-name
[cxx-interop] [nfc] HasMemberWithDestructor => StructWithSubobjectDestructor in comment.
2020-07-28 09:40:03 +02:00
Mishal Shah
3a50f93c60 Merge pull request #33142 from natecook1000/nate/stdlib-stability-abi
[stdlib] Only include _getMetadataSection functions in stdlib builds w/ assertions
2020-07-28 00:03:53 -07:00
fredriss
a1ae109783 Merge pull request #33133 from hyp/compiler-rt-sim-libs
[build-script] copy over the simulator libclang_rt.*.a libraries to a…
2020-07-27 21:56:51 -07:00
Xi Ge
54c7e1926a Merge pull request #33139 from nkcsgexi/move-sdk-version-to-platforms
Front-end: sink SDK version implementation to lib/Basic. NFC
2020-07-27 21:52:43 -07:00
Pavel Yaskevich
f2c2aa5d16 [AST] Mark repr invalid only if @autoclosure parameter doesn't point to function type
Instead on depending on repr to be a function, let's only check
whether type resolved for `@autoclosure` points to a function type
because it's allowed for `@autoclosure` parameters to be to
wrapped into parens or be represented by a typealias.

Resolves: rdar://problem/65704049
2020-07-27 21:11:29 -07:00
Varun Gandhi
ff82551454 Merge pull request #33117 from varungandhi-apple/vg-rename-Uncommon-type
[NFC] Rename ExtInfo::Uncommon to ExtInfo::ClangTypeInfo.
2020-07-27 20:22:08 -07:00
zoecarver
98803ec992 [cxx-interop] [nfc] HasMemberWithDestructor => StructWithSubobjectDestructor in comment.
The type "HasMemberWithDestructor" doesn't exist. It was replaced with
StructWithSubobjectDestructor but the comment wasn't updated.
2020-07-27 19:15:05 -07:00
Hamish Knight
81d455d701 Merge pull request #33107 from hamishknight/tbd-two 2020-07-27 17:03:05 -07:00
tbkka
d693ef017e Disable a hack that causes breakage on Python 3.8 (#33137)
Hacking sys.modules here was added unconditionally to fix an import problem on
Windows (with Python 2.7???).

This script works fine on Python 2.7 on macOS either with or without this hack.

This script breaks badly on Python 3.8 on macOS with this hack, so I've disabled
it here for all Python 3.
2020-07-27 16:28:50 -07:00
Saleem Abdulrasool
8e86d0fbbd IRGen: always execute the coroutine lowering pass
Do not gate the coroutine extension points on the LLVM passes. Without
running this pass, the generated IR cannot be used by the LLVM tooling.
This allows generating the LLVM IR to debug issues in the LLVM backend.

I encountered this when trying to isolate a debug info generation bug
which seems to be caused by the SRoA pass in LLVM. By allowing to emit
the LLVM IR without the LLVM optimizations, it is possible to isolate
the LLVM pass operation via `opt` from LLVM.
2020-07-27 23:17:30 +00:00
Xi Ge
cc8d27c419 Front-end: sink SDK version implementation to lib/Basic. NFC 2020-07-27 16:16:12 -07:00
swift-ci
01f4ee634a Merge pull request #33125 from varungandhi-apple/vg-fix-DebugInfo-test 2020-07-27 16:01:37 -07:00
Michael Gottesman
68052a3d1b Merge pull request #33135 from gottesmm/pr-bcb3de84050b91b600ff133d7d6902b97e6065af
[opt-remark] Add support for simple object projections.
2020-07-27 15:50:54 -07:00
Suyash Srijan
7ee6319cdc [Parse] [Sema] Update confusables diagnostic to mention the character names as well (#33105)
* [Parser] Update 'Confusables.def' file to include confusable and base character names

* [Parser] Add a new utility method to return the names of the confusable and base characters for a given confusable codepoint

* [Parser] Update diagnostic for confusable character during lexing to mention confusable and base character names

* [Sema] If there is just a single confusable character, emit a tailored diagnostic that also mentions the character names

* [Diagnostics] Add new diagnostic messages to the localization file

* [Test] Update confusables test

* [Utils] Update unicode confusables txt file and update script to regenerate confusables def file

* [Parse] Regenerate 'Confusables.def' using updated script

* [Utils] Adjust generate_confusables script based on review feedback

Fix a mistake with name mapping. Updated header comment. Fix a couple of linting issues.

* [Parse] Regenerate 'Confusables.def' file once again after script changes

* [Parse] Add the newline after end of 'getConfusableAndBaseCodepointNames' method

* [Test] Update diagnostic message in 'Syntax/Parser/diags.swift'
2020-07-27 23:15:31 +01:00
Nate Cook
014918c0ca Only include _getMetadataSection functions in stdlib builds w/ assertions 2020-07-27 17:12:27 -05:00
Augusto Noronha
0f8613711d Enable validation reflection tests passing on Linux (#33134) 2020-07-27 14:36:19 -07:00
swift-ci
e897477c04 Merge pull request #33123 from varungandhi-apple/vg-add-docs-Type.h-Types.h 2020-07-27 14:35:42 -07:00
Varun Gandhi
aeda622298 [NFC] Rename ExtInfo::Uncommon to ExtInfo::ClangTypeInfo.
The previous name was poorly chosen (by me). Time to fix that.
2020-07-27 13:40:32 -07:00
Alex Lorenz
3320d236e7 [build-script] copy over the simulator libclang_rt.*.a libraries to allow clang to link with them
Clang's driver started linking with libclang_rt.<os>sim.a when building for simulator.

Swift's build need to adapt to this clang change, by ensuring that the libclang_rt.<os>sim.a libraries are created during the build
2020-07-27 13:07:21 -07:00
Michael Gottesman
0bd6a58fae [opt-remark] Add support for simple object projections.
This ensures that we are able to properly look through struct_extract,
tuple_extract in cases where we have an aggregate with multiple non-trivial
subtypes (implying it is not-rc identical with those sub-types).

The end result is that we now emit good diagnostics for things like this:

```
func returnStructWithOwnerOwner(x: StructWithOwner) -> Klass {
    return x.owner // expected-remark {{retain}}
                   // expected-note @-7:33 {{of 'x.owner'}}
}
```
2020-07-27 12:35:00 -07:00
Erik Eckstein
7f684b62e2 SIL optimizer: Add a new string optimization.
Optimizes String operations with constant operands.

Specifically:
  * Replaces x.append(y) with x = y if x is empty.
  * Removes x.append("")
  * Replaces x.append(y) with x = x + y if x and y are constant strings.
  * Replaces _typeName(T.self) with a constant string if T is statically known.

With this optimization it's possible to constant fold string interpolations, like "the \(Int.self) type" -> "the Int type"

This new pass runs on high-level SIL, where semantic calls are still in place.

rdar://problem/65642843
2020-07-27 21:32:56 +02:00
Erik Eckstein
bf4e61f9e3 Demangler: add an option to print a demangled type name exactly as the runtime function _typeName would do. 2020-07-27 21:32:56 +02:00
Erik Eckstein
a27822d52d ASTMangler: add a little utility function to create a mangled name for _typeName constant propagation. 2020-07-27 21:32:56 +02:00
Erik Eckstein
b42bce4ba4 stdlib: changes for the StringOptimization
To be able to constant fold string interpolation, the right semantic attributes must be in place.
Also, the interpolation's write function must be inlinable.
For the _typeName constant folding, a semantic attribute is required.
2020-07-27 21:32:56 +02:00
swift-ci
b2f8fa8fcc Merge pull request #33127 from apple/xfail-66110025-66110075 2020-07-27 12:24:52 -07:00
Varun Gandhi
fadc7e7fd2 [docs] Add comments clarifying roles of Type.h and Types.h. 2020-07-27 12:04:53 -07:00
Saleem Abdulrasool
2ea2d23b92 Merge pull request #33130 from compnerd/python-path
test: decode the output of `lldb -P` as UTF-8
2020-07-27 12:04:16 -07:00
swift-ci
6a68525691 Merge pull request #33124 from varungandhi-apple/vg-consistent-note-style 2020-07-27 11:30:15 -07:00
Joe Groff
90f0f7c627 Merge pull request #32359 from jckarter/enable-prune-vtables
Add PruneVTables to the performance optimizer passes.
2020-07-27 11:10:53 -07:00
Michael Gottesman
396709c90d Merge pull request #33112 from gottesmm/pr-c334b2062d3c019bcc64f91201c92417548b8992
[sil] Add an implementation of isIndirectResultOperand() onto ApplySite that returns false for partial_apply.
2020-07-27 11:04:30 -07:00
Saleem Abdulrasool
718d81281a test: decode the output of lldb -P as UTF-8
We currently use the byte string as the PYTHONPATH with Python 3, which
is odd.
2020-07-27 09:22:21 -07:00
David Zarzycki
8a45c9c62f Merge pull request #33129 from davezarzycki/pr33129
[CMake] BUILD_SHARED_LIBS fixes
2020-07-27 11:24:19 -04:00
Suyash Srijan
cc49c6105c [Diagnostics] Update diagnostic message for invalid overrides (#33097)
* [Diagnostics] Update 'does not override' diagnostic message to include protocol context as well

* [Sema] Check whether the override context is a class or a protocol for diagnostic purposes

* [Test] Update tests with new diagnostic message for overrides in protocol context

* [Sema] Adjust diagnostic for overrides in structs and enums to use the existing 'override_nonclass_decl' diagnostic
2020-07-27 15:15:28 +01:00
David Zarzycki
823f26baf2 [CMake] BUILD_SHARED_LIBS fixes 2020-07-27 08:52:01 -04:00
Mishal Shah
2b18b5067c [XFAIL] Sema/SwiftUI/rdar57201781.swift and Constraints/trailing_closures_objc.swift to support Xcode 12 beta 3 2020-07-26 23:24:26 -07:00
Michael Gottesman
0c7894f0d4 Merge pull request #33126 from gottesmm/pr-0798e887d05d3200b9055617e87b3f37f6f81f21
[opt-remark] Add @_semantics("optremark{.$SIL_PASS_NAME}") that force opt remarks on functions.
2020-07-26 17:38:01 -07:00
Michael Gottesman
96097b0879 [opt-remark] Add @_semantics("optremark{.$SIL_PASS_NAME}") that force opt remarks on functions.
More specifically, if one wants to force emit /all/ opt-remarks on a function, mark it with:

```
@_semantics("optremark")
```

If one wants to emit opt-remarks only for a specific SIL pass (like lets say
sil-opt-remark-gen), one can write:

```
@_semantics("optremark.sil-opt-remark-gen")
```

I made the pattern matching strict so if you just put in a '.' or add additional
suffixes, it will not pattern match. I think that this is sufficient for a
prototyping tool.

This is useful if one wants to play around with opt-remarks when optimizing code
in Xcode or any IDE that can use serialized diagnostics.
2020-07-26 14:55:02 -07:00