Commit Graph

759 Commits

Author SHA1 Message Date
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
David Farler
544ef4002d Merge tvOS and watchOS Support
- Add frontend and standard library build support for tvOS.
- Add frontend support for watchOS.

watchOS standard library builds are still disabled during SDK bring-up.

To build for TVOS, specify --tvos to build-script.
To build for watchOS, specify --watchos to build-script (not yet supported).

This patch does not include turning on full tests for TVOS or watchOS, and
will be included in a follow-up patch.

Swift SVN r26278
2015-03-18 21:35:07 +00:00
Jordan Rose
edf3bb460d [ClangImporter] Ignore deprecated enum constants when computing prefixes.
This fixes the import of enums like NSCalendarUnit, which changed from
NSXXXCalendarUnit to NSCalendarUnitXXX, as has been the guideline in
recent years. Now even when the old names are present, we can still
prefix-strip based on the new names. If /all/ options are deprecated,
though, we'll prefix-strip as we did before.

Note that we /don't/ check the current deployment target for this,
because we want to use the "nice" names as soon as we have an SDK where
they're available, not when the deployment target matches such an SDK.

rdar://problem/17686122

Swift SVN r26184
2015-03-16 18:01:45 +00:00
Graham Batty
0c281d5a23 Use --sysroot instead of -isysroot on non-Darwin
Clang does not properly set up the include root on non-darwin
platforms with -isysroot, so use --sysroot on those platforms
instead.

Swift SVN r26102
2015-03-13 16:32:09 +00:00
Adrian Prantl
9d14113bf3 Adapt for Mach-O clang module container format transition.
NOTE: This may require deleting the Module Cache that build-script
       creates in the swift build dir.

rdar://problem/19104245

Swift SVN r26021
2015-03-12 02:00:56 +00:00
Adrian Prantl
83fce2670e Revert "Adapt for Mach-O clang module container format transition."
This reverts commit 25995 (this commit was missing a few LLVM libraries).

Swift SVN r26020
2015-03-12 02:00:55 +00:00
Adrian Prantl
ae3d758fa8 Adapt for Mach-O clang module container format transition.
NOTE: This may require deleting the Module Cache that build-script
       creates in the swift build dir.

