Skip to content

Commit a0ad027

Browse files
authored
Merge pull request swiftlang#30337 from nkcsgexi/walk-around-headers
PrintAsObjc: strip Headers and PrivateHeaders component in header paths explicitly
2 parents 52fe9ba + 411833d commit a0ad027

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/PrintAsObjC/PrintAsObjC.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,12 @@ static void writeImports(raw_ostream &out,
325325
const clang::Module *module) {
326326
auto startIdx = allPaths.size();
327327
if (module->IsFramework) {
328+
SmallString<64> Buffer(header.NameAsWritten);
329+
llvm::sys::path::replace_path_prefix(Buffer, "Headers/", StringRef());
330+
llvm::sys::path::replace_path_prefix(Buffer, "PrivateHeaders/", StringRef());
328331
// For framworks, the header import should start from the framework name.
329332
allPaths.append(module->getTopLevelModuleName());
330-
llvm::sys::path::append(allPaths, header.NameAsWritten);
333+
llvm::sys::path::append(allPaths, Buffer.str());
331334
} else {
332335
// Otherwise, import the header directly.
333336
allPaths.append(header.NameAsWritten);

0 commit comments

Comments
 (0)