mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[cxx-interop] Emit C++ declarations only when '-clang-header-expose-public-decl' is enabled
This fix also ensures that we only emit C++ functions for now
This commit is contained in:
@@ -179,13 +179,15 @@ static bool writeSIL(SILModule &SM, const PrimarySpecificPaths &PSPs,
|
||||
///
|
||||
/// \see swift::printAsClangHeader
|
||||
static bool printAsClangHeaderIfNeeded(StringRef outputPath, ModuleDecl *M,
|
||||
StringRef bridgingHeader) {
|
||||
StringRef bridgingHeader,
|
||||
bool ExposePublicDeclsInClangHeader) {
|
||||
if (outputPath.empty())
|
||||
return false;
|
||||
return withOutputFile(M->getDiags(), outputPath,
|
||||
[&](raw_ostream &out) -> bool {
|
||||
return printAsClangHeader(out, M, bridgingHeader);
|
||||
});
|
||||
return withOutputFile(
|
||||
M->getDiags(), outputPath, [&](raw_ostream &out) -> bool {
|
||||
return printAsClangHeader(out, M, bridgingHeader,
|
||||
ExposePublicDeclsInClangHeader);
|
||||
});
|
||||
}
|
||||
|
||||
/// Prints the stable module interface for \p M to \p outputPath.
|
||||
@@ -826,7 +828,8 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs(
|
||||
}
|
||||
hadAnyError |= printAsClangHeaderIfNeeded(
|
||||
Invocation.getClangHeaderOutputPathForAtMostOnePrimary(),
|
||||
Instance.getMainModule(), BridgingHeaderPathForPrint);
|
||||
Instance.getMainModule(), BridgingHeaderPathForPrint,
|
||||
opts.ExposePublicDeclsInClangHeader);
|
||||
}
|
||||
|
||||
// Only want the header if there's been any errors, ie. there's not much
|
||||
|
||||
Reference in New Issue
Block a user