Commit Graph

32 Commits

Author SHA1 Message Date
Doug Gregor
ae6b41dc37 Clang importer: enable the Swift name lookup tables by default.
Fixes rdar://problem/14776565 (AnyObject lookup for Objective-C
properties with custom getters) and rdar://problem/17184411 (allowing
__attribute__((swift_name("foo"))) to work on anything).
2015-12-21 09:55:21 -08:00
Doug Gregor
b8c530db06 Clang importer: implement global visible-declaration using the lookup tables.
Implement the lookup used by code completion, typo correction, etc. to
use the Swift name lookup tables when they are enabled.
2015-12-16 11:21:38 -08:00
Argyrios Kyrtzidis
2931543a2f Revert "XFAIL failing IDE tests while BenL investigates. rdar://20245658."
This reverts commits r26369 & r26381.
After upstream clang changes, reverted r25843 which was compensating for a previous upstream clang change.

But keep test/IDE/complete_from_clang_framework.swift disabled for further investigation, because it
seems to have some duplications in a code-completion test.

rdar://20245658&20247922

Swift SVN r26430
2015-03-23 07:24:27 +00:00
Michael Gottesman
60b02a5c46 XFAIL failing IDE tests while BenL investigates. rdar://20245658.
Swift SVN r26369
2015-03-20 22:38:47 +00:00
Ben Langmuir
5f2bcba8ba Update tests for code-completion modulename change
Add module name to OtherModule result output and update the tests
accordingly.

Swift SVN r26262
2015-03-18 16:40:28 +00:00
Argyrios Kyrtzidis
e813673dc3 [ClangImporter] Make sure that we are not importing re-declarations, after upstream
Clang change in r231424.

Also re-enable the disabled IDE tests.
rdar://20064024

Swift SVN r25843
2015-03-07 07:14:33 +00:00
Andrew Trick
4d097902bc Disable swift IDE tests pending rdar:20064024
Swift SVN r25801
2015-03-06 08:59:27 +00:00
Denis Vnukov
152df92966 [CodeCompletion] Code Completion String getName should always return non-empty string value for
valid code completions. Code completion tests call and validate getName’s result. 

A minor fix for code completion fro subscripts.



Swift SVN r25101
2015-02-09 22:32:05 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Jordan Rose
e21abcf405 [ClangImporter] Don't put method redeclarations in a member list.
Previously we'd try to put the same method into the list of members multiple
times--once for each redeclaration in the @interface. This led to an
assertion failure.

Checking the canonical decl isn't super cheap, but the ObjCMethodDecl
redeclaration infrastructure seems to be fairly broken. We can revisit this
later.

There's also a test for what happens when categories get involved. I'm not
convinced this is correct behavior, either, and will file an additional bug
to look into that at some point.

rdar://problem/19039485

Swift SVN r24129
2014-12-23 22:43:30 +00:00
Joe Groff
e6d97e8de7 Clang importer: Add a zeroing default initializer to imported structs.
If an imported C struct has no __nonnull pointer fields, then we can give a default initializer that zeroes all of its fields. This becomes a requirement when working with partially-imported types like NSDecimal. NSDecimal has bitfields Swift can't see yet, so it's impossible to DI, but the Foundation functions that work with NSDecimal all emit their result by out parameter, and without access to its fields it is impossible to initialize an NSDecimal for use with one of these functions. Implement the initializer using a builtin that gets lowered by IRGen; this is also made necessary by the fact that Swift has only a partial view of the struct, so we can't form a complete zero initializer until we have the definitive type layout from Clang.

Swift SVN r23727
2014-12-05 05:31:22 +00:00
Dmitri Hrybenko
1eea220932 Use one module cache directory for all the lit tests to speed them up
Doing so is safe even though we have mock SDK.  The include paths for
modules with the same name in the real and mock SDKs are different, and
the module files will be distinct (because they will have a different
hash).

This reduces test runtime on OS X by 30% and brings it under a minute on
a 16-core machine.

This also uncovered some problems with some tests -- even when run for
iOS configurations, some tests would still run with macosx triple.  I
fixed the tests where I noticed this issue.

rdar://problem/19125022

Swift SVN r23683
2014-12-04 11:21:48 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Doug Gregor
b6248c8342 Remove the -enable-objc-failable-initializers option.
As part of this, failable initializers get enabled by default for
swift-ide-test.


Swift SVN r21704
2014-09-04 15:31:02 +00:00
Dmitri Hrybenko
045eca49ef Code completion: when preparing a pattern for closure expansion in function
parameters, don't consider autoclosures to be expandable

rdar://17842781


Swift SVN r21006
2014-08-04 12:17:33 +00:00
Jordan Rose
5257550f13 [ClangImporter] Don't mark generated 'unavailable' attributes as implicit.
Nearly all of them come from some annotation written explicitly in the
Objective-C header, and all of them should be shown in the generated
interface for an imported module.

