Skip to content

Commit e367131

Browse files
committed
[interop][SwiftToCxx] disable -Wnon-modular-include-in-framework-module diagnostic before including ptrauth
1 parent e7603eb commit e367131

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

lib/PrintAsClang/PrintAsClang.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,24 @@ static void emitObjCConditional(raw_ostream &out,
5959

6060
static void writePtrauthPrologue(raw_ostream &os) {
6161
emitCxxConditional(os, [&]() {
62-
os << "#if defined(__arm64e__) && __has_include(<ptrauth.h>)\n";
63-
os << "# include <ptrauth.h>\n";
64-
os << "#else\n";
6562
ClangSyntaxPrinter(os).printIgnoredDiagnosticBlock(
66-
"reserved-macro-identifier", [&]() {
67-
os << "# ifndef __ptrauth_swift_value_witness_function_pointer\n";
68-
os << "# define __ptrauth_swift_value_witness_function_pointer(x)\n";
69-
os << "# endif\n";
70-
os << "# ifndef __ptrauth_swift_class_method_pointer\n";
71-
os << "# define __ptrauth_swift_class_method_pointer(x)\n";
72-
os << "# endif\n";
63+
"non-modular-include-in-framework-module", [&] {
64+
os << "#if defined(__arm64e__) && __has_include(<ptrauth.h>)\n";
65+
os << "# include <ptrauth.h>\n";
66+
os << "#else\n";
67+
ClangSyntaxPrinter(os).printIgnoredDiagnosticBlock(
68+
"reserved-macro-identifier", [&]() {
69+
os << "# ifndef "
70+
"__ptrauth_swift_value_witness_function_pointer\n";
71+
os << "# define "
72+
"__ptrauth_swift_value_witness_function_pointer(x)\n";
73+
os << "# endif\n";
74+
os << "# ifndef __ptrauth_swift_class_method_pointer\n";
75+
os << "# define __ptrauth_swift_class_method_pointer(x)\n";
76+
os << "# endif\n";
77+
});
78+
os << "#endif\n";
7379
});
74-
os << "#endif\n";
7580
});
7681
}
7782

test/PrintAsCxx/empty.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
// CHECK-NEXT: #include <string.h>
4040
// CHECK-NEXT: #endif
4141
// CHECK-NEXT: #if defined(__cplusplus)
42+
// CHECK-NEXT: #pragma clang diagnostic push
43+
// CHECK-NEXT: #pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
4244
// CHECK-NEXT: #if defined(__arm64e__) && __has_include(<ptrauth.h>)
4345
// CHECK-NEXT: # include <ptrauth.h>
4446
// CHECK-NEXT: #else
@@ -52,6 +54,7 @@
5254
// CHECK-NEXT: # endif
5355
// CHECK-NEXT: #pragma clang diagnostic pop
5456
// CHECK-NEXT: #endif
57+
// CHECK-NEXT: #pragma clang diagnostic pop
5558
// CHECK-NEXT: #endif
5659

5760
// CHECK-LABEL: !defined(SWIFT_TYPEDEFS)

0 commit comments

Comments
 (0)