Commit Graph

35 Commits

Author SHA1 Message Date
Michael Spencer
b2640e15e4 [test] Rename all module.map files to module.modulemap
`module.map` as a module map name has been discouraged since 2014, and
Clang will soon warn on its usage. This patch renames all instances of
`module.map` in the Swift tests to `module.modulemap` in preparation
for this change to Clang.

rdar://106123303
2023-08-21 15:58:59 -07:00
Ingmar Stein
28c141ff63 [ClangImporter] restrict import of macros with typedef'ed casts (#3676)
Import only casts with builtin canonical types to make sure they can be
typechecked.
2016-07-22 17:21:12 -07:00
IngmarStein
48079e7f25 [ClangImporter] fix crash when importing macros with bitwise operators
Fix an assertion which is triggered when the operands of a bitwise operator have different signedness.
This is done by promoting the operands to the largest bit width (taking sign/zero extension into account) and ignoring the signedness for the operation itself.
2016-07-21 13:44:22 +02:00
IngmarStein
e5cd80e21f [ClangImporter] import macros with type casts for some builtin types
This builds on #2538 by adding support for builtin types in addition to typedefs.
2016-07-05 15:33:40 +02:00
IngmarStein
31ab594b16 [ClangImporter] check bit width for bitwise operators 2016-06-29 23:01:30 +02:00
Ingmar Stein
11f1d96d23 Import macros of the form "FLAG1 | FLAG2" and "FLAG1 & FLAG2"
This commit adds a map to ClangImporter::Implementation to remember macros that were imported as constants in order to reuse the calculated values.
2016-06-29 23:01:30 +02:00
Ingmar Stein
4f800f8a21 [ClangImporter] Import preprocessor constants with a cast
Addresses SR-1509 by adding a heuristic to import numeric literals with a
type cast. Two new cases have been added for macros with 4 or 5 tokens
to cover cases with or without sign tokens.
2016-06-29 23:01:30 +02:00
Jordan Rose
50e3b33739 [ClangImporter] Implement importing of ObjC class properties.
For the most part this was just "check isInstanceProperty"; the one feature not yet implemented
is the emission of ObjC metadata for class properties.

rdar://problem/16830785
2016-03-31 14:27:56 -07:00
Xi Ge
1604c4ba9e [ClangImporter] Import variadic C functions as unavailable functions instead of ignoring them. rdar://16677468
Also, this helps us fix rdar://20092567.

Swift SVN r32903
2015-10-27 00:29:44 +00:00
Xi Ge
e1331252a3 [ClangModulePrint] If skipping an unavailable decl, skipping its following regular comments too. rdar://20092567
This only works for Clang-imported but unavailable decls, but not for Clang decls that
are not imported.

Swift SVN r32769
2015-10-20 00:19:40 +00:00
Jordan Rose
498ab24341 [ClangImporter] Allow performSelector... methods, but make the result Unmanaged.
Per discussion, there are certain times where our APIs really want you to use
the performSelector family of methods (e.g. when the framework hands you a selector
and expects you to call it upon completion).

Although the methods still aren't type-safe, we are at least making the result
Unmanaged so that you're forced to think about whether it's +1 or +0 before you
use it, and so that the compiler doesn't accidentally try to retain a non-object
pointer.

