Commit Graph

39091 Commits

Author SHA1 Message Date
Robert Widmann
3f7c89ae9c Correct diagnostic for plain member constraints
This used to print as just a plain space.

Resolves rdar://60030114
2020-03-16 11:22:18 -07:00
Arnold Schwaighofer
a5b277b5e0 IRGen: Unique method descriptors in objc method lists
Before this patch we used to get duplicate entries because we would
define implicit function delcarations, e.g for

(func_decl "perform(_:)" interface type='<Self where Self : NSObjectProtocol> (Self) -> (Selector?) -> Unmanaged<AnyObject>?' access=public @objc
  (parameter "self")
  (parameter_list
    (parameter "aSelector" type='Selector?' interface type='Selector?')))

we will define:

(func_decl implicit "performSelector(_:)" access=public @objc
  (parameter "self")
  (parameter_list
    (parameter "aSelector" type='Selector?' interface type='Selector?')))

rdar://60461850
2020-03-16 11:22:04 -07:00
Robert Widmann
2966a38ee1 Do a little extra validation of RawRepresentable.RawValue
* In the DeclChecker, duplicate the check that we have a reasonable
RawValue type so we do not attempt to form an invalid key. The interface
to the autoincrementer has this as invariant, but it was not previously
checked as a precondition.

* In the deriver, try to check for the case where the user has written
a mismatched explicit declaration of RawValue, or a type sharing that
name, and check type equality with the declared raw type to make this
pass resilient to mismatches as well.

Resolves rdar://57072148, rdar://59703784
2020-03-16 09:59:09 -07:00
eeckstein
b5c0b6de9d Merge pull request #30381 from eeckstein/lazy_properties
Improve optimization of lazy properties.
2020-03-16 08:32:19 +01:00
Michael Gottesman
f3df836652 [ownership] Treat open_existential_box as an interior pointer producting instruction.
This means that it can only have a guaranteed object as an operandand that we
validate that all uses of the result address of open_existential_box occur only
within the lifetime of said object's borrow scope.
2020-03-15 23:21:45 -07:00
Daniel Rodríguez Troitiño
6ac04c6079 [android][armv7] Mark let_properties_opts.swift as XFAIL.
Looks like Android ARMv7 is not inline storeBytes so the test were
failing. Mark the test as XFAIL and open a bug in the tracker to keep
the CI green for the moment.
2020-03-15 19:13:37 -07:00
Xi Ge
251edf3765 TBDGen: don't emit $ld$previous$ symbols for added members to a moved decl
When a top-level decl is marked with @_originallyDefinedIn, some of its members
may also be newly added after the top-level decl has been moved to the current module.
For these members, we don't need emit $ld$previous$ symbols for them.

rdar://60478650
2020-03-15 19:02:31 -07:00
Anthony Latsis
d688710fb3 [Diag] Move invalid where clause on top-level decl diagnostic to Sema 2020-03-15 13:38:49 +03:00
Michael Gottesman
bf51db3dd3 Merge pull request #30392 from gottesmm/pr-03e3d52c4db923b12298a536cc10b52fd26d7f88
[ownership] Add an interior_pointer test that validates we get the error msg we expect for ref_elt_addr, ref_tail_addr.
2020-03-14 19:46:25 -07:00
Andrew Trick
ca686a58ec Merge pull request #30414 from atrick/fix-escape-unreachable
Fix EscapeAnalysis verification assert at unreachable blocks
2020-03-14 17:53:09 -07:00
Andrew Trick
bebbe370e8 Fix EscapeAnalysis verification assert at unreachable blocks
If EscapeAnalysis verification runs on unreachable code, it asserts
with "Missing escape connection graph mapping" because the connection
graph builder only runs on reachable blocks.

Add a ReachableBlocks utility and use it during verification.

