Skip to content

Commit 2db0e8a

Browse files
authored
Merge pull request #85439 from egorzhdan/egorzhdan/endif-objc
[cxx-interop] Emit `#endif // defined(__OBJC__)` with the comment consistently
2 parents 121c759 + 8cafef0 commit 2db0e8a

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

lib/PrintAsClang/DeclAndTypePrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,7 +1574,7 @@ class DeclAndTypePrinter::Implementation
15741574
}
15751575
os << "\n";
15761576
if (representation.isObjCxxOnly())
1577-
os << "#endif\n";
1577+
os << "#endif // defined(__OBJC__)\n";
15781578
return representation;
15791579
}
15801580

@@ -1684,7 +1684,7 @@ class DeclAndTypePrinter::Implementation
16841684
FD->getParameters(), funcTy->isThrowing(), funcTy);
16851685
os << "}\n";
16861686
if (result.isObjCxxOnly())
1687-
os << "#endif\n";
1687+
os << "#endif // defined(__OBJC__)\n";
16881688
}
16891689

16901690
enum class PrintLeadingSpace : bool {

lib/PrintAsClang/PrintAsClang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static void emitObjCConditional(raw_ostream &out,
5656
out << "#else\n";
5757
nonObjCCase();
5858
}
59-
out << "#endif\n";
59+
out << "#endif // defined(__OBJC__)\n";
6060
}
6161

6262
static void emitExternC(raw_ostream &out,

lib/PrintAsClang/PrintClangFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ void DeclAndTypeClangFunctionPrinter::printCxxMethod(
16861686
if (!isDefinition) {
16871687
os << ";\n";
16881688
if (result.isObjCxxOnly())
1689-
os << "#endif\n";
1689+
os << "#endif // defined(__OBJC__)\n";
16901690
return;
16911691
}
16921692

@@ -1699,7 +1699,7 @@ void DeclAndTypeClangFunctionPrinter::printCxxMethod(
16991699
dispatchInfo);
17001700
os << " }\n";
17011701
if (result.isObjCxxOnly())
1702-
os << "#endif\n";
1702+
os << "#endif // defined(__OBJC__)\n";
17031703
}
17041704

17051705
/// Returns true if the given property name like `isEmpty` can be remapped

lib/PrintAsClang/PrintClangValueType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ void ClangValueTypePrinter::printTypeGenericTraits(
737737
os << "} // namespace\n";
738738
os << "#pragma clang diagnostic pop\n";
739739
if (objCxxOnly)
740-
os << "#endif // #if defined(__OBJC__)\n";
740+
os << "#endif // defined(__OBJC__)\n";
741741
os << "} // namespace swift\n";
742742
os << "\n";
743743
printer.printModuleNamespaceStart(*moduleContext);

test/PrintAsObjC/Inputs/comments-expected-output.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ SWIFT_CLASS("_TtC8comments13UnorderedList")
412412
- (void)f0;
413413
@end
414414

415-
#endif
415+
#endif // defined(__OBJC__)
416416
#if __has_attribute(external_source_symbol)
417417
# pragma clang attribute pop
418418
#endif

0 commit comments

Comments
 (0)