Commit Graph

10 Commits

Author SHA1 Message Date
Becca Royal-Gordon
da07ff577c [PrintAsClang] Warn about unstable decl order
PrintAsClang is supposed to emit declarations in the same order regardless of the compiler’s internal state, but we have repeatedly found that our current criteria are inadequate, resulting in non-functionality-affecting changes to generated header content. Add a diagnostic that’s emitted when this happens soliciting a bug report.

Since there *should* be no cases where the compiler fails to order declarations, this diagnostic is never actually emitted. Instead, we test this change by enabling `-verify` on nearly all PrintAsClang tests to make sure they are unaffected.

This did demonstrate a missing criterion that only mattered in C++ mode: extensions that varied only in their generic signature were not sorted stably. Add a sort criterion for this.
2025-02-14 21:41:36 -08:00
Jordan Rose
e34a6a1105 [PrintAsObjC] Look through "compatibility" typealiases (#20027)
These handle imported types that have been renamed in a /later/ Swift
version than the one being used; for consistency when deserializing
from a swiftmodule, the latest name is always used. This is important
because it might mean we can avoid importing the framework that a name
comes from; a forward declaration might be sufficient if it's an ObjC
class or protocol.

rdar://problem/45491607
2018-10-25 08:26:17 -07:00
Doug Gregor
f39fe1a755 [Tests] Put NSObject Equatable/Hashable back in the ObjectiveC module.
Technically, these operations belong in the ObjectiveC module, where NSObject
is defined. Keep them there. However, we need to build the mock ObjectiveC
overlay with `-disable-objc-attr-requires-foundation-module` now.
2018-08-01 09:25:28 -07:00
Jordan Rose
6ecfe7a34d Merge pull request #17917 from jrose-apple/t3sts
[test] Update APINotes, Serialization, and PrintAsObjC tests for Swift 3 removal
2018-07-13 10:24:42 -07:00
Jordan Rose
480e02b0cf [test] Update PrintAsObjC test (just one) for Swift 3 removal
Use Swift 4 as the "old" version instead of Swift 3.
2018-07-12 15:44:10 -07:00
Mani Ramezan
9df5adb150 Move mock Foundation framework into clang shared folder 2018-07-11 02:32:59 -04:00
Saleem Abdulrasool
b67d5f0cf7 test: convert rm -rf && mkdir -p into %empty-directory
This converts the instances of the pattern for which we have a proper
substitution in lit.  This will make it easier to replace it
appropriately with Windows equivalents.
2018-03-06 14:30:54 -08:00
Jordan Rose
bd0cb3de8a [PrintAsObjC] Silence -Wnullability for the generated declarations. (#10247)
Since Swift 3 and Swift 4 might have different views of an Objective-C
API's nullability, we can end up with incompatible overrides,
including with inherited initializers. This is unfortunate but also
realistic; the Swift 3 code is /not/ set up to handle the new nullability
used by Swift 4 and Objective-C. Just silence the warning.

(It would be nice to not print inherited initializers at all, but that
would mean making sure there are no convenience initializers we have
to print as well. Otherwise the class would get mistaken for one
without explicit designated initializers.)

rdar://problem/32571301
2017-06-14 13:50:06 -07:00
Jordan Rose
eb9f047ad8 [PrintAsObjC] Handle the importer's compatibility typealiases. (#10042)
These are TypeAliasDecls whose Clang nodes are not TypedefNameDecls.
This worked all right for classes, but dropped the tag keyword
(e.g. 'struct') for tag decls with names of their own, and didn't
print any name at all for C types that used the
typedef-for-anonymous-tag pattern.

rdar://problem/32514335
2017-06-01 15:28:44 -07:00
Doug Gregor
b610a509fc [PrintAsObjC] Handle typealiases to non-type Clang declarations.
For historic reasons, Clang's representation of an Objective-C class
declaration ObjCInterfaceDecl) and compatibility alias
(ObjCCompatibleAliasDecl) are not actually Clang TypeDecl nodes. Cope
with this in Objective-C printing, fixing rdar://problem/32308192.
2017-05-19 21:57:41 -07:00