Skip to content

ClangImporter: make bridging header portable #20707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,12 @@ bool ClangImporter::importBridgingHeader(StringRef header, ModuleDecl *adapter,
return true;
}

llvm::SmallString<128> importLine{"#import \""};
llvm::SmallString<128> importLine;
if (Impl.SwiftContext.LangOpts.EnableObjCInterop)
importLine = "#import \"";
else
importLine = "#include \"";

importLine += header;
importLine += "\"\n";

Expand Down
7 changes: 7 additions & 0 deletions test/ClangImporter/Inputs/app-bridging-header-to-pch.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@

#ifndef app_bridging_header_to_pch_h
#define app_bridging_header_to_pch_h

static inline int app_function(int x) {
return x + 27;
}

#endif

Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@

#ifndef chained_unit_test_bridging_header_to_pch_h
#define chained_unit_test_bridging_header_to_pch_h

#include "app-bridging-header-to-pch.h"

static inline int unit_test_function(int x) {
return x + 28;
}

#endif