Files
swift-mirror/test/ClangImporter/Inputs/custom-modules/ImportAsMember.h
Allan Shortlidge e867788d65 ClangImporter: Introduce the #ClangDeclarationImport diagnostic group.
The warnings that ClangImporter emits about issues it encounters while
importing declarations from Clang modules should all belong to a diagnostic
group so that users of `-warnings-as-errors` can control their behavior using
the compiler flags introduce with SE-0443. It's especially important that these
diagnostics be controllable since they are often caused by external
dependencies and therefore the developer may not have any control over whether
they are emitted.

The `#ClangDeclarationImport` diagnostic group is intentionally broad so that
developers have a way to control all of these diagnostics with a single
`-Wwarning` flag. I fully expect that we'll introduce finer-grained diagnostic
groups for some of these diagnostics in the future, but those groups should be
hierarchically nested under `#ClangDeclarationImport`, which is supported by
SE-0443.

Resolves rdar://150524204.
2025-05-05 14:19:04 -07:00

85 lines
3.5 KiB
Objective-C

#ifndef IMPORT_AS_MEMBER_H
#define IMPORT_AS_MEMBER_H
struct __attribute__((swift_name("Struct1"))) IAMStruct1 {
double x, y, z;
};
extern double IAMStruct1GlobalVar
__attribute__((swift_name("Struct1.globalVar")));
extern struct IAMStruct1 IAMStruct1CreateSimple(double value)
__attribute__((swift_name("Struct1.init(value:)")));
extern struct IAMStruct1 IAMStruct1CreateSpecialLabel(void)
__attribute__((swift_name("Struct1.init(specialLabel:)")));
extern struct IAMStruct1 IAMStruct1CreateFull(double x, double y, double z)
__attribute__((swift_name("Struct1.init(x:y:z:)")));
extern struct IAMStruct1 IAMStruct1Invert(struct IAMStruct1 s)
__attribute__((swift_name("Struct1.inverted(self:)")));
extern void IAMStruct1InvertInPlace(struct IAMStruct1 *s)
__attribute__((swift_name("Struct1.invert(self:)")));
extern struct IAMStruct1 IAMStruct1Rotate(const struct IAMStruct1 *s,
double radians)
__attribute__((swift_name("Struct1.translate(self:radians:)")));
extern struct IAMStruct1 IAMStruct1Scale(struct IAMStruct1 s,
double radians)
__attribute__((swift_name("Struct1.scale(self:_:)")));
extern double IAMStruct1GetRadius(const struct IAMStruct1 *s)
__attribute__((swift_name("getter:Struct1.radius(self:)")));
extern void IAMStruct1SetRadius(struct IAMStruct1 s, double radius)
__attribute__((swift_name("setter:Struct1.radius(self:_:)")));
extern double IAMStruct1GetAltitude(struct IAMStruct1 s)
__attribute__((swift_name("getter:Struct1.altitude(self:)")));
extern void IAMStruct1SetAltitude(struct IAMStruct1 *s, double altitude)
__attribute__((swift_name("setter:Struct1.altitude(self:_:)")));
extern double IAMStruct1GetMagnitude(struct IAMStruct1 s)
__attribute__((swift_name("getter:Struct1.magnitude(self:)")));
extern int IAMStruct1StaticMethod(void)
__attribute__((swift_name("Struct1.staticMethod()")));
extern int IAMStruct1StaticGetProperty(void)
__attribute__((swift_name("getter:Struct1.property()")));
extern int IAMStruct1StaticSetProperty(int i)
__attribute__((swift_name("setter:Struct1.property(i:)")));
extern int IAMStruct1StaticGetOnlyProperty(void)
__attribute__((swift_name("getter:Struct1.getOnlyProperty()")));
extern void IAMStruct1SelfComesLast(double x, struct IAMStruct1 s)
__attribute__((swift_name("Struct1.selfComesLast(x:self:)")));
extern void IAMStruct1SelfComesThird(int a, float b, struct IAMStruct1 s, double x)
__attribute__((swift_name("Struct1.selfComesThird(a:b:self:x:)")));
struct IAMMultipleNested {
int value;
};
typedef int MNInnerInt __attribute__((swift_name("IAMMultipleNested.Inner")));
typedef float MNInnerFloat __attribute__((swift_name("IAMMultipleNested.Inner")));
typedef int IAMBadInnerInt
__attribute__((swift_name("IAMNonexistent.Inner")));
// CHECK: ImportAsMember.h:[[@LINE-1]]:{{[0-9]+}}: warning: imported declaration 'IAMBadInnerInt' could not be mapped to 'IAMNonexistent.Inner' [#ClangDeclarationImport]
// CHECK: note: please report this issue to the owners of 'ImportAsMember' [#ClangDeclarationImport]
typedef int IAMBadInnerIntAPINotes;
// CHECK: ImportAsMember.h:[[@LINE-1]]:{{[0-9]+}}: warning: imported declaration 'IAMBadInnerIntAPINotes' could not be mapped to 'IAMNonexistent.Inner2'
// CHECK: note: please report this issue to the owners of 'ImportAsMember'
@interface IAMPrivateParent @end
@interface IAMPrivateChild
- (instancetype)init;
@end
#endif // IMPORT_AS_MEMBER_H