Commit Graph

11 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
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
1b1a4cb22e [PrintAsObjC] Use enum_extensibility to represent @_frozen
Previously (a03c40cb2c) we assumed all Swift enums were non-frozen in
ObjC, a weird choice in retrospect. Now that we actually distinguish
frozen and non-frozen enums in Swift, we can use the
'enum_extensibility' attribute to mark them as open or closed in ObjC.

Note that this only matters for Swift libraries compiled with
-enable-resilience, i.e. those that might get a new implementation at
runtime. Everyone else is now declaring a "closed" enum, matching the
behavior in Swift.
2018-03-20 14:49:11 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Doug Gregor
80e9491fe3 Make Swift-3-inferred @objc explicit in test cases 2017-03-31 21:22:15 -07:00
Xi Ge
143c5a5d82 Address @jrose-apple's code review comments (#7474) 2017-02-14 18:41:21 -08:00
Tim Bodeit
96c964ee0d [test/PrintAsObjc] Adjust existing test cases for SWIFT_WARN_UNUSED_RESULT 2016-12-10 01:48:49 +01:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Jordan Rose
1bdd092cd9 [PrintAsObjC] Use C names when printing imported structs.
(and enums)

Previously this part of the compiler assumed that any imported
struct or enum would have the same name as it does in C, which is
no longer true.

Part of rdar://problem/26372925
2016-05-25 11:34:02 -07:00