Commit Graph

1220 Commits

Author SHA1 Message Date
Mark Lacey
182b6dfb18 Merge remote-tracking branch 'origin/master' into master-next
Conflicts:
	tools/driver/CMakeLists.txt
	tools/swift-reflection-dump/swift-reflection-dump.cpp
2016-05-03 14:23:20 -07:00
Chris Willmore
af0c7bd620 Initial implementation of SE-0054 "Abolish IUO Type" (#2322)
This is a squash of the following commits:

* [SE-0054] Import function pointer arg, return types, typedefs as optional

IUOs are only allowed on function decl arguments and return types, so
don't import typedefs or function pointer args or return types as IUO.

* [SE-0054] Only allow IUOs in function arg and result type.

When validating a TypeRepr, raise a diagnostic if an IUO is found
anywhere other thn the top level or as a function parameter or return
tpye.

* [SE-0054] Disable inference of IUOs by default

When considering a constraint of the form '$T1 is convertible to T!',
generate potential bindings 'T' and 'T?' for $T1, but not 'T!'. This
prevents variables without explicit type information from ending up with
IUO type. It also prevents implicit instantiation of functions and types
with IUO type arguments.

* [SE-0054] Remove the -disable-infer-iuos flag.

* Add nonnull annotations to ObjectiveCTests.h in benchmark suite.
2016-05-03 14:06:19 -07:00
Ryan Lovelett
0c0bcbb094 Convert "armv7l" to "armv7" for the architecture component of paths (#2369)
On the Raspberry Pi 2 when trying to import Glibc, without this patch, it will attempt to
find the module map at "/usr/lib/swift/linux/armv7l/glibc.modulemap" and
fail to do so.

With this patch it will attempt to find the module map at
"/usr/lib/swift/linux/armv7/glibc.modulemap" where it will succeed in
finding the module map.

Similar behavior currently happens in the Driver and Frontend. To DRY up
this behavior it has been extracted to the Swift platform.
2016-05-02 15:25:58 -07:00
Jordan Rose
8f820dea2b [serialization] Diagnose loading modules from older Swifts.
...with a better message than the generic "older version of the
compiler" one, when we know it's actually a different version of
Swift proper.

This still uses the same internal module version numbers to check
if the module is compatible; the presentation of language versions
is a diagnostic thing only.

Speaking of module version numbers, this deliberately does NOT
increment VERSION_MINOR; it's implemented in a backwards-compatible
way.

This will only work going forwards, of course; all existing modules
don't have a short version string, and I don't feel comfortable
assuming all older modules we might encounter are "Swift 2.2".

rdar://problem/25680392
2016-04-29 16:25:33 -07:00
Doug Gregor
b6c68449a7 [Omit needless words] Don't avoid keywords that will be allowed after '.'.
In anticipation of SE-0071, teach the Clang importer to only avoid
dynamicType/self/Protocol/init as base names. Fixes
rdar://problem/25399965.
2016-04-26 17:02:35 -07:00
Joe Groff
825e02e2f1 Remove -enable-import-objc-generics staging flag. 2016-04-25 14:25:11 -07:00
Joe Groff
c49a992598 Turn on import of ObjC generics. 2016-04-25 11:56:13 -07:00
Michael Gottesman
0c1f6db23b [upstream-update] Add our own LLVM global context now that llvm::getGlobalContext() was removed upstream.
Swift relies on this for now. So create our own. This makes more sense
than trying to add back in the API (which is dead besides the c api) or
use the c api itself. We should probably consider not using a global
context like this.
2016-04-18 07:29:58 -07:00
Zhuowei Zhang
7c502b6344 Port to Android
This adds an Android target for the stdlib. It is also the first
example of cross-compiling outside of Darwin.

Mailing list discussions:

1. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151207/000171.html
2. https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000492.html

The Android variant of Swift may be built using the following `build-script`
invocation:

```
$ utils/build-script \
  -R \                                           # Build in ReleaseAssert mode.
  --android \                                    # Build for Android.
  --android-ndk ~/android-ndk-r10e \             # Path to an Android NDK.
  --android-ndk-version 21 \
  --android-icu-uc ~/libicu-android/armeabi-v7a/libicuuc.so \
  --android-icu-uc-include ~/libicu-android/armeabi-v7a/icu/source/common \
  --android-icu-i18n ~/libicu-android/armeabi-v7a/libicui18n.so \
  --android-icu-i18n-include ~/libicu-android/armeabi-v7a/icu/source/i18n/
```

Android builds have the following dependencies, as can be seen in
the build script invocation:

1. An Android NDK of version 21 or greater, available to download
   here: http://developer.android.com/ndk/downloads/index.html.
2. A libicu compatible with android-armv7.
2016-04-12 19:26:21 -04:00
Slava Pestov
a3d5d5cc2c Add mangling for externally inlineable specializations
An upcoming change has the SIL Optimizer drop the [fragile]
attribute from the specialized callee, unless the caller
is itself [fragile].

Since we need to distinguish specializations from fragile
and non-fragile contexts, add a new mangling node to
represent this concept.
2016-04-08 02:10:31 -07:00
Anna Zaks
92fae2e9a4 Add experimental support for Thread Sanitizer.
This patch threads the TSan option through the front end.
2016-04-06 11:53:43 -07:00
practicalswift
abfecfde17 [gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y] 2016-04-04 16:22:11 +02:00
swift-ci
48543ed7e7 Merge pull request #1986 from danra/use_algorithm_max 2016-03-31 18:57:11 -07:00
Dan Raviv
5082ae7f3b Use constexpr max from Swift/Basic/Algorithm instead of reimplementing it 2016-03-31 21:05:34 +03:00
Chris Lattner
821c2cb98f Merge pull request #1796 from danra/swift_basic_sanitize
Canonicalize swift header files headers and footers
2016-03-29 17:31:53 -07:00
danra
0c84db9507 Fix methods return type ampersand location (NFC) 2016-03-30 00:19:33 +03:00
practicalswift
c015b6eb47 Merge pull request #1906 from practicalswift/gardening-20160328b
[gardening] Remove unused code, fix PEP 8 regression, fix typos.
2016-03-28 23:16:28 +02:00
practicalswift
ce62c46207 [gardening] Fix recently introduced typo: "desireable" → "desirable" 2016-03-28 21:52:02 +02:00
Chris Willmore
3bcb169f0b Import lightweight Objective-C generics as Swift generic type
parameters.
2016-03-28 09:50:30 -07:00
Ted Kremenek
cc9d134e0e Merge pull request #1872 from danra/demangle-printer-no-dangling-ref
Refactor DemanglePrinter to eliminate the possibility of storing a da…
2016-03-26 13:47:07 -07:00
Michael Gottesman
cef48078d7 Merge pull request #1863 from danra/patch-45
Add constexpr version of maximum
2016-03-26 12:35:46 -07:00
Dmitri Gribenko
79a6f33213 Merge pull request #1868 from danra/patch-32-fix
operator!= DRY
2016-03-25 22:36:23 -07:00
Jordan Rose
90f91a4219 Merge pull request #1842 from danra/patch-37
Fix includes order - system should follow local
2016-03-25 16:47:12 -07:00
Michael Ilseman
b01caa01c6 Merge remote-tracking branch 'origin/master' into import-as-member 2016-03-25 15:47:47 -07:00
Dan Raviv
703cd37067 Add missing periods in comments (NFC) 2016-03-25 14:14:19 -07:00
danra
17dc943081 Fix includes order 2016-03-25 14:14:19 -07:00
Dan Raviv
8b2028d630 Add missing word in DiverseListImpl comment 2016-03-25 14:14:19 -07:00
John McCall
0afd09eaf3 Only use metadata patterns for generic types; perform other
initialization in-place on demand.  Initialize parent metadata
references correctly on struct and enum metadata.

Also includes several minor improvements related to relative
pointers that I was using before deciding to simply switch the
parent reference to an absolute reference to get better access
patterns.

Includes a fix since the earlier commit to make enum metadata
writable if they have an unfilled payload size.  This didn't show
up on Darwin because "constant" is currently unenforced there in
global data containing relocations.

This patch requires an associated LLDB change which is being
submitted in parallel.
2016-03-25 14:14:19 -07:00
danra
f2a339386c Use auto instead of repeating explicit class names 2016-03-25 14:14:19 -07:00
danra
4e11ce58c5 Use auto instead of repeating explicit class names 2016-03-25 14:14:19 -07:00
danra
c76cd68811 operator!= DRY 2016-03-25 14:14:19 -07:00
danra
bb3631dbd0 Remove redundant else 2016-03-25 14:14:19 -07:00
danra
d1250857fd Add missing period in comment 2016-03-25 14:14:19 -07:00
danra
5a1da59741 Compact getEnd implementation 2016-03-25 14:14:19 -07:00
danra
ed31834229 isInvalid methods DRY 2016-03-25 14:14:19 -07:00
danra
d8cb0b664a Remove extra spaces in empty-body ctors
Currently some empty-body ctors in the file have a space, some don't. Canonized it.
2016-03-25 14:14:19 -07:00
danra
f77393c06b operator!= DRY 2016-03-25 14:14:19 -07:00
danra
6f195f025a move copy-append before move-append overload
This is consistent with the usual convention of having copy methods before move methods (which is also used in this file in previous methods).
2016-03-25 14:14:19 -07:00
danra
2272897c5d Improve template typenames consistency
Rename BlotMapVector's template typenames: MapTy -> MapT and VectorTy -> VectorT. This is consistent both with BlotMapVector's other template typename KeyT and ValueT, and with SmallBlotMapVector's MapT and VectorT template typenames.
2016-03-25 14:14:19 -07:00
Dan Raviv
89545329b5 Consistently name stacks as 'stack' instead of 'queue'
Currently some stacks are named 'stack' and some are named 'queue' with a comment saying 'actually a stack'. Just call these a 'stack' as well.
2016-03-25 21:26:45 +03:00
Dan Raviv
3948212413 Refactor DemanglePrinter to eliminate the possibility of storing a dangling reference.
Before the refactor, a dangling reference to a string may be stored in a DemanglePrinter in at least the following cases:
1) If an lvalue DemanglePrinter is initialized with an rvalue string:
DemanglePrinter printer("abc");
2) If an lvalue DemanglePrinter is initialized with an lvalue string which doesn't live as long as the printer:
unique_ptr<DemanglePrinter> printer;
{
  std::string s = "abc";
  printer = make_unique<DemanglePrinter>(s);
}
// Reference stored in printer is dangling