Swift SVN r25995
2015-03-11 22:55:37 +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
Jordan Rose
5554cec143 [ClangImporter] Don't inherit initializers as designated...
...even if they were designated in the base class. (Unless they're required,
in which case they're still required.)

This led to Swift subclasses treating convenience initializers as
designated initializers, which (if synthesized) led to properties being
initialized twice.

rdar://problem/19730160

Swift SVN r25410
2015-02-20 02:26:55 +00:00
Doug Gregor
5e3d50f92c Stop defining CF_ENABLE_BRIDGED_TYPES[_SO_YOU_CAN_FIX_BUILD_FAILURES].
These macros are dead in the SDKs we care about.

Swift SVN r25325
2015-02-16 21:59:58 +00:00
Jordan Rose
c51004bf04 [ClangImporter] Don't try to load things if there's been a fatal Clang error.
This should help us avoid crashes like rdar://problem/19798049 in the future.
Of course, since fatal errors are so rare, I don't have a way to test this,
but it isn't breaking any of the paths we currently use.

rdar://problem/19827938

Swift SVN r25285
2015-02-13 22:43:12 +00:00
Ben Langmuir
518e6dc870 Remove unnecessary calculation of Clang's default module cache
Now that we use the Clang driver instead of cc1 we can make clang figure
out its own default module cache path if one isn't provided.

Swift SVN r24924
2015-02-03 20:34:41 +00:00
Denis Vnukov
cd0fe7192d Fix for rdar://18898671, Xcode 6.4-6D94: SourceKit crash in swift::ClangModuleUnit::getFilename()
Minor: ClangModuleUnit::getFilename() used to crash if clangModule->getASTFile() is nullptr



Swift SVN r24922
2015-02-03 20:31:05 +00:00
Ben Langmuir
791f2ff549 Utilize 'requires' feature of module maps to exclude frameworks from Swift
Adds a module feature 'swift' to the Clang arguments so that we can make
modules unavailable if they contain
  requires !swift

Swift SVN r24913
2015-02-03 01:49:05 +00:00
Dmitri Hrybenko
9ac070a545 Install Clang builtin headers in the Clang resource dir
Also, stop installing Clang builtin headers in Apple B&I builds.  We
will rely on real Clang headers.

Swift SVN r24675
2015-01-23 03:09:56 +00:00
Jordan Rose
8ee17a4d0d Serialize search paths when building an app, for a better debugging experience.
There's also a testing option, -serialize-debugging-options, to force this
extra info to be serialized even for library targets. In the long run we'll
probably write out this information for all targets, but strip it out of
the "public module" when a framework is built. (That way it ends up in the
debug info's copy of the module.)

Incidentally, this commit includes the ability to add search paths to the
Clang importer on the fly, which is most of rdar://problem/16347147.
Unfortunately there's no centralized way to add search paths to both Clang
/and/ Swift at the moment.

Part of rdar://problem/17670778

Swift SVN r24545
2015-01-20 03:02:54 +00:00
Jordan Rose
a3a6c2695b Put the current target into LangOptions.
This has been long in coming. We always had it in IRGenOpts (in string form).
We had the version number in LangOpts for availability purposes. We had to
pass IRGenOpts to the ClangImporter to actually create the right target.
Some of our semantic checks tested the current OS by looking at the "os"
target configuration! And we're about to need to serialize the target for
debugging purposes.

Swift SVN r24468
2015-01-16 02:48:54 +00:00
Jordan Rose
93a89467b8 [ClangImporter] Hide old API from the Carbon days.
This affects the MacTypes.h header in the Darwin module as well as the
CarbonCore and OSServices sub-frameworks of the CoreServices framework.
API hidden in this way can still be accessed through qualified lookup
in case it's really needed, but will not appear in the module interface
or in code completion.

This is a hack, and it would be nice to remove it if/when all of this API
is officially marked as deprecated. I did check with Nick for MacTypes.h
and Chris Linn from CoreServices that this was a reasonable action to take.

rdar://problem/16806148

Swift SVN r24424
2015-01-14 19:27:45 +00:00
Dmitri Hrybenko
d9ffea1604 Update for upstream changes in ObjCMethodList API
Swift SVN r24160
2014-12-28 07:36:05 +00:00
Joe Groff
6e74b5c21b IRGen: Base our clang::CodeGenOptions on those from the Clang instance.
Use the CodeGenOptions the Clang frontend determined for the compiler instance instead of starting from scratch, so that we pick up important settings like '-mstackrealign'. Fixes the GLKit test on iOS. rdar://problem/19180367

Swift SVN r23792
2014-12-08 23:29:27 +00:00
Argyrios Kyrtzidis
d9813b1bf5 [sdk-analyzer] Check if a clang decl was associated with a swift one from stdlib.
rdar://19063509

Swift SVN r23560
2014-11-23 05:51:26 +00:00
Argyrios Kyrtzidis
a72c0e50c2 [ClangImporter] Expose a couple of functions in ClangImporter.
- getClangSema()
- shouldIgnoreMacro() which returns true if it is expected that a clang macro is ignored.

Swift SVN r23468
2014-11-20 05:08:36 +00:00
Ben Langmuir
e9e1666ab0 Update for upstream LLVM changes
* removal of StringMap's GetOrCreateValue
* SmallSet::insert now returns a pair like std::set

Swift SVN r23435
2014-11-19 16:49:30 +00:00
Joe Groff
8aba14a353 ClangImporter: Learn about SWIFT_ENUM and Swift-originated ObjC enums.
This allows @objc enums to work in mixed-source frameworks.

Swift SVN r23426
2014-11-19 04:03:12 +00:00
Doug Gregor
9effe201f0 Adjust to api_notes::NullableKind -> clang::NullabilityKind renaming.
Synchronized with the Clang renaming of NullableKind.

Swift SVN r23315
2014-11-14 01:07:42 +00:00
Doug Gregor
420cf73385 Adjust to removal of NullableKind::Absent; it's captured by Optionals now.
Synchronized with Clang.

Swift SVN r23314
2014-11-14 01:07:38 +00:00
Doug Gregor
aa41a5ce1b Revert "Update uses of Clang's NullableKind -> Nullability."
This reverts commit ad91cc5b7f0482938397a40f81c4fafcd6718d2a.

Swift SVN r23290
2014-11-12 23:18:43 +00:00
Doug Gregor
f204351e7e Implement Clang importer support for finding Objective-C methods by selector.
This functionality doesn’t really change what we accept right now, because we eagerly import all of the methods of a class when we do *any* kind of lookup into the class. However, when we manage to stop doing that, this operation will become more important.

Swift SVN r23289
2014-11-12 23:18:42 +00:00
Doug Gregor
5c245f8a5a Update uses of Clang's NullableKind -> Nullability.
Synchronized with a Clang commit; please update your Clang along with Swift.

Swift SVN r23279
2014-11-12 18:15:55 +00:00
Chris Willmore
f723b05672 Don't remove 'with' from ObjC method arg name if resulting name is keyword.
Also, remove calls to isSwiftReservedName in
ClangImporter::Implementation::importName(), since 'true' and 'false'
are now keywords and rdar://problem/13187570 is no longer a problem.

rdar://problem/18797808

Swift SVN r23244
2014-11-11 19:34:53 +00:00
Jordan Rose
5aa60308a6 [ClangImporter] Don't mistake a module being built for our dummy buffer.
The ClangDiagnosticConsumer forwards diagnostics from Clang's diagnostic machinery
to Swift's. It deliberately filters out things that happen in our top-level dummy
buffer (usually trivial things like "module imported here"). Unfortunately, it was
doing so by checking against the current SourceManager's "main file". When building
Clang modules (compiling PCM files), we're dealing with a new SourceManager, whose
main file is the module map file.

Instead, just check against the (very unlikely) name of our dummy input file,
like we do for imported headers.

rdar://problem/18867749

Swift SVN r23121
2014-11-05 23:10:19 +00:00
Jordan Rose
39649f6eee [ClangImporter] Handle empty selector pieces for AnyObject method lookup.
Previously this resulted in a crash.

rdar://problem/18746476

Swift SVN r22981
2014-10-28 02:46:18 +00:00
Argyrios Kyrtzidis
bc26ff6c85 [ClangImporter] Since we can handle them now, enable clang diagnostic warnings in the importer.
Swift SVN r22728
2014-10-14 15:03:08 +00:00
Dmitri Hrybenko
d2d12d9932 ClangImporter: refactor construction of the Clang argument list
according to review comments

Swift SVN r22483
2014-10-02 22:25:39 +00:00
Jordan Rose
042569a3be Optional: Replace uses of Nothing with None.
llvm::Optional (like Swift.Optional!) uses None as its placeholder value,
not Nothing.

Swift SVN r22476
2014-10-02 18:51:42 +00:00
Dmitri Hrybenko
27601ff089 ClangImporter: use GNU11 C language mode on non-Darwin
Other platforms are assumed not to have an Objective-C runtime now.

Swift SVN r22460
2014-10-02 09:28:14 +00:00
Jordan Rose
49a6c8eb7b Do all target info management in Clang, and drop -target-abi / -target-feature.
Previously we hardcoded a few important default CPUs, ABIs, and features into
Swift's driver, duplicating work in Clang. Now that we're using Clang's
driver to create the Clang "sub-compiler", we can delegate this work to Clang.

As part of this, I've dropped the options for -target-abi (which was a
frontend-only option anyway) and -target-feature (which was a hidden driver
option and is a frontend-only option in /Clang/). We can revisit this later
if it becomes interesting. I left in -target-cpu, which is now mapped
directly to Clang's -mcpu=.

Swift SVN r22449
2014-10-01 23:55:40 +00:00
Jordan Rose
30c65eff7e [ClangImporter] Use Clang's driver to handle options, not its frontend.
This is most important for -Xcc options, which shouldn't be dependent on
the underlying Clang version, but it also affects things like target features
that Clang knows how to compute correctly and Swift, well, doesn't.

rdar://problem/17687572

Swift SVN r22448
2014-10-01 23:55:35 +00:00
Graham Batty
a1e0b0fbf7 Driver: More stubbing for Linux support
Swift SVN r22362
2014-09-29 21:14:32 +00:00
Anna Zaks
317f809bcd API Notes: Fix several bugs that effect availability info propagation.
- Merge availability info by merging CommonEntityInfo as part of ObjCContextInfo.
 - Don't try to add Absent nullability to property setters (since it cannot be
   represented by ObjCMethodInfo).
 - Factor out lookupObjCContext and make sure we always look up in both
   class and protocol.

