File tree Expand file tree Collapse file tree 7 files changed +21
-1
lines changed Expand file tree Collapse file tree 7 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ class FrontendInputsAndOutputs {
153153 bool shouldTreatAsLLVM () const ;
154154 bool shouldTreatAsSIL () const ;
155155 bool shouldTreatAsModuleInterface () const ;
156+ bool shouldTreatAsObjCHeader () const ;
156157
157158 bool areAllNonPrimariesSIB () const ;
158159
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ enum class InputFileKind {
2626 SwiftLibrary,
2727 SwiftModuleInterface,
2828 SIL,
29- LLVM
29+ LLVM,
30+ ObjCHeader,
3031};
3132
3233// Inputs may include buffers that override contents, and eventually should
Original file line number Diff line number Diff line change @@ -423,6 +423,8 @@ bool ArgsToFrontendOptionsConverter::setUpInputKindAndImmediateArgs() {
423423 Opts.InputKind = InputFileKind::SIL;
424424 else if (Opts.InputsAndOutputs .shouldTreatAsLLVM ())
425425 Opts.InputKind = InputFileKind::LLVM;
426+ else if (Opts.InputsAndOutputs .shouldTreatAsObjCHeader ())
427+ Opts.InputKind = InputFileKind::ObjCHeader;
426428 else if (Opts.InputsAndOutputs .shouldTreatAsModuleInterface ())
427429 Opts.InputKind = InputFileKind::SwiftModuleInterface;
428430 else if (Args.hasArg (OPT_parse_as_library))
Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ SourceFileKind CompilerInvocation::getSourceFileKind() const {
238238 return SourceFileKind::SIL;
239239 case InputFileKind::None:
240240 case InputFileKind::LLVM:
241+ case InputFileKind::ObjCHeader:
241242 llvm_unreachable (" Trying to convert from unsupported InputFileKind" );
242243 }
243244
Original file line number Diff line number Diff line change @@ -586,6 +586,7 @@ static bool shouldTreatSingleInputAsMain(InputFileKind inputKind) {
586586 return true ;
587587 case InputFileKind::SwiftLibrary:
588588 case InputFileKind::LLVM:
589+ case InputFileKind::ObjCHeader:
589590 case InputFileKind::None:
590591 return false ;
591592 }
Original file line number Diff line number Diff line change @@ -199,6 +199,19 @@ bool FrontendInputsAndOutputs::shouldTreatAsSIL() const {
199199 llvm_unreachable (" Either all primaries or none must end with .sil" );
200200}
201201
202+ bool FrontendInputsAndOutputs::shouldTreatAsObjCHeader () const {
203+ if (hasSingleInput ()) {
204+ StringRef InputExt = llvm::sys::path::extension (getFilenameOfFirstInput ());
205+ switch (file_types::lookupTypeForExtension (InputExt)) {
206+ case file_types::TY_ObjCHeader:
207+ return true ;
208+ default :
209+ return false ;
210+ }
211+ }
212+ return false ;
213+ }
214+
202215bool FrontendInputsAndOutputs::areAllNonPrimariesSIB () const {
203216 for (const InputFile &input : AllInputs) {
204217 if (input.isPrimary ())
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ bool swift::inputFileKindCanHaveTBDValidated(InputFileKind kind) {
6969 case InputFileKind::None:
7070 case InputFileKind::SIL:
7171 case InputFileKind::LLVM:
72+ case InputFileKind::ObjCHeader:
7273 return false ;
7374 }
7475 llvm_unreachable (" unhandled kind" );
You can’t perform that action at this time.
0 commit comments