In addition, in all existing cases in the code where an lvalue DemanglePrinter is used, an empty string is initialized just before it, which isn't DRY, and is related to the previous problem - the coder shouldn't be expected to maintain the lifetime of a string separate from the DemanglePrinter which references it.

In addition, before the refactor, in any in-line use of DemanglePrinter it is constructed with an empty string parameter (in which to construct the string), but this doesn't look very clean.

The refactor solves the above issues by maintaining its own string as a member, while still enabling the original intent of being able to use DemanglePrinter both as an lvalue constructively before getting its value, and in-line as an rvalue.
2016-03-25 16:11:53 +03:00
Dan Raviv
28491f3f03 Add missing periods in comments (NFC) 2016-03-25 12:02:13 +03:00
Dan Raviv
3a46559c1b operator!= DRY 2016-03-25 11:55:49 +03:00
Dmitri Gribenko
e9ab667e3a Merge pull request #1811 from danra/patch-21
move copy-append before move-append overload (NFC)
2016-03-25 00:51:27 -07:00
Dmitri Gribenko
70e4354868 Merge pull request #1787 from danra/patch-13
Improve template typenames consistency
2016-03-25 00:51:06 -07:00
Dmitri Gribenko
47fe51ddd0 Merge pull request #1836 from danra/patch-31
operator!= DRY
2016-03-25 00:48:54 -07:00
Chris Lattner
833f73a00b Merge pull request #1838 from danra/patch-33
Remove extra spaces in empty-body ctors
2016-03-24 22:52:59 -07:00
Chris Lattner
e0c9c1a163 Merge pull request #1840 from danra/patch-35
Compact getEnd implementation
2016-03-24 22:52:22 -07:00
Chris Lattner
d968c4dbf6 Merge pull request #1841 from danra/patch-36
Add missing period in comment
2016-03-24 22:50:49 -07:00
Chris Lattner
96dea07bdd Merge pull request #1848 from danra/patch-42
Use auto instead of repeating explicit class names
2016-03-24 22:38:54 -07:00