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 {
153
153
bool shouldTreatAsLLVM () const ;
154
154
bool shouldTreatAsSIL () const ;
155
155
bool shouldTreatAsModuleInterface () const ;
156
+ bool shouldTreatAsObjCHeader () const ;
156
157
157
158
bool areAllNonPrimariesSIB () const ;
158
159
Original file line number Diff line number Diff line change @@ -26,7 +26,8 @@ enum class InputFileKind {
26
26
SwiftLibrary,
27
27
SwiftModuleInterface,
28
28
SIL,
29
- LLVM
29
+ LLVM,
30
+ ObjCHeader,
30
31
};
31
32
32
33
// 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() {
423
423
Opts.InputKind = InputFileKind::SIL;
424
424
else if (Opts.InputsAndOutputs .shouldTreatAsLLVM ())
425
425
Opts.InputKind = InputFileKind::LLVM;
426
+ else if (Opts.InputsAndOutputs .shouldTreatAsObjCHeader ())
427
+ Opts.InputKind = InputFileKind::ObjCHeader;
426
428
else if (Opts.InputsAndOutputs .shouldTreatAsModuleInterface ())
427
429
Opts.InputKind = InputFileKind::SwiftModuleInterface;
428
430
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 {
238
238
return SourceFileKind::SIL;
239
239
case InputFileKind::None:
240
240
case InputFileKind::LLVM:
241
+ case InputFileKind::ObjCHeader:
241
242
llvm_unreachable (" Trying to convert from unsupported InputFileKind" );
242
243
}
243
244
Original file line number Diff line number Diff line change @@ -586,6 +586,7 @@ static bool shouldTreatSingleInputAsMain(InputFileKind inputKind) {
586
586
return true ;
587
587
case InputFileKind::SwiftLibrary:
588
588
case InputFileKind::LLVM:
589
+ case InputFileKind::ObjCHeader:
589
590
case InputFileKind::None:
590
591
return false ;
591
592
}
Original file line number Diff line number Diff line change @@ -199,6 +199,19 @@ bool FrontendInputsAndOutputs::shouldTreatAsSIL() const {
199
199
llvm_unreachable (" Either all primaries or none must end with .sil" );
200
200
}
201
201
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
+
202
215
bool FrontendInputsAndOutputs::areAllNonPrimariesSIB () const {
203
216
for (const InputFile &input : AllInputs) {
204
217
if (input.isPrimary ())
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ bool swift::inputFileKindCanHaveTBDValidated(InputFileKind kind) {
69
69
case InputFileKind::None:
70
70
case InputFileKind::SIL:
71
71
case InputFileKind::LLVM:
72
+ case InputFileKind::ObjCHeader:
72
73
return false ;
73
74
}
74
75
llvm_unreachable (" unhandled kind" );
You can’t perform that action at this time.
0 commit comments