This will be tested by API notes drop, which will get committed separately.

Swift SVN r22089
2014-09-18 18:51:47 +00:00
Jordan Rose
ff59af1e69 Only test that all SourceManager buffers are valid when actually still valid.
Some of the buffers are owned by the ClangImporter, so after the
ClangImporter's been deallocated, the SourceManager isn't going to be fully
valid any more.

Should fix issues from r21958.

Swift SVN r21989
2014-09-16 22:41:27 +00:00
Doug Gregor
c1399cf229 Allow SDK overlays to add 'required' initializers.
Removes the initWithBool: hack from the Clang importer. We can now
express NSNumber's conformance to the BooleanLiteralConvertible
protocol in the overlay.

Swift SVN r21976
2014-09-16 17:09:58 +00:00
Doug Gregor
d93eaed9f7 Switch BooleanLiteralConvertible over to an initializer requirement.
Conforming to BooleanLiteralConvertible now requires

  init(booleanLiteral: Bool)

rather than

  static func convertFromBooleanLiteral(value: Bool) -> Self

This posed a problem for NSNumber's conformance to
BooleanLiteralConvertible. A class needs a required initializer to
satisfy an initializer requirement, but one cannot add a required
initializer via an extension. To that end, we hack the Clang importer
to import NSNumber's initWithBool with the name

  init(booleanLiteral:)