This commit also removes the blocks on the makeObjectsPerformSelector... methods,
but Foundation plans to add NS_SWIFT_UNAVAILABLE there (see rdar://problem/21150180).

rdar://problem/21150277

Swift SVN r30044
2015-07-09 22:54:41 +00:00
Argyrios Kyrtzidis
7e61a77d11 [module-interface] Add "/*not inherited*/" in-front of factory initializers to distinguish
those from normal initializers in a clear manner.

rdar://20044672

Swift SVN r28400
2015-05-10 19:03:20 +00:00
John McCall
2ff77a9cd1 Only import *Ref typedefs as CF types if they have a bridging
attribute or appear in a whitelist.

The initial whitelist is based on an audit I performed of our current
public SDKs.  If there are CF types which appear only in our internal
SDKs, and somebody urgently needs to use them from Swift, they can
adopt the bridging attributes.  The goal is to eventually eliminate
the whitelist and rely solely on bridging attributes anyway.

Sadly, CoreCooling was not included in my SDK audit and must be
explicitly annotated. :(

I've left the main database organized by framework, but I wanted
a quasi-lexicographically sorted version to permit efficient lookup.
We generate that copy automatically with gyb.  I ended up having
to tweak handle_gyb_sources to allow it to drop the result in
CMAKE_CURRENT_BINARY_DIR instead of CMAKE_CURRENT_BINARY_DIR/{4,8}
if an architecture is not provided.  I think this is abstractly
reasonable for generated includes, which have independent ability
to detect the target word size.  But just between you and me,
I did it because I couldn't figure out how to add
"-I${CMAKE_CURRENT_BINARY_DIR/{4,8}" as a compile flag;
the obvious thing didn't work.  Anyway, I'd appreciate it if
someone double-checked my cmake hackery here.

Swift SVN r24850
2015-01-30 18:39:07 +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
Jordan Rose
904264544d [ClangImporter] Preserve all of Clang's availability attribute information.
This completes <rdar://problem/17024498>, except that we don't yet do
anything with 'deprecated' or 'obsoleted'. The former is covered by
<rdar://problem/17406050>, and I filed <rdar://problem/17873422> for the
latter.

Swift SVN r20845
2014-07-31 18:58:18 +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
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
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
Argyrios Kyrtzidis
be7e6653fd [IDE] Don't print inherited types and conformances that start with underscore,
if PrintOptions.SkipLeadingUnderscoreDecls is enabled.

Swift SVN r17762
2014-05-09 06:10:22 +00:00
Argyrios Kyrtzidis
420db0b38e [IDE/test] Add an initializer in mock-sdk.
Swift SVN r16918
2014-04-27 05:33:42 +00:00
Dmitri Hrybenko
0bfcd45eb7 Clang importer: import noreturn attribute on free functions
rdar://16630302


Swift SVN r16522
2014-04-18 14:40:02 +00:00
Argyrios Kyrtzidis
a9ea63a7f7 [IDE/ModuleInterface] Adjust the indentation of regular comments to match the current indentation level.
Swift SVN r16362
2014-04-15 06:27:40 +00:00
Argyrios Kyrtzidis
31a620f1ee [IDE/ModuleInterface] Fix erroneously printed newline between a regular comment and the declaration it is 'attached' to.
Swift SVN r16293
2014-04-14 03:28:05 +00:00
Argyrios Kyrtzidis
ba30e56b58 [IDE] When picking regular comments from clang headers, make sure that extensions/categories
are printed in the right source location otherwise the comments will be out-of-place.

Swift SVN r16271
2014-04-13 04:35:29 +00:00
Argyrios Kyrtzidis
4c91bd074f [IDE] Print out regular comments from the clang module headers, for the module interface.
rdar://16451119

Swift SVN r16249
2014-04-12 05:21:08 +00:00
Dmitri Hrybenko
c5d47d5578 Add a test that we don't import plain function pointer types
Swift SVN r16206
2014-04-11 09:45:19 +00:00
Dmitri Hrybenko
e68fd4abd3 AST printer: add an option to hide 'override' keywords
rdar://16530754


Swift SVN r16162
2014-04-10 14:27:00 +00:00
Dmitri Hrybenko
cc30070f68 AST printer: add an option to suppress @unchecked in imported declarations
This is rdar://16530754.  For @unchecked in code completion see
rdar://16576739.


Swift SVN r16156
2014-04-10 10:40:30 +00:00
Argyrios Kyrtzidis
3a60b89d95 [ClangImporter] Don't import include guard macros.
This depends on clang r205917.
rdar://16555519

Swift SVN r16126
2014-04-09 19:53:31 +00:00
Dmitri Hrybenko
0fdaf47fed IDE tests: extend the mock framework so that it can be reused in SourceKit
Swift SVN r15787
2014-04-02 12:39:53 +00:00
Dmitri Hrybenko
7514b8a9b4 IDE tests: consolidate test clang modules into an existing mock SDK
Swift SVN r15786
2014-04-02 11:16:24 +00:00
Dmitri Hrybenko
efb2a60ee7 Module interface printing: add a libIDE API to print a Clang submodule
Swift SVN r15730
2014-04-01 14:51:58 +00:00
Dmitri Hrybenko
a3bb62d619 AST printing: print imports of submodules while printing Clang modules
Swift SVN r11165
2013-12-12 00:56:20 +00:00
Dmitri Hrybenko
e27001dbc7 Clang importer: determine the module for enums correctly while importing enum's
decl context


Swift SVN r11039
2013-12-09 22:19:47 +00:00
Dmitri Hrybenko
a6519a907d Code completion: implement code completion for dot member access on clang modules
Because we don't want FooModule.#^A^# to show completion results for other
clang modules, global completion cache was replaced with a per-module cache.


Swift SVN r6951
2013-08-06 21:15:23 +00:00