mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #65985 from cachemeifyoucan/eng/PR-109411245
[ObjcHeader] Fix objc header generation when pch is explicited passed
This commit is contained in:
@@ -818,6 +818,26 @@ SourceFile *CompilerInstance::getIDEInspectionFile() const {
|
||||
return evaluateOrDefault(eval, IDEInspectionFileRequest{mod}, nullptr);
|
||||
}
|
||||
|
||||
static inline bool isPCHFilenameExtension(StringRef path) {
|
||||
return llvm::sys::path::extension(path)
|
||||
.endswith(file_types::getExtension(file_types::TY_PCH));
|
||||
}
|
||||
|
||||
std::string CompilerInstance::getBridgingHeaderPath() const {
|
||||
const FrontendOptions &opts = Invocation.getFrontendOptions();
|
||||
if (!isPCHFilenameExtension(opts.ImplicitObjCHeaderPath))
|
||||
return opts.ImplicitObjCHeaderPath;
|
||||
|
||||
auto clangImporter =
|
||||
static_cast<ClangImporter *>(getASTContext().getClangModuleLoader());
|
||||
|
||||
// No clang importer created. Report error?
|
||||
if (!clangImporter)
|
||||
return std::string();
|
||||
|
||||
return clangImporter->getOriginalSourceFile(opts.ImplicitObjCHeaderPath);
|
||||
}
|
||||
|
||||
bool CompilerInstance::setUpInputs() {
|
||||
// Adds to InputSourceCodeBufferIDs, so may need to happen before the
|
||||
// per-input setup.
|
||||
|
||||
Reference in New Issue
Block a user