Fixes <rdar://problem/60373501> EscapeAnalysis crashes with CFG with
unreachable blocks
2020-03-14 14:31:41 -07:00
Pavel Yaskevich
5bb2a62b70 Merge pull request #30409 from HassanElDesouky/SR-12309
[CSGen] Force unwrapping 'nil' compiles without warning
2020-03-14 11:41:02 -07:00
Owen Voorhees
592ce68c55 Support the combination of -enable-educational-notes and -enable-experimental-diagnostic-formatting 2020-03-14 09:21:06 -07:00
Brent Royal-Gordon
5b7a13cf69 Merge pull request #30410 from brentdax/futures-end
Improve diagnostic for broken module interfaces
2020-03-14 01:25:58 -07:00
HassanElDesouky
8d5a33ee89 Move to visitNilLiteralExpr 2020-03-14 07:39:44 +02:00
Brent Royal-Gordon
a7a5e340aa Improve diagnostic for broken module interfaces
Currently, when a swiftinterface file fails to load, we emit the specific diagnostics for the failures, followed by a generic “failed to load module ‘Foo’” message. This PR improves that final diagnostic, particularly when the cause may be that the interface was emitted by a newer compiler using backwards-incompatible syntax.
2020-03-13 20:31:55 -07:00
Meghana Gupta
8e800e49bf Recommit #29812 with fixes (#30342) 2020-03-13 19:34:16 -07:00
HassanElDesouky
ceb3f3842f [SR-12309] Add more tests 2020-03-14 03:06:10 +02:00
Xi Ge
21b9e80848 Merge pull request #30405 from nkcsgexi/omit-resilient-witness-table-tbd
TBDGen: omit witness table symbol for imported resilient protocols
2020-03-13 16:36:55 -07:00
HassanElDesouky
8195cce1d3 [SR-12309] Cannot force unwrap 'nil' 2020-03-14 01:28:28 +02:00
swift-ci
a7470db556 Merge pull request #30404 from adrian-prantl/51645582 2020-03-13 15:39:13 -07:00
Andrew Trick
0395920668 Merge pull request #30369 from atrick/fix-verify-exclusivity
Fix MemBehavior calls to getAccessedAddress to avoid an assert.
2020-03-13 14:55:47 -07:00
Ben Langmuir
dbbe45e256 Merge pull request #30389 from benlangmuir/index-caf
[index] Add implicit callAsFunction reference to index
2020-03-13 14:44:26 -07:00
Xi Ge
1fc0799e8b TBDGen: omit witness table symbol for imported resilient protocols
For imported resilient protocols, we cannot directly emit witness table
symbol when a local type conforms to them because initializing these
protocols are required.