and add back the expected init(bool:) initializer in the
overlay. These tricks make NSNumber even harder to subclass, but we
don't really care: it's nearly impossible to do well anyway, and is
generally a Bad Idea.

Part of rdar://problem/18154091.

Swift SVN r21961
2014-09-15 23:59:30 +00:00
Argyrios Kyrtzidis
0b4df546a4 Revert "[ClangImporter] Use a constant for the name of the module created for the imported header."
Once can use ClangModuleLoader::getImportedHeaderModule() to check if the module is the importer-header module.

This reverts commit r21949.

Swift SVN r21955
2014-09-15 21:25:13 +00:00
Argyrios Kyrtzidis
c3757ae582 [ClangImporer] Expose ClangImporter::getImportedHeaderModule() via the ClangModuleLoader interface.
Swift SVN r21953
2014-09-15 21:22:37 +00:00
Argyrios Kyrtzidis
8ec13a169d [ClangImporter] Use a constant for the name of the module created for the imported header.
Swift SVN r21949
2014-09-15 19:51:07 +00:00
Jordan Rose
167d2f4bbb Include extensions in ClangModuleUnit::getTopLevelDecls.
We don't do this very efficiently, but it does work. And now that it's working,
drop some special cases in module interface printing -- just always print
Clang decls in Clang source order.

Swift SVN r21901
2014-09-12 02:54:50 +00:00
Adrian Prantl
fb1fb614d2 Update for upstream LLVM API change (unique_ptr).
Swift SVN r21843
2014-09-10 17:26:38 +00:00
Joe Groff
487f9a96ca Quell warning.
Swift SVN r21831
2014-09-10 05:56:39 +00:00
Jordan Rose
7b6a0dd185 [ClangImporter] Add a mode where @class decls are imported as empty classes.
This can be used by SourceKit's interface printer to display modules with
forward declarations of classes in dependent modules, e.g. ObjectiveC
forward-declaring Foundation's NSString for use in NSObject. We can consider
doing something similar for C tag types (structs and enums).

Part of rdar://problem/18273845

Swift SVN r21828
2014-09-10 02:32:53 +00:00