Part of <rdar://problem/17024498>

Swift SVN r20841
2014-07-31 18:58:14 +00:00
Doug Gregor
e9037bcfa7 Default swift-ide-test to -implicit-objc-with like the rest of the world.
We require some level of consistency between the way the overlays were
built and what we work with in our mock SDK. The IDE/sdk_sugar.swift
test failure was because the overlay referenced "init(coder:)" while
the test was looking for "init(withCoder:)". Hilarity ensued
<rdar://problem/17791048>.

This only impacts testing.

Swift SVN r20564
2014-07-25 22:13:43 +00:00
Jordan Rose
00b6a5cb08 Import Objective-C properties marked weak/copy as weak/@NSCopying.
...and 'assign' and 'unsafe_unretained' as 'unowned(unsafe)', if the
property is a class type.

This isn't important for the compiler, but it is documentation for users
when they look at the generated interface for an Objective-C module.

Note that this actually produces a decl users can't yet write:

  unowned(unsafe) var foo: UIView!

That's <rdar://problem/17277899> unowned pointers can't be optional.

<rdar://problem/17245555>

Swift SVN r20433
2014-07-23 22:29:01 +00:00
Dave Abrahams
21669b3aee [stdlib] Add "Mutable" to [Autoreleasing]UnsafePointer
UnsafePointer becomes UnsafeMutablePointer
AutoreleasingUnsafePointer becomes AutoreleasingUnsafeMutablePointer

Swift SVN r20316
2014-07-22 16:56:23 +00:00
Dmitri Hrybenko
21dd66b6cc Code completion: don't adjust implicitly unwrapped optional types to normal
optionals

rdar://17732126


Swift SVN r20212
2014-07-19 18:41:41 +00:00
Sonny Falk
efa1ff8ab4 [IDE/CodeComplete] Add CallParameterClosureType chunk, which resolves
optional & alias types for closure type parameters.

This allows code completion placeholder expansion to properly expand
closure parameters utilizing a typealias, e.g. dispatch_block_t.

Update and add test for the above.

Work for <rdar://problem/15860693>.

Swift SVN r20206
2014-07-19 03:18:29 +00:00
Joe Groff
cb48fbd24b Enable pointer conversions.
Swift SVN r19274
2014-06-26 23:26:31 +00:00
Chris Lattner
b844728b3b Implement: <rdar://problem/17464179> Stop importing decls with CInt and related typedefs
This keeps CInt (and related type aliases) in the stdlib, and keeps the clang importer
using them, but has it look through one level of the type alias to get to the underlying
type. 

The upshot of this is that we now import things like exit (as a random example) as 
"func exit(Int32)" instead of "func exit(CInt)".



Swift SVN r19224
2014-06-26 06:28:40 +00:00
Jordan Rose
ce4dcb7a5f [ClangImporter] Import C function types as CFunctionPointer<T>.
...where T is the equivalent Swift function type. This gives us proper type
safety (ish) for C function pointers while still not treating them the same
as Swift closures.

If the function type is not one we can represent in Swift, we fall back to
COpaquePointer. CFunctionPointer<T> and COpaquePointer can be explicitly
constructed from one another, but do not freely convert.

<rdar://problem/17215978>

Swift SVN r19154
2014-06-25 00:33:06 +00:00
Argyrios Kyrtzidis
cfa64f4f6e [IDE] For AST printing, adjust recordDeclLoc() invocations at the point where Decl::getLoc() would point,
which is generally before the name.

Fixes rdar://16887111

Swift SVN r18448
2014-05-20 07:36:25 +00:00
Sonny Falk
a2680240c0 [IDE/CodeCompletion] Teach code completion to display the local parameter name
if there's no parameter API name. This is for display purposes only.
Update all relevant tests accordingly.
This addresses <rdar://problem/16768768>.

For example:
  class X {
    func f(a: Int, b: Int) { }
  }

Would previously display like this in code completion in Xcode:
  f(<#Int#>, b: <#Int#>)

The local parameter name, while not API, often still conveys meaning
to the user. So it's now included like this:
  f(<#a: Int#>, b: <#Int#>)

Swift SVN r18403
2014-05-19 08:31:10 +00:00
Dmitri Hrybenko
a48ad67d72 Code completion: make test more strict
Swift SVN r18342
2014-05-18 19:13:14 +00:00
Argyrios Kyrtzidis
5d2d762cd3 [ClangImporter] A typedef to a typedef should get imported as a typealias.
Swift SVN r18328
2014-05-18 16:08:56 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
16c75ddc66 Code completion: add a test: check that we include code completion results for
contents of the frameworks that are re-exported by the imported frameworks (but
not explicitly imported in the .swift source).


Swift SVN r6953
2013-08-06 21:24:50 +00:00