rdar://60429448
2020-03-13 13:46:50 -07:00
Adrian Prantl
56309f6b49 Debug Info: Store the SDK in the DICompileUnit.
This an intermediate step for PR44213
(https://bugs.llvm.org/show_bug.cgi?id=44213).

This stores the SDK *name* in the debug info, to make it possible to
`-fdebug-prefix-map`-replace the sysroot with a recognizable string and allowing
the debugger to find a fitting SDK relative to itself, not the machine the
executable was compiled on.

rdar://problem/51645582
2020-03-13 13:25:39 -07:00
Andrew Trick
7145a80fa2 Fix MemBehavior calls to getAccessedAddress to avoid an assert.
Fixes <rdar://60046018> assert: (v->getType().isAddress())
in getAccessedAddress.

MemBehavior compares known memory accesses with some arbitrary value,
which may not be an address. However, we should not call utilities
that work on accessed addresses with an arbitrary value.

This assert is a result of very recent changes to gradually make
memory access utilities more type safe and introduce the concept of a
canonical accessed address. In the future, we may even have a wrapper
type for such a thing. In the SIL optimizer, there are several
different notions of what constitutes the base of a memory
access. Mismatches can lead to subtle bugs.
2020-03-13 09:30:48 -07:00
Nathan Hawes
fcf95eae16 Merge pull request #30187 from nathawes/indentation
[SourceKit/CodeFormat] Re-work and improve the indentation implementation
2020-03-13 08:01:29 -07:00
Saleem Abdulrasool
2e134289d3 Merge pull request #30364 from compnerd/windows-filenames
test: adjust the test to improve the viability on Windows
2020-03-13 07:54:54 -07:00
Erik Eckstein
b51284fae3 CSE: optimize calls of lazy property getters
If such a call is dominated by another call to the same getter, it is replaced by a direct load of the property - assuming that it is already computed.

rdar://problem/34715412
2020-03-13 11:01:59 +01:00
Erik Eckstein
2de425665c PerformanceInliner: prevent inlining of lazy property getters
Lazy property getters are usually non tivial functions (otherwise the user would not implement it as lazy property).
Inlining such getters would most likely not benefit other optimizations because the top-level switch_enum cannot be constant folded in most cases.
Also, not inlining lazy property getters enables optimizing them in CSE.
2020-03-13 09:49:56 +01:00
Erik Eckstein
ae93e60072 SIL: add a lazy_property_getter flag to SILFunction
It is set on getter-functions for lazy properties.
2020-03-13 09:49:55 +01:00
Brent Royal-Gordon
0be8357dcc Merge pull request #29950 from brentdax/less-crossover
Make cross-importing faster
2020-03-13 01:45:02 -07:00
Ravi Kandhadai
c315bff573 Merge pull request #30386 from ravikandhadai/handle-in-guaranteed-captures
[OSLogOptimization] Fix folding of symbolic closures to handle @in_guaranteed captures
2020-03-12 20:48:18 -07:00
Rintaro Ishizaki
52d336705b Merge pull request #30383 from rintaro/ide-completion-callarg
[CodeCompletion] Call argument label with value placeholder
2020-03-12 19:43:53 -07:00
swift-ci
3982bb4af7 Merge pull request #28612 from owenv/terminal_md_viewer 2020-03-12 18:55:45 -07:00
Saleem Abdulrasool
bd62d5aa7d Merge pull request #30391 from drodriguez/android-test-add-to-abi-stable
[android][aarch64] Add Android to set of stable ABI testing targets.
2020-03-12 18:25:41 -07:00
Rintaro Ishizaki
9225cfce3d [CodeCompletion] Type annotation for call argument completions 2020-03-12 17:46:25 -07:00
Ben Langmuir
f1ccb394fb Merge pull request #30388 from benlangmuir/debug-stdlib-dis
Attempt to prevent CI failure with debug stdlib
2020-03-12 16:14:13 -07:00
Michael Gottesman
35f9b392c8 [ownership] Add an interior_pointer test that validates we get the error msg we expect for ref_elt_addr, ref_tail_addr. 2020-03-12 15:41:44 -07:00
Daniel Rodríguez Troitiño
6efa9f35d1 [android][aarch64] Add Android to set of stable ABI testing targets.
IRGen/conditional_conformances.swift was failing because Android AArch64
was taking the non ABI stable checks, but generating the ABI stable
code.
2020-03-12 15:30:30 -07:00
Ben Langmuir
3eff694bad [index] Add implicit callAsFunction reference to index
* Reference is marked "explicit", which may be unexpected - the reason
is that the *call* is explicit, so we want to find it with e.g. rename,
or looking up callers, even though the identifier callAsFunction is
implicit. This matches the behaviour of initializers.

* The source location is the same as the base name (e.g. in `add3(5)`,
it would be at `add3`), which matches the behaviour of initializers.

rdar://problem/60327632
2020-03-12 15:04:52 -07:00
Ben Langmuir
f1f7e66174 Attempt to prevent CI failure with debug stdlib
rdar://60379473
2020-03-12 13:24:47 -07:00
Ravi Kandhadai
e3a8a96469 [OSLogOptimization] Fix the symbolic closure folding code to only create
new closures when all captures of the symbolic closure, including address-typed
captures, are symbolic constants. For other closures, they must have been
autoclosures passed to the log call and therefore they need not be duplicated
but reused as such.

This eliminates the need to copy_value the non-constant captured values of
closures. Instead the closure itself is copied as a whole.

Fixes <rdar://problem/60344043>
2020-03-12 12:42:43 -07:00
Rintaro Ishizaki
f8147f72d9 [CodeCompletion] Call argument label with value placeholder
When a completion happens at a call argument position, insert
'label: <#T##TypeName#>' instead of just 'label: '.

rdar://problem/60379654
2020-03-12 11:48:15 -07:00
Argyrios Kyrtzidis
24a7620a9b [test/Index] Add a test case for cross-language USR generation fix on the clang side
This is a Swift-side test case for https://github.com/apple/llvm-project/pull/887
Ensures Swift and Clang are in-sync on the USRs for exported properties.
2020-03-12 09:58:17 -07:00
Pavel Yaskevich
126065821a Merge pull request #30348 from omochi/fix-arg-reorder
[ConstraintSystem] Fix bug of argument reordering in matchCallArguments
2020-03-12 09:29:11 -07:00
Joe Groff
719002b08e Merge pull request #30365 from jckarter/substitution-map-mismatches
Create an inherited conformance in SubstitutionMap::lookupConformance when needed.
2020-03-12 08:39:44 -07:00
Xi Ge
1a32db94cd Merge pull request #30366 from nkcsgexi/59110975
PrintAsObjC: allow users to specify bridging header relative path for printing
2020-03-12 00:30:41 -07:00
Nathan Hawes
2a93296fb6 [SourceKit/CodeFormat] Simplify ContextOverride a little, and only propagate ContextLocs when necessary.
We don't actually need to set a ContextOverride unless the ContextLoc and L
paren/brace/bracket are on different lines. Combined with the fact that we
only set them if the L and R parens/braces/brackets are on different lines
to, it guarantees there will be at most one override that's applicable on
any given line, which lets us simplify the logic somewhat.
2020-03-11 23:06:44 -07:00
Saleem Abdulrasool
6c02e6212d test: adjust the test to improve the viability on Windows
Convert the line endings manually since the parser is sensitive to the
trailing whitespace (the writing of the file will create a `\r\n` rather
than `\n`).  This largely fixes the issues for Windows with the issue
that the processing of the file location is currently not properly
processing escape characters and results in issues.

In theory, it should be possible for `getStringLiteralIfNotInterpolated`
to process the literal segments with `getEncodedStringSegment` for each
segment and then return a literal value cooked.  However, doing so will
require that the function return a `std::string` rather than `StringRef`
since the cooking means that we cannot simply provide a reference to the
SourceManager view.
2020-03-11 22:51:41